Repository navigation
Define when and how regular tasks are processed wrt the processing model - #2301
Conversation
hoch
left a comment
There was a problem hiding this comment.
Thank you so much for working on this! 👍
A general comment: We have 1) the main thread task queue, 2) context's control message queue, and 3) render thread's message queue. Probably it's better to clarify them in this context.
L.10088 ~ L.10090 seems like a great place to add a section for this clarification.
| <a>rendering thread</a> has another task queue for microtasks for any microtask | ||
| operation such as resolution of {{Promise}}s in the {{AudioWorkletGlobalScope}}. | ||
| filling up the requested buffer size. Along with the primary message queue, each | ||
| {{AudioContext}} has a regular task queue for tasks that are posted to |
There was a problem hiding this comment.
Same: What are primary message queue and regular task queue here? We might want to clarify these terms.
There was a problem hiding this comment.
The message queue is a queue of messages, and a task queue is a queue of tasks.
| have been queued during the execution of the `process` methods of | ||
| {{AudioWorkletProcessor}}. | ||
|
|
||
| All tasks posted from an {{AudioWorkletNode}} are posted to this task queue. |
There was a problem hiding this comment.
this task queue means control message queue. Right?
There was a problem hiding this comment.
No, those are different.
|
|
||
| 3. Process a render quantum. | ||
|
|
||
| 3. Process the regular event queue. |
There was a problem hiding this comment.
regular event queue - I think it's better to define 3 different types of queues somewhere. Also it seems like we are using different terms interchangeably. (e.g. task queue, message queue, and event queue)
Let's make a section and stick to it.
There was a problem hiding this comment.
Sure. The terms are not used interchangeably however.
| 1. Let <var>task count</var> be the number of tasks in the task queue of | ||
| the task queue of the {{AudioContext}} being rendered. | ||
|
|
||
| 2. Spin the event loop until <var>task count</var> tasks have been executed. |
There was a problem hiding this comment.
Do we really need task count? Can we just say:
"Run the event loop until all queued tasks in Q are executed."
(Q can be defined somewhere)
There was a problem hiding this comment.
I haven't found a way to define this more cleanly, this is unambiguous. In particular, I haven't found a way to define Q. I'm happy to hear any idea though.
padenot
left a comment
There was a problem hiding this comment.
Here is a new iteration. I've tried to use linking to make it clear. I've also fixed the typos and other issues.
| have been queued during the execution of the `process` methods of | ||
| {{AudioWorkletProcessor}}. | ||
|
|
||
| All tasks posted from an {{AudioWorkletNode}} are posted to this task queue. |
There was a problem hiding this comment.
No, those are different.
| 1. Let <var>task count</var> be the number of tasks in the task queue of | ||
| the task queue of the {{AudioContext}} being rendered. | ||
|
|
||
| 2. Spin the event loop until <var>task count</var> tasks have been executed. |
There was a problem hiding this comment.
I haven't found a way to define this more cleanly, this is unambiguous. In particular, I haven't found a way to define Q. I'm happy to hear any idea though.
| <a>rendering thread</a> has another task queue for microtasks for any microtask | ||
| operation such as resolution of {{Promise}}s in the {{AudioWorkletGlobalScope}}. | ||
| filling up the requested buffer size. Along with the primary message queue, each | ||
| {{AudioContext}} has a regular task queue for tasks that are posted to |
There was a problem hiding this comment.
The message queue is a queue of messages, and a task queue is a queue of tasks.
|
|
||
| 3. Process a render quantum. | ||
|
|
||
| 3. Process the regular event queue. |
There was a problem hiding this comment.
Sure. The terms are not used interchangeably however.
hoch
left a comment
There was a problem hiding this comment.
Thanks! The new iteration looks good to me.
| The audio callback is also queued as a task in the | ||
| <a href="#control-message-queue">control message queue</a>. The UA MUST perform | ||
| The audio callback is also queued as a task in the <a | ||
| href="#control-message-queue">control message queue</a>. The UA MUST perform |
There was a problem hiding this comment.
No idea. I'll check locally by running bikeshed and merge as is if needed, or fixed if not. Thanks for the quick re-review!
A first cut for this, after reading lots of WHATWG text. Step 3.1 is necessary to avoid DOSing the render thread. I don't know if we want to be more precise for dispatching tasks, but considering the existence of an
implied event loop, we're probably good.This fixes #2008.
Preview | Diff