(root, expirationTime)
| 12837 | // requestWork is called by the scheduler whenever a root receives an update. |
| 12838 | // It's up to the renderer to call renderRoot at some point in the future. |
| 12839 | function requestWork(root, expirationTime) { |
| 12840 | addRootToSchedule(root, expirationTime); |
| 12841 | |
| 12842 | if (isRendering) { |
| 12843 | // Prevent reentrancy. Remaining work will be scheduled at the end of |
| 12844 | // the currently rendering batch. |
| 12845 | return; |
| 12846 | } |
| 12847 | |
| 12848 | if (isBatchingUpdates) { |
| 12849 | // Flush work at the end of the batch. |
| 12850 | if (isUnbatchingUpdates) { |
| 12851 | // ...unless we're inside unbatchedUpdates, in which case we should |
| 12852 | // flush it now. |
| 12853 | nextFlushedRoot = root; |
| 12854 | nextFlushedExpirationTime = Sync; |
| 12855 | performWorkOnRoot(root, Sync, false); |
| 12856 | } |
| 12857 | return; |
| 12858 | } |
| 12859 | |
| 12860 | // TODO: Get rid of Sync and use current time? |
| 12861 | if (expirationTime === Sync) { |
| 12862 | performSyncWork(); |
| 12863 | } else { |
| 12864 | scheduleCallbackWithExpiration(expirationTime); |
| 12865 | } |
| 12866 | } |
| 12867 | |
| 12868 | function addRootToSchedule(root, expirationTime) { |
| 12869 | // Add the root to the schedule. |
no test coverage detected