-
Notifications
You must be signed in to change notification settings - Fork 45.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix case of scheduled callbacks which schedule other callbacks
**what is the change?:** We added support for serial scheduled callbacks to schedule more callbacks, and maintained the order of first-in first-called. **why make this change?:** This is sort of a corner case, but it's totally possible and we do something similar in React. We wouldn't do this with serial callbacks, but with deferred callbacks we do a pattern like this: ``` + + | +--------------------+ +----------------+ | +--------------------------------+ +-------------------------+ | | | | | | | | | | | | main thread blocked| |callback A runs | | | main thread blocked again | |callback A runs again, finishes | +--------------------+ +-----+----------+ | +--------------------------------+ ++------------------------+ v ^ v ^ schedule +------------------------->+ no time left!+----------------------->+ callbackA reschedule | callbackA + to do more work later. ``` **test plan:** Wrote some fun new tests and ran them~ Also ran existing React unit tests. As of this PR they are still directly using this module.
- Loading branch information
Showing
2 changed files
with
223 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters