Summary:
changelog: [internal]
Don't use C++ 17 features in RuntimeScheduler module as it needs to be imported into C++14 module.
Also removes redundant dependency.
Reviewed By: ShikaSD
Differential Revision: D30485642
fbshipit-source-id: 0a20f85c596eebe193affc815c8ca851fc72e46d
Summary:
Changelog: [internal]
If task that is being executed schedules a new task with higher priority, the new task will be dropped from the queue. To fix this, we always check if the top of the queue is what was executed and only then remove it.
Example:
Let's say there is task A with priority "normal".
When we execute task A (which is not removed from the queue until later), it adds a task B with "immediate" priority.
So priority queue now has two tasks: [1: B, 2: A]
After task A finishes, inside workLoop, it will pop from top of the priority queue. But task A is no longer top of the priority queue (this is the bug) and it pops B. B is never executed and A is executed twice.
Reviewed By: ShikaSD
Differential Revision: D29841433
fbshipit-source-id: b2f1474fdfc7b3e2d42bae5b7f4ac7e6c3a37b54
Summary:
Changelog: [internal]
Scheduler's callback have option to add more work inside callback. This work stays on top of the priority queue and gives React ability to flush all work synchronously if need.
This diff adds use of `shouldYield_` to the workLoop. For now, it always evaluates to false. In the future when we allow access to the scheduler to native, it will allow yielding.
Relevant code in JavaScript:
https://github.com/facebook/react/blob/master/packages/scheduler/src/forks/SchedulerNoDOM.js#L190
Reviewed By: mdvacca
Differential Revision: D27823528
fbshipit-source-id: 016101e41eb7c41c2ac5abb55f803814867b8517
Summary:
changelog: [internal]
Callback function in React is expecting a boolean parameter indicating whether the callback timed out. React team is removing it, that's why we only pass in hardcoded false.
Reviewed By: mdvacca
Differential Revision: D27794562
fbshipit-source-id: b96a7b31560524b8f38ad3bb0dbdb3b3b32ac97b
Summary:
Changelog: [internal]
To prevent starvation, this diff implements expiration time as a way to order tasks in priority queue. This stops higher priority tasks from preventing lower priority tasks from running. The same mechanism is implemented in [JavaScript's scheduler](https://github.com/facebook/react/blob/master/packages/scheduler/src/forks/SchedulerNoDOM.js).
Reviewed By: mdvacca
Differential Revision: D27707887
fbshipit-source-id: 3dc734c856a166ef5c17c5045ebd429565ba79f0
Summary:
Changelog: [internal]
Add minimal implementation of schedule task. More features and proper scheduling will be added later.
Reviewed By: mdvacca
Differential Revision: D27622138
fbshipit-source-id: b2e4623d38e7217290a6a3c59ccc10a1c13e3a4f