(minExpirationTime, isAsync, dl)
| 13730 | } |
| 13731 | |
| 13732 | function performWork(minExpirationTime, isAsync, dl) { |
| 13733 | deadline = dl; |
| 13734 | |
| 13735 | // Keep working on roots until there's no more work, or until the we reach |
| 13736 | // the deadline. |
| 13737 | findHighestPriorityRoot(); |
| 13738 | |
| 13739 | if (enableUserTimingAPI && deadline !== null) { |
| 13740 | var didExpire = nextFlushedExpirationTime < recalculateCurrentTime(); |
| 13741 | stopRequestCallbackTimer(didExpire); |
| 13742 | } |
| 13743 | |
| 13744 | if (isAsync) { |
| 13745 | while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime) && (!deadlineDidExpire || recalculateCurrentTime() >= nextFlushedExpirationTime)) { |
| 13746 | performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, !deadlineDidExpire); |
| 13747 | findHighestPriorityRoot(); |
| 13748 | } |
| 13749 | } else { |
| 13750 | while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime)) { |
| 13751 | performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, false); |
| 13752 | findHighestPriorityRoot(); |
| 13753 | } |
| 13754 | } |
| 13755 | |
| 13756 | // We're done flushing work. Either we ran out of time in this callback, |
| 13757 | // or there's no more work left with sufficient priority. |
| 13758 | |
| 13759 | // If we're inside a callback, set this to false since we just completed it. |
| 13760 | if (deadline !== null) { |
| 13761 | callbackExpirationTime = NoWork; |
| 13762 | callbackID = -1; |
| 13763 | } |
| 13764 | // If there's work left over, schedule a new callback. |
| 13765 | if (nextFlushedExpirationTime !== NoWork) { |
| 13766 | scheduleCallbackWithExpiration(nextFlushedExpirationTime); |
| 13767 | } |
| 13768 | |
| 13769 | // Clean-up. |
| 13770 | deadline = null; |
| 13771 | deadlineDidExpire = false; |
| 13772 | |
| 13773 | finishRendering(); |
| 13774 | } |
| 13775 | |
| 13776 | function flushRoot(root, expirationTime) { |
| 13777 | !!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