(root, expirationTime)
| 13477 | // requestWork is called by the scheduler whenever a root receives an update. |
| 13478 | // It's up to the renderer to call renderRoot at some point in the future. |
| 13479 | function requestWork(root, expirationTime) { |
| 13480 | addRootToSchedule(root, expirationTime); |
| 13481 | |
| 13482 | if (isRendering) { |
| 13483 | // Prevent reentrancy. Remaining work will be scheduled at the end of |
| 13484 | // the currently rendering batch. |
| 13485 | return; |
| 13486 | } |
| 13487 | |
| 13488 | if (isBatchingUpdates) { |
| 13489 | // Flush work at the end of the batch. |
| 13490 | if (isUnbatchingUpdates) { |
| 13491 | // ...unless we're inside unbatchedUpdates, in which case we should |
| 13492 | // flush it now. |
| 13493 | nextFlushedRoot = root; |
| 13494 | nextFlushedExpirationTime = Sync; |
| 13495 | performWorkOnRoot(root, Sync, false); |
| 13496 | } |
| 13497 | return; |
| 13498 | } |
| 13499 | |
| 13500 | // TODO: Get rid of Sync and use current time? |
| 13501 | if (expirationTime === Sync) { |
| 13502 | performSyncWork(); |
| 13503 | } else { |
| 13504 | scheduleCallbackWithExpiration(expirationTime); |
| 13505 | } |
| 13506 | } |
| 13507 | |
| 13508 | function addRootToSchedule(root, expirationTime) { |
| 13509 | // Add the root to the schedule. |
no test coverage detected