MCPcopy
hub / github.com/facebook/react / performWorkUntilDeadline

Function performWorkUntilDeadline

packages/scheduler/src/forks/Scheduler.js:485–514  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

483}
484
485const performWorkUntilDeadline = () => {
486 if (enableRequestPaint) {
487 needsPaint = false;
488 }
489 if (isMessageLoopRunning) {
490 const currentTime = getCurrentTime();
491 // Keep track of the start time so we can measure how long the main thread
492 // has been blocked.
493 startTime = currentTime;
494
495 // If a scheduler task throws, exit the current browser task so the
496 // error can be observed.
497 //
498 // Intentionally not using a try-catch, since that makes some debugging
499 // techniques harder. Instead, if `flushWork` errors, then `hasMoreWork` will
500 // remain true, and we'll continue the work loop.
501 let hasMoreWork = true;
502 try {
503 hasMoreWork = flushWork(currentTime);
504 } finally {
505 if (hasMoreWork) {
506 // If there's more work, schedule the next message event at the end
507 // of the preceding one.
508 schedulePerformWorkUntilDeadline();
509 } else {
510 isMessageLoopRunning = false;
511 }
512 }
513 }
514};
515
516let schedulePerformWorkUntilDeadline;
517if (typeof localSetImmediate === 'function') {

Callers

nothing calls this directly

Calls 2

getCurrentTimeFunction · 0.70
flushWorkFunction · 0.70

Tested by

no test coverage detected