(minExpirationTime, isAsync, dl)
| 13981 | } |
| 13982 | |
| 13983 | function performWork(minExpirationTime, isAsync, dl) { |
| 13984 | deadline = dl; |
| 13985 | |
| 13986 | // Keep working on roots until there's no more work, or until the we reach |
| 13987 | // the deadline. |
| 13988 | findHighestPriorityRoot(); |
| 13989 | |
| 13990 | if (enableUserTimingAPI && deadline !== null) { |
| 13991 | var didExpire = nextFlushedExpirationTime < recalculateCurrentTime(); |
| 13992 | stopRequestCallbackTimer(didExpire); |
| 13993 | } |
| 13994 | |
| 13995 | if (isAsync) { |
| 13996 | while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime) && (!deadlineDidExpire || recalculateCurrentTime() >= nextFlushedExpirationTime)) { |
| 13997 | performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, !deadlineDidExpire); |
| 13998 | findHighestPriorityRoot(); |
| 13999 | } |
| 14000 | } else { |
| 14001 | while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime)) { |
| 14002 | performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, false); |
| 14003 | findHighestPriorityRoot(); |
| 14004 | } |
| 14005 | } |
| 14006 | |
| 14007 | // We're done flushing work. Either we ran out of time in this callback, |
| 14008 | // or there's no more work left with sufficient priority. |
| 14009 | |
| 14010 | // If we're inside a callback, set this to false since we just completed it. |
| 14011 | if (deadline !== null) { |
| 14012 | callbackExpirationTime = NoWork; |
| 14013 | callbackID = -1; |
| 14014 | } |
| 14015 | // If there's work left over, schedule a new callback. |
| 14016 | if (nextFlushedExpirationTime !== NoWork) { |
| 14017 | scheduleCallbackWithExpiration(nextFlushedExpirationTime); |
| 14018 | } |
| 14019 | |
| 14020 | // Clean-up. |
| 14021 | deadline = null; |
| 14022 | deadlineDidExpire = false; |
| 14023 | |
| 14024 | finishRendering(); |
| 14025 | } |
| 14026 | |
| 14027 | function flushRoot(root, expirationTime) { |
| 14028 | !!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