()
| 483 | } |
| 484 | |
| 485 | const 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 | |
| 516 | let schedulePerformWorkUntilDeadline; |
| 517 | if (typeof localSetImmediate === 'function') { |
nothing calls this directly
no test coverage detected