(minExpirationTime, isAsync, dl)
| 13603 | } |
| 13604 | |
| 13605 | function performWork(minExpirationTime, isAsync, dl) { |
| 13606 | deadline = dl; |
| 13607 | |
| 13608 | // Keep working on roots until there's no more work, or until the we reach |
| 13609 | // the deadline. |
| 13610 | findHighestPriorityRoot(); |
| 13611 | |
| 13612 | if (enableUserTimingAPI && deadline !== null) { |
| 13613 | var didExpire = nextFlushedExpirationTime < recalculateCurrentTime(); |
| 13614 | stopRequestCallbackTimer(didExpire); |
| 13615 | } |
| 13616 | |
| 13617 | if (isAsync) { |
| 13618 | while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime) && (!deadlineDidExpire || recalculateCurrentTime() >= nextFlushedExpirationTime)) { |
| 13619 | performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, !deadlineDidExpire); |
| 13620 | findHighestPriorityRoot(); |
| 13621 | } |
| 13622 | } else { |
| 13623 | while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime)) { |
| 13624 | performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, false); |
| 13625 | findHighestPriorityRoot(); |
| 13626 | } |
| 13627 | } |
| 13628 | |
| 13629 | // We're done flushing work. Either we ran out of time in this callback, |
| 13630 | // or there's no more work left with sufficient priority. |
| 13631 | |
| 13632 | // If we're inside a callback, set this to false since we just completed it. |
| 13633 | if (deadline !== null) { |
| 13634 | callbackExpirationTime = NoWork; |
| 13635 | callbackID = -1; |
| 13636 | } |
| 13637 | // If there's work left over, schedule a new callback. |
| 13638 | if (nextFlushedExpirationTime !== NoWork) { |
| 13639 | scheduleCallbackWithExpiration(nextFlushedExpirationTime); |
| 13640 | } |
| 13641 | |
| 13642 | // Clean-up. |
| 13643 | deadline = null; |
| 13644 | deadlineDidExpire = false; |
| 13645 | |
| 13646 | finishRendering(); |
| 13647 | } |
| 13648 | |
| 13649 | function flushRoot(root, expirationTime) { |
| 13650 | !!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