(minExpirationTime, isAsync, dl)
| 13823 | } |
| 13824 | |
| 13825 | function performWork(minExpirationTime, isAsync, dl) { |
| 13826 | deadline = dl; |
| 13827 | |
| 13828 | // Keep working on roots until there's no more work, or until the we reach |
| 13829 | // the deadline. |
| 13830 | findHighestPriorityRoot(); |
| 13831 | |
| 13832 | if (enableUserTimingAPI && deadline !== null) { |
| 13833 | var didExpire = nextFlushedExpirationTime < recalculateCurrentTime(); |
| 13834 | stopRequestCallbackTimer(didExpire); |
| 13835 | } |
| 13836 | |
| 13837 | if (isAsync) { |
| 13838 | while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime) && (!deadlineDidExpire || recalculateCurrentTime() >= nextFlushedExpirationTime)) { |
| 13839 | performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, !deadlineDidExpire); |
| 13840 | findHighestPriorityRoot(); |
| 13841 | } |
| 13842 | } else { |
| 13843 | while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime)) { |
| 13844 | performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, false); |
| 13845 | findHighestPriorityRoot(); |
| 13846 | } |
| 13847 | } |
| 13848 | |
| 13849 | // We're done flushing work. Either we ran out of time in this callback, |
| 13850 | // or there's no more work left with sufficient priority. |
| 13851 | |
| 13852 | // If we're inside a callback, set this to false since we just completed it. |
| 13853 | if (deadline !== null) { |
| 13854 | callbackExpirationTime = NoWork; |
| 13855 | callbackID = -1; |
| 13856 | } |
| 13857 | // If there's work left over, schedule a new callback. |
| 13858 | if (nextFlushedExpirationTime !== NoWork) { |
| 13859 | scheduleCallbackWithExpiration(nextFlushedExpirationTime); |
| 13860 | } |
| 13861 | |
| 13862 | // Clean-up. |
| 13863 | deadline = null; |
| 13864 | deadlineDidExpire = false; |
| 13865 | |
| 13866 | finishRendering(); |
| 13867 | } |
| 13868 | |
| 13869 | function flushRoot(root, expirationTime) { |
| 13870 | !!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