(minExpirationTime, isAsync, dl)
| 13868 | } |
| 13869 | |
| 13870 | function performWork(minExpirationTime, isAsync, dl) { |
| 13871 | deadline = dl; |
| 13872 | |
| 13873 | // Keep working on roots until there's no more work, or until the we reach |
| 13874 | // the deadline. |
| 13875 | findHighestPriorityRoot(); |
| 13876 | |
| 13877 | if (enableUserTimingAPI && deadline !== null) { |
| 13878 | var didExpire = nextFlushedExpirationTime < recalculateCurrentTime(); |
| 13879 | stopRequestCallbackTimer(didExpire); |
| 13880 | } |
| 13881 | |
| 13882 | if (isAsync) { |
| 13883 | while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime) && (!deadlineDidExpire || recalculateCurrentTime() >= nextFlushedExpirationTime)) { |
| 13884 | performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, !deadlineDidExpire); |
| 13885 | findHighestPriorityRoot(); |
| 13886 | } |
| 13887 | } else { |
| 13888 | while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime)) { |
| 13889 | performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, false); |
| 13890 | findHighestPriorityRoot(); |
| 13891 | } |
| 13892 | } |
| 13893 | |
| 13894 | // We're done flushing work. Either we ran out of time in this callback, |
| 13895 | // or there's no more work left with sufficient priority. |
| 13896 | |
| 13897 | // If we're inside a callback, set this to false since we just completed it. |
| 13898 | if (deadline !== null) { |
| 13899 | callbackExpirationTime = NoWork; |
| 13900 | callbackID = -1; |
| 13901 | } |
| 13902 | // If there's work left over, schedule a new callback. |
| 13903 | if (nextFlushedExpirationTime !== NoWork) { |
| 13904 | scheduleCallbackWithExpiration(nextFlushedExpirationTime); |
| 13905 | } |
| 13906 | |
| 13907 | // Clean-up. |
| 13908 | deadline = null; |
| 13909 | deadlineDidExpire = false; |
| 13910 | |
| 13911 | finishRendering(); |
| 13912 | } |
| 13913 | |
| 13914 | function flushRoot(root, expirationTime) { |
| 13915 | !!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