Skip to content
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

Use HTML's "wait for timeout" #54

Merged
merged 1 commit into from
Feb 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 5 additions & 21 deletions spec/scheduling-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,34 +246,18 @@ Processing Model {#sec-scheduling-tasks-processing-model}
1. Let |queue| be the result of [=selecting the scheduler task queue=] for
|scheduler| given |signal| and |priority|.
1. Let |delay| be |options|["{{SchedulerPostTaskOptions/delay}}"].
1. If |delay| is greater than 0, then run these steps [=in parallel=]:
1. Let |global| be the [=relevant global object=] for |scheduler|.
1. If |global| is a {{Window}} object, wait until |global|'s
<a attribute for="Window">associated <code>Document</code></a>
has been [=Document/fully active=] for a further |delay| milliseconds (not necessarily
consecutively).

Otherwise, |global| is a {{WorkerGlobalScope}} object; wait until |delay|
milliseconds have passed with the worker not suspended (not necessarily
consecutively).

1. Wait until any invocations of this algorithm that had the same |scheduler|,
that started before this one, and whose |delay| is equal to or less
than this one's, have completed.
1. Optionally, wait a further [=implementation-defined=] length of time.
1. If |delay| is greater than 0, then [=run steps after a timeout=] given
|scheduler|'s [=relevant global object=], "`scheduler-postTask`",
|delay|, and the following steps:
1. [=Schedule a task to invoke a callback=] for |scheduler| given |queue|,
|signal|, |callback|, and |result|.
1. Otherwise, [=schedule a task to invoke a callback=] for |scheduler| given
|queue|, |signal|, |callback|, and |result|.
1. Return |result|.
</div>

Issue: We need to figure out exactly how we want to spec delayed tasks, and if
we can refactor the timer spec to use a common method. As written, this uses
steps 15&ndash;17 of the timer initialization steps algorithm, but there are a
couple things we might want to change: (1) how to account for suspend? (2) how
to account for current throttling techniques (see also
[this issue](https://github.com/whatwg/html/issues/5925))?
Issue: [=Run steps after a timeout=] doesn't necessarily account for suspension;
see [whatwg/html#5925](https://github.com/whatwg/html/issues/5925).

<div algorithm="select the scheduler task queue">
To <dfn lt="select the scheduler task queue|selecting the scheduler task queue">select the scheduler task queue</dfn>
Expand Down