Skip to content

Commit

Permalink
Introduce a parallel queue for running Jobs
Browse files Browse the repository at this point in the history
This change defines a parallel queue called the service worker manager
where the instances of Run Job steps are queued and run in order.

Fixes #1224.
  • Loading branch information
jungkees committed Nov 17, 2017
1 parent d7f005d commit b378b22
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
18 changes: 13 additions & 5 deletions docs/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,14 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
Note: A user agent may use a separate task source for each functional event type in order to avoid a head-of-line blocking phenomenon for certain functional events.
</section>

<section>
<h3 id="user-agent-bootup">User Agent Boot up</h3>

A user agent has an associated <dfn export id="dfn-service-worker-manager">service worker manager</dfn>.

A user agent *must* [=start a new parallel queue=] when it boots up and set the [=service worker manager=] to the result value.
</section>

<section>
<h3 id="user-agent-shutdown">User Agent Shutdown</h3>

Expand Down Expand Up @@ -2223,15 +2231,15 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
: Output
:: none

1. Assert: |jobQueue| [=queue/is not empty=].
1. [=Queue a task=] to run these steps:
1. [=Enqueue the following steps=] to the [=service worker manager=]:
1. Assert: |jobQueue| [=queue/is not empty=].
1. Let |job| be the first [=queue/item=] in |jobQueue|.
1. If |job|'s [=job type=] is *register*, run [=Register=] with |job| [=in parallel=].
1. Else if |job|'s [=job type=] is *update*, run [=Update=] with |job| [=in parallel=].
1. If |job|'s [=job type=] is *register*, run [=Register=] with |job|.
1. Else if |job|'s [=job type=] is *update*, run [=Update=] with |job|.

Note: For a register job and an update job, the user agent delays queuing a task for running the job until after a {{Document/DOMContentLoaded}} event has been dispatched to the document that initiated the job.

1. Else if |job|'s [=job type=] is *unregister*, run [=Unregister=] with |job| [=in parallel=].
1. Else if |job|'s [=job type=] is *unregister*, run [=Unregister=] with |job|.
</section>

<section algorithm>
Expand Down
18 changes: 13 additions & 5 deletions docs/v1/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,14 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
Note: A user agent may use a separate task source for each functional event type in order to avoid a head-of-line blocking phenomenon for certain functional events.
</section>

<section>
<h3 id="user-agent-bootup">User Agent Boot up</h3>

A user agent has an associated <dfn export id="dfn-service-worker-manager">service worker manager</dfn>.

A user agent *must* [=start a new parallel queue=] when it boots up and set the [=service worker manager=] to the result value.
</section>

<section>
<h3 id="user-agent-shutdown">User Agent Shutdown</h3>

Expand Down Expand Up @@ -2143,15 +2151,15 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
: Output
:: none

1. Assert: |jobQueue| [=queue/is not empty=].
1. [=Queue a task=] to run these steps:
1. [=Enqueue the following steps=] to the [=service worker manager=]:
1. Assert: |jobQueue| [=queue/is not empty=].
1. Let |job| be the first [=queue/item=] in |jobQueue|.
1. If |job|'s [=job type=] is *register*, run [=Register=] with |job| [=in parallel=].
1. Else if |job|'s [=job type=] is *update*, run [=Update=] with |job| [=in parallel=].
1. If |job|'s [=job type=] is *register*, run [=Register=] with |job|.
1. Else if |job|'s [=job type=] is *update*, run [=Update=] with |job|.

Note: For a register job and an update job, the user agent delays queuing a task for running the job until after a {{Document/DOMContentLoaded}} event has been dispatched to the document that initiated the job.

1. Else if |job|'s [=job type=] is *unregister*, run [=Unregister=] with |job| [=in parallel=].
1. Else if |job|'s [=job type=] is *unregister*, run [=Unregister=] with |job|.
</section>

<section algorithm>
Expand Down

0 comments on commit b378b22

Please sign in to comment.