-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Queue a task to handle media session action #314
Conversation
It is unclear what the exact model here is related to queuing a task. In particular, there is already in the spec:
@steimelchrome, do you know what Chrome is doing in terms of implementation in that area? |
Queuing a task here is necessary to preserve run-to-completion semantics. Action handlers being event-like means: "You should always defer events if the algorithm that triggers the event could be running on a different thread or process. In this case, deferral ensures the events can be processed on the correct task in the task queue."
AFAIK best practice is to queue a task for each event, keeping things nice and separate. Coalescing event firing into a single task creates all sorts of headaches, including (historically) sec bugs running c++ after JS. The spec already seems to assume this to some extent, by specifically calling for special handling of "joint commands": "When the user agent receives a joint command for play and pause, such as a headset button click,"
That language seems flawed as it assumes a mode where user agents do NOT need to queue a task to get on the event loop, and that this mode would somehow create "UI flickering". Last I checked, queuing a task does not "avoid UI flickering". |
If I'm reading the code correctly, we're currently queueing a task per action, and they're all on the same task source (MiscPlatformAPI for now, though we'd move to the UserInteraction source for this change). I don't think there's any way for us to run two actions simultaneously |
SHA: 99e66fc Reason: push, by youennf Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Need a task to invoke the handle media session action on.
Preview | Diff