(minExpirationTime, isAsync, dl)
| 13091 | } |
| 13092 | |
| 13093 | function performWork(minExpirationTime, isAsync, dl) { |
| 13094 | deadline = dl; |
| 13095 | |
| 13096 | // Keep working on roots until there's no more work, or until the we reach |
| 13097 | // the deadline. |
| 13098 | findHighestPriorityRoot(); |
| 13099 | |
| 13100 | if (enableUserTimingAPI && deadline !== null) { |
| 13101 | var didExpire = nextFlushedExpirationTime < recalculateCurrentTime(); |
| 13102 | stopRequestCallbackTimer(didExpire); |
| 13103 | } |
| 13104 | |
| 13105 | if (isAsync) { |
| 13106 | while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime) && (!deadlineDidExpire || recalculateCurrentTime() >= nextFlushedExpirationTime)) { |
| 13107 | performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, !deadlineDidExpire); |
| 13108 | findHighestPriorityRoot(); |
| 13109 | } |
| 13110 | } else { |
| 13111 | while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime)) { |
| 13112 | performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, false); |
| 13113 | findHighestPriorityRoot(); |
| 13114 | } |
| 13115 | } |
| 13116 | |
| 13117 | // We're done flushing work. Either we ran out of time in this callback, |
| 13118 | // or there's no more work left with sufficient priority. |
| 13119 | |
| 13120 | // If we're inside a callback, set this to false since we just completed it. |
| 13121 | if (deadline !== null) { |
| 13122 | callbackExpirationTime = NoWork; |
| 13123 | callbackID = -1; |
| 13124 | } |
| 13125 | // If there's work left over, schedule a new callback. |
| 13126 | if (nextFlushedExpirationTime !== NoWork) { |
| 13127 | scheduleCallbackWithExpiration(nextFlushedExpirationTime); |
| 13128 | } |
| 13129 | |
| 13130 | // Clean-up. |
| 13131 | deadline = null; |
| 13132 | deadlineDidExpire = false; |
| 13133 | |
| 13134 | finishRendering(); |
| 13135 | } |
| 13136 | |
| 13137 | function flushRoot(root, expirationTime) { |
| 13138 | !!isRendering ? invariant(false, 'work.commit(): Cannot commit while already rendering. This likely means you attempted to commit from inside a lifecycle method.') : void 0; |
no test coverage detected