(minExpirationTime, isAsync, dl)
| 12963 | } |
| 12964 | |
| 12965 | function performWork(minExpirationTime, isAsync, dl) { |
| 12966 | deadline = dl; |
| 12967 | |
| 12968 | // Keep working on roots until there's no more work, or until the we reach |
| 12969 | // the deadline. |
| 12970 | findHighestPriorityRoot(); |
| 12971 | |
| 12972 | if (enableUserTimingAPI && deadline !== null) { |
| 12973 | var didExpire = nextFlushedExpirationTime < recalculateCurrentTime(); |
| 12974 | stopRequestCallbackTimer(didExpire); |
| 12975 | } |
| 12976 | |
| 12977 | if (isAsync) { |
| 12978 | while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime) && (!deadlineDidExpire || recalculateCurrentTime() >= nextFlushedExpirationTime)) { |
| 12979 | performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, !deadlineDidExpire); |
| 12980 | findHighestPriorityRoot(); |
| 12981 | } |
| 12982 | } else { |
| 12983 | while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime)) { |
| 12984 | performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, false); |
| 12985 | findHighestPriorityRoot(); |
| 12986 | } |
| 12987 | } |
| 12988 | |
| 12989 | // We're done flushing work. Either we ran out of time in this callback, |
| 12990 | // or there's no more work left with sufficient priority. |
| 12991 | |
| 12992 | // If we're inside a callback, set this to false since we just completed it. |
| 12993 | if (deadline !== null) { |
| 12994 | callbackExpirationTime = NoWork; |
| 12995 | callbackID = -1; |
| 12996 | } |
| 12997 | // If there's work left over, schedule a new callback. |
| 12998 | if (nextFlushedExpirationTime !== NoWork) { |
| 12999 | scheduleCallbackWithExpiration(nextFlushedExpirationTime); |
| 13000 | } |
| 13001 | |
| 13002 | // Clean-up. |
| 13003 | deadline = null; |
| 13004 | deadlineDidExpire = false; |
| 13005 | |
| 13006 | finishRendering(); |
| 13007 | } |
| 13008 | |
| 13009 | function flushRoot(root, expirationTime) { |
| 13010 | !!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