Implement RFC #957: Render Aware Scheduler Interface - #21552
Draft
NullVoxPopuli wants to merge 1 commit into
Draft
Implement RFC #957: Render Aware Scheduler Interface#21552NullVoxPopuli wants to merge 1 commit into
NullVoxPopuli wants to merge 1 commit into
Conversation
Adds the `@ember/scheduler` package proposed by RFC 0957:
- `render`, `layout`, `composite`, `next` and `idle` phase functions,
each returning a promise that resolves according to the registered
scheduling strategy
- `registerStrategy`, for providing the scheduling strategy when defining
the Application
- `@ember/scheduler/strategy`, the default strategy implementation, which
flushes the render/layout/composite phases in order via ordered
requestAnimationFrame callbacks within a single frame, prior to paint
The deprecations of @ember/runloop and RSVP described by the RFC are left
to follow-up work; this is the additive API surface.
Fix Safari flake and idle() starvation in the default strategy
The "composite while composite is flushing" test asserted ordering across
two independent channels: a setTimeout task scheduled during frame 1
versus frame 2's requestAnimationFrame callbacks. The HTML spec does not
order pending timer tasks against the next rendering opportunity, and
Safari 15.6 runs the next frame's rAF callbacks first. The test now
anchors entirely to the rAF channel, using a raw requestAnimationFrame
registered ahead of the rescheduled phase windows as the frame-2
boundary.
idle() also armed requestIdleCallback without a timeout; fully-idle or
backgrounded pages can starve rIC indefinitely, leaving the promise
unresolvable. Cap the wait with { timeout: 500 }.
Contributor
📊 Size reportTarball size — dist/dev 0.6%↑
dist/prod 0.6%↑
smoke-tests/v2-app-template/dist No changes
smoke-tests/v2-app-hello-world-template/dist No changes
🤖 This report was automatically generated by wyvox/pkg-size |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes:
Implements (phase one of):
Why:
This part 1 is just the interface and is not hooked up to anything. Users of the interface would not be able to see any benefit if they implement a strategy.
Note
The scheduler is not a backburner replacement, it's a means to give consistent naming to platform concepts and their timing, so that when we deprecate rsvp, backburner, the runloop, etc, ember's renderer can use these platform concepts natively (abstraction-less)
This sort of work is a little large (and the RFC is not accepted), so I'm splitting the hook-in-to-existing-behavior to a separate PR here: