[html5] r7696 - [e] (0) Integrate the 'event loop' mechanism of workers and windows together, an [...]

whatwg at whatwg.org whatwg at whatwg.org
Tue Feb 5 16:24:04 PST 2013


Author: ianh
Date: 2013-02-05 16:24:02 -0800 (Tue, 05 Feb 2013)
New Revision: 7696

Modified:
   complete.html
   index
   source
Log:
[e] (0) Integrate the 'event loop' mechanism of workers and windows together, and try to specify which is meant when it might be ambiguous.
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=20041

Modified: complete.html
===================================================================
--- complete.html	2013-02-05 22:23:45 UTC (rev 7695)
+++ complete.html	2013-02-06 00:24:02 UTC (rev 7696)
@@ -248,7 +248,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
    <hgroup><h1 class=allcaps>HTML</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 5 February 2013</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 6 February 2013</h2>
    </hgroup><dl><dt><strong>Web developer edition:</strong></dt>
     <dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
     <dt>Multiple-page version:</dt>
@@ -71862,13 +71862,24 @@
    <li><p>If a task was run in the first step above, remove that task from its <a href=#task-queue>task
    queue</a>.</li>
 
-   <li><p><a href=#perform-a-microtask-checkpoint>Perform a microtask checkpoint</a>.</li>
+   <li>
 
-   <li><p><a href=#provide-a-stable-state>Provide a stable state</a>.</li>
+    <p>If this <a href=#event-loop>event loop</a> is not a worker's <a href=#event-loop>event loop</a>, run these
+    substeps:</p>
 
-   <li><p>If necessary, update the rendering or user interface of any <code><a href=#document>Document</a></code> or
-   <a href=#browsing-context>browsing context</a> to reflect the current state.</li>
+    <ol><li><p><a href=#perform-a-microtask-checkpoint>Perform a microtask checkpoint</a>.</li>
 
+     <li><p><a href=#provide-a-stable-state>Provide a stable state</a>.</li>
+
+     <li><p>If necessary, update the rendering or user interface of any <code><a href=#document>Document</a></code> or
+     <a href=#browsing-context>browsing context</a> to reflect the current state.</li>
+
+    </ol></li>
+
+   <li><p>Otherwise, if this <a href=#event-loop>event loop</a> is running for a
+   <code><a href=#workerglobalscope>WorkerGlobalScope</a></code>, but there are no events in the <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task queues</a> and the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is true, then destroy the <a href=#event-loop>event
+   loop</a>, aborting these steps.</li>
+
    <li><p>Return to the first step of the <a href=#event-loop>event loop</a>.</li>
 
   </ol><hr><p>When a user agent is to <dfn id=perform-a-microtask-checkpoint>perform a microtask checkpoint</dfn>, if the <a href=#running-mutation-observers>running
@@ -79881,9 +79892,10 @@
   (atomically):</p>
 
   <ol><li><p>Discard any <a href=#concept-task title=concept-task>tasks</a> that have been added to the
-   <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task queues</a>.</p>
+   <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task
+   queues</a>.</p>
 
-<!-- v2-onclose
+<!-- v2-onclose (remember to specify the task source, too)
    <li><p><span>Queue a task</span> to <span>fire a simple event</span> named <code
    title="event-worker-close">close</code> at the <code>WorkerGlobalScope</code> object.</p></li>
 -->
@@ -80002,13 +80014,11 @@
 
   <h4 id=the-event-loop><span class=secno>9.2.2 </span>The event loop</h4>
 
-  <p>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object has an <a href=#event-loop>event loop</a> distinct from those
-  defined for <a href=#unit-of-related-similar-origin-browsing-contexts title="unit of related similar-origin browsing contexts">units of related
+  <p>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object has a distinct <a href=#event-loop>event loop</a>, separate
+  from those used by <a href=#unit-of-related-similar-origin-browsing-contexts title="unit of related similar-origin browsing contexts">units of related
   similar-origin browsing contexts</a>. This <a href=#event-loop>event loop</a> has no associated
   <a href=#browsing-context>browsing context</a>, and its <a href=#task-queue title="task queue">task queues</a> only have
-  events, callbacks, and networking activity as <a href=#concept-task title=concept-task>tasks</a>. The
-  processing model of these <a href=#event-loop title="event loop">event loops</a> is defined below in the
-  <a href=#run-a-worker>run a worker</a> algorithm.</p>
+  events, callbacks, and networking activity as <a href=#concept-task title=concept-task>tasks</a>. These <a href=#event-loop title="event loop">event loops</a> are created by the <a href=#run-a-worker>run a worker</a> algorithm.</p>
 
   <p>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object also has a <dfn id=dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</dfn> flag, which must initially be false, but which
   can get set to true by the algorithms in the processing model section below.</p>
@@ -80030,11 +80040,10 @@
   <dfn id="the-worker's-ports">the worker's ports</dfn>, which consists of all the <code><a href=#messageport>MessagePort</a></code> objects that are
   entangled with another port and that have one (but only one) port owned by <var title="">worker
   global scope</var>. This list includes <!--all the <code>MessagePort</code> objects that are in
-  events pending in the <span>event loop</span>, as well as (commented out because in practice it
-  makes no difference either way as far as I can tell, and it would be hard to strictly implement
-  since these ports might not yet be across the thread boundary)--> the implicit
-  <code><a href=#messageport>MessagePort</a></code> in the case of <a href=#dedicatedworkerglobalscope title=DedicatedWorkerGlobalScope>dedicated
-  workers</a>.</p>
+  events pending in the <code>WorkerGlobalScope</code> object's <span>event loop</span>, as well as
+  (commented out because in practice it makes no difference either way as far as I can tell, and it
+  would be hard to strictly implement since these ports might not yet be across the thread
+  boundary)--> the implicit <code><a href=#messageport>MessagePort</a></code> in the case of <a href=#dedicatedworkerglobalscope title=DedicatedWorkerGlobalScope>dedicated workers</a>.</p>
 
   <p>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> also has a list of <dfn id="the-worker's-workers">the worker's workers</dfn>.
   Initially this list is empty; it is populated when the worker creates or obtains further
@@ -80190,9 +80199,9 @@
 <!-- v2-onclose
     <p class="note">If the script gets aborted by the "<span>kill a worker</span>" algorithm, then
     that same algorithm will cause there to only be a single <span title="concept-task">task</span>
-    in the <span>event loop</span> at the next step, namely the task for the <code
-    title="message-close">close</code> event. The "<span>terminate a worker</span>" algorithm
-    removes all the events.</p>
+    in the <code>WorkerGlobalScope</code> object's <span>event loop</span> at the next step, namely
+    the task for the <code title="message-close">close</code> event. The "<span>terminate a
+    worker</span>" algorithm removes all the events.</p>
 -->
 
    </li>
@@ -80203,45 +80212,21 @@
 
    <li>
 
-    <p><i title="">Event loop</i>: Wait until either there is a <a href=#concept-task title=concept-task>task</a> in one of the <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task
-    queue">task queues</a> or <var title="">worker global scope</var>'s <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is set to true.</p>
+    <p><i title="">Event loop</i>: Create a new <a href=#event-loop>event loop</a>, and run it until it is
+    destroyed.</p>
 
-   </li>
-
-   <li>
-
-    <p>Run the oldest task on one of the <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task
-    queues</a>, if any. The user agent may pick any <a href=#task-queue>task queue</a>.</p>
-
-    <p class=note>The handling of events or the execution of callbacks might get prematurely
+    <p class=note>The handling of events or the execution of callbacks by <a href=#concept-task title=concept-task>tasks</a> run by the <a href=#event-loop>event loop</a> might get prematurely
     aborted by the "<a href=#kill-a-worker>kill a worker</a>" or "<a href=#terminate-a-worker>terminate a worker</a>" algorithms
     defined below.</p>
 
-   </li>
+    <p class=note>The worker processing model remains on this step until the event loop is
+    destroyed, which happens after the <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a>
+    flag is set to true, as described in the <a href=#event-loop>event loop</a> processing model.</p>
 
-   <li>
-
-    <p>If the <a href=#storage-mutex>storage mutex</a> is now owned by the worker's <a href=#event-loop>event loop</a>,
-    release it so that it is once again free.</p>
-
    </li>
 
    <li>
 
-    <p>Remove the task just run in the earlier step, if any, from its <a href=#task-queue>task queue</a>.</p>
-
-   </li>
-
-   <li>
-
-    <p>If there are any more events in the <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task
-    queues</a> or if <var title="">worker global scope</var>'s <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is set to false, then jump back to the
-    step above labeled <i><a href=#event-loop>event loop</a></i>.</p>
-
-   </li>
-
-   <li>
-
     <p>Empty the <var title="">worker global scope</var>'s <a href=#list-of-active-timers>list of active timers</a>.</p>
 
    </li>
@@ -80279,7 +80264,7 @@
    shutting down unexpectedly.</p></li>
 -->
 
-   <li><p>If there are any <a href=#concept-task title=concept-task>tasks</a> queued in the <a href=#event-loop>event
+   <li><p>If there are any <a href=#concept-task title=concept-task>tasks</a> queued in the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#event-loop>event <!--CLEANUP-->
    loop</a>'s <a href=#task-queue title="task queue">task queues</a><!-- v2-onclose other than the <code
    title="event-worker-close">close</code> event that this algorithm just added-->, discard them
    without processing them.</li>
@@ -80306,7 +80291,7 @@
 
   <ol><li><p>Set the worker's <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag to true.</li>
 
-   <li><p>If there are any <a href=#concept-task title=concept-task>tasks</a> queued in the <a href=#event-loop>event
+   <li><p>If there are any <a href=#concept-task title=concept-task>tasks</a> queued in the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#event-loop>event <!--CLEANUP-->
    loop</a>'s <a href=#task-queue title="task queue">task queues</a>, discard them without processing
    them.</li>
 

Modified: index
===================================================================
--- index	2013-02-05 22:23:45 UTC (rev 7695)
+++ index	2013-02-06 00:24:02 UTC (rev 7696)
@@ -248,7 +248,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
    <hgroup><h1 class=allcaps>HTML</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 5 February 2013</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 6 February 2013</h2>
    </hgroup><dl><dt><strong>Web developer edition:</strong></dt>
     <dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
     <dt>Multiple-page version:</dt>
@@ -71862,13 +71862,24 @@
    <li><p>If a task was run in the first step above, remove that task from its <a href=#task-queue>task
    queue</a>.</li>
 
-   <li><p><a href=#perform-a-microtask-checkpoint>Perform a microtask checkpoint</a>.</li>
+   <li>
 
-   <li><p><a href=#provide-a-stable-state>Provide a stable state</a>.</li>
+    <p>If this <a href=#event-loop>event loop</a> is not a worker's <a href=#event-loop>event loop</a>, run these
+    substeps:</p>
 
-   <li><p>If necessary, update the rendering or user interface of any <code><a href=#document>Document</a></code> or
-   <a href=#browsing-context>browsing context</a> to reflect the current state.</li>
+    <ol><li><p><a href=#perform-a-microtask-checkpoint>Perform a microtask checkpoint</a>.</li>
 
+     <li><p><a href=#provide-a-stable-state>Provide a stable state</a>.</li>
+
+     <li><p>If necessary, update the rendering or user interface of any <code><a href=#document>Document</a></code> or
+     <a href=#browsing-context>browsing context</a> to reflect the current state.</li>
+
+    </ol></li>
+
+   <li><p>Otherwise, if this <a href=#event-loop>event loop</a> is running for a
+   <code><a href=#workerglobalscope>WorkerGlobalScope</a></code>, but there are no events in the <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task queues</a> and the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is true, then destroy the <a href=#event-loop>event
+   loop</a>, aborting these steps.</li>
+
    <li><p>Return to the first step of the <a href=#event-loop>event loop</a>.</li>
 
   </ol><hr><p>When a user agent is to <dfn id=perform-a-microtask-checkpoint>perform a microtask checkpoint</dfn>, if the <a href=#running-mutation-observers>running
@@ -79881,9 +79892,10 @@
   (atomically):</p>
 
   <ol><li><p>Discard any <a href=#concept-task title=concept-task>tasks</a> that have been added to the
-   <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task queues</a>.</p>
+   <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task
+   queues</a>.</p>
 
-<!-- v2-onclose
+<!-- v2-onclose (remember to specify the task source, too)
    <li><p><span>Queue a task</span> to <span>fire a simple event</span> named <code
    title="event-worker-close">close</code> at the <code>WorkerGlobalScope</code> object.</p></li>
 -->
@@ -80002,13 +80014,11 @@
 
   <h4 id=the-event-loop><span class=secno>9.2.2 </span>The event loop</h4>
 
-  <p>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object has an <a href=#event-loop>event loop</a> distinct from those
-  defined for <a href=#unit-of-related-similar-origin-browsing-contexts title="unit of related similar-origin browsing contexts">units of related
+  <p>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object has a distinct <a href=#event-loop>event loop</a>, separate
+  from those used by <a href=#unit-of-related-similar-origin-browsing-contexts title="unit of related similar-origin browsing contexts">units of related
   similar-origin browsing contexts</a>. This <a href=#event-loop>event loop</a> has no associated
   <a href=#browsing-context>browsing context</a>, and its <a href=#task-queue title="task queue">task queues</a> only have
-  events, callbacks, and networking activity as <a href=#concept-task title=concept-task>tasks</a>. The
-  processing model of these <a href=#event-loop title="event loop">event loops</a> is defined below in the
-  <a href=#run-a-worker>run a worker</a> algorithm.</p>
+  events, callbacks, and networking activity as <a href=#concept-task title=concept-task>tasks</a>. These <a href=#event-loop title="event loop">event loops</a> are created by the <a href=#run-a-worker>run a worker</a> algorithm.</p>
 
   <p>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object also has a <dfn id=dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</dfn> flag, which must initially be false, but which
   can get set to true by the algorithms in the processing model section below.</p>
@@ -80030,11 +80040,10 @@
   <dfn id="the-worker's-ports">the worker's ports</dfn>, which consists of all the <code><a href=#messageport>MessagePort</a></code> objects that are
   entangled with another port and that have one (but only one) port owned by <var title="">worker
   global scope</var>. This list includes <!--all the <code>MessagePort</code> objects that are in
-  events pending in the <span>event loop</span>, as well as (commented out because in practice it
-  makes no difference either way as far as I can tell, and it would be hard to strictly implement
-  since these ports might not yet be across the thread boundary)--> the implicit
-  <code><a href=#messageport>MessagePort</a></code> in the case of <a href=#dedicatedworkerglobalscope title=DedicatedWorkerGlobalScope>dedicated
-  workers</a>.</p>
+  events pending in the <code>WorkerGlobalScope</code> object's <span>event loop</span>, as well as
+  (commented out because in practice it makes no difference either way as far as I can tell, and it
+  would be hard to strictly implement since these ports might not yet be across the thread
+  boundary)--> the implicit <code><a href=#messageport>MessagePort</a></code> in the case of <a href=#dedicatedworkerglobalscope title=DedicatedWorkerGlobalScope>dedicated workers</a>.</p>
 
   <p>Each <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> also has a list of <dfn id="the-worker's-workers">the worker's workers</dfn>.
   Initially this list is empty; it is populated when the worker creates or obtains further
@@ -80190,9 +80199,9 @@
 <!-- v2-onclose
     <p class="note">If the script gets aborted by the "<span>kill a worker</span>" algorithm, then
     that same algorithm will cause there to only be a single <span title="concept-task">task</span>
-    in the <span>event loop</span> at the next step, namely the task for the <code
-    title="message-close">close</code> event. The "<span>terminate a worker</span>" algorithm
-    removes all the events.</p>
+    in the <code>WorkerGlobalScope</code> object's <span>event loop</span> at the next step, namely
+    the task for the <code title="message-close">close</code> event. The "<span>terminate a
+    worker</span>" algorithm removes all the events.</p>
 -->
 
    </li>
@@ -80203,45 +80212,21 @@
 
    <li>
 
-    <p><i title="">Event loop</i>: Wait until either there is a <a href=#concept-task title=concept-task>task</a> in one of the <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task
-    queue">task queues</a> or <var title="">worker global scope</var>'s <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is set to true.</p>
+    <p><i title="">Event loop</i>: Create a new <a href=#event-loop>event loop</a>, and run it until it is
+    destroyed.</p>
 
-   </li>
-
-   <li>
-
-    <p>Run the oldest task on one of the <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task
-    queues</a>, if any. The user agent may pick any <a href=#task-queue>task queue</a>.</p>
-
-    <p class=note>The handling of events or the execution of callbacks might get prematurely
+    <p class=note>The handling of events or the execution of callbacks by <a href=#concept-task title=concept-task>tasks</a> run by the <a href=#event-loop>event loop</a> might get prematurely
     aborted by the "<a href=#kill-a-worker>kill a worker</a>" or "<a href=#terminate-a-worker>terminate a worker</a>" algorithms
     defined below.</p>
 
-   </li>
+    <p class=note>The worker processing model remains on this step until the event loop is
+    destroyed, which happens after the <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a>
+    flag is set to true, as described in the <a href=#event-loop>event loop</a> processing model.</p>
 
-   <li>
-
-    <p>If the <a href=#storage-mutex>storage mutex</a> is now owned by the worker's <a href=#event-loop>event loop</a>,
-    release it so that it is once again free.</p>
-
    </li>
 
    <li>
 
-    <p>Remove the task just run in the earlier step, if any, from its <a href=#task-queue>task queue</a>.</p>
-
-   </li>
-
-   <li>
-
-    <p>If there are any more events in the <a href=#event-loop>event loop</a>'s <a href=#task-queue title="task queue">task
-    queues</a> or if <var title="">worker global scope</var>'s <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is set to false, then jump back to the
-    step above labeled <i><a href=#event-loop>event loop</a></i>.</p>
-
-   </li>
-
-   <li>
-
     <p>Empty the <var title="">worker global scope</var>'s <a href=#list-of-active-timers>list of active timers</a>.</p>
 
    </li>
@@ -80279,7 +80264,7 @@
    shutting down unexpectedly.</p></li>
 -->
 
-   <li><p>If there are any <a href=#concept-task title=concept-task>tasks</a> queued in the <a href=#event-loop>event
+   <li><p>If there are any <a href=#concept-task title=concept-task>tasks</a> queued in the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#event-loop>event <!--CLEANUP-->
    loop</a>'s <a href=#task-queue title="task queue">task queues</a><!-- v2-onclose other than the <code
    title="event-worker-close">close</code> event that this algorithm just added-->, discard them
    without processing them.</li>
@@ -80306,7 +80291,7 @@
 
   <ol><li><p>Set the worker's <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag to true.</li>
 
-   <li><p>If there are any <a href=#concept-task title=concept-task>tasks</a> queued in the <a href=#event-loop>event
+   <li><p>If there are any <a href=#concept-task title=concept-task>tasks</a> queued in the <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#event-loop>event <!--CLEANUP-->
    loop</a>'s <a href=#task-queue title="task queue">task queues</a>, discard them without processing
    them.</li>
 

Modified: source
===================================================================
--- source	2013-02-05 22:23:45 UTC (rev 7695)
+++ source	2013-02-06 00:24:02 UTC (rev 7696)
@@ -84031,13 +84031,30 @@
    <li><p>If a task was run in the first step above, remove that task from its <span>task
    queue</span>.</p></li>
 
-   <li><p><span>Perform a microtask checkpoint</span>.</p></li>
+   <li>
 
-   <li><p><span>Provide a stable state</span>.</p></li>
+    <p>If this <span>event loop</span> is not a worker's <span>event loop</span>, run these
+    substeps:</p>
 
-   <li><p>If necessary, update the rendering or user interface of any <code>Document</code> or
-   <span>browsing context</span> to reflect the current state.</p></li>
+    <ol>
 
+     <li><p><span>Perform a microtask checkpoint</span>.</p></li>
+
+     <li><p><span>Provide a stable state</span>.</p></li>
+
+     <li><p>If necessary, update the rendering or user interface of any <code>Document</code> or
+     <span>browsing context</span> to reflect the current state.</p></li>
+
+    </ol>
+
+   </li>
+
+   <li><p>Otherwise, if this <span>event loop</span> is running for a
+   <code>WorkerGlobalScope</code>, but there are no events in the <span>event loop</span>'s <span
+   title="task queue">task queues</span> and the <code>WorkerGlobalScope</code> object's <span
+   title="dom-WorkerGlobalScope-closing">closing</span> flag is true, then destroy the <span>event
+   loop</span>, aborting these steps.</p></li>
+
    <li><p>Return to the first step of the <span>event loop</span>.</p></li>
 
   </ol>
@@ -92623,9 +92640,10 @@
   <ol>
 
    <li><p>Discard any <span title="concept-task">tasks</span> that have been added to the
-   <span>event loop</span>'s <span title="task queue">task queues</span>.</p>
+   <code>WorkerGlobalScope</code> object's <span>event loop</span>'s <span title="task queue">task
+   queues</span>.</p>
 
-<!-- v2-onclose
+<!-- v2-onclose (remember to specify the task source, too)
    <li><p><span>Queue a task</span> to <span>fire a simple event</span> named <code
    title="event-worker-close">close</code> at the <code>WorkerGlobalScope</code> object.</p></li>
 -->
@@ -92771,13 +92789,12 @@
 
   <h4>The event loop</h4>
 
-  <p>Each <code>WorkerGlobalScope</code> object has an <span>event loop</span> distinct from those
-  defined for <span title="unit of related similar-origin browsing contexts">units of related
+  <p>Each <code>WorkerGlobalScope</code> object has a distinct <span>event loop</span>, separate
+  from those used by <span title="unit of related similar-origin browsing contexts">units of related
   similar-origin browsing contexts</span>. This <span>event loop</span> has no associated
   <span>browsing context</span>, and its <span title="task queue">task queues</span> only have
-  events, callbacks, and networking activity as <span title="concept-task">tasks</span>. The
-  processing model of these <span title="event loop">event loops</span> is defined below in the
-  <span>run a worker</span> algorithm.</p>
+  events, callbacks, and networking activity as <span title="concept-task">tasks</span>. These <span
+  title="event loop">event loops</span> are created by the <span>run a worker</span> algorithm.</p>
 
   <p>Each <code>WorkerGlobalScope</code> object also has a <dfn
   title="dom-WorkerGlobalScope-closing">closing</dfn> flag, which must initially be false, but which
@@ -92803,11 +92820,11 @@
   <dfn>the worker's ports</dfn>, which consists of all the <code>MessagePort</code> objects that are
   entangled with another port and that have one (but only one) port owned by <var title="">worker
   global scope</var>. This list includes <!--all the <code>MessagePort</code> objects that are in
-  events pending in the <span>event loop</span>, as well as (commented out because in practice it
-  makes no difference either way as far as I can tell, and it would be hard to strictly implement
-  since these ports might not yet be across the thread boundary)--> the implicit
-  <code>MessagePort</code> in the case of <span title="DedicatedWorkerGlobalScope">dedicated
-  workers</span>.</p>
+  events pending in the <code>WorkerGlobalScope</code> object's <span>event loop</span>, as well as
+  (commented out because in practice it makes no difference either way as far as I can tell, and it
+  would be hard to strictly implement since these ports might not yet be across the thread
+  boundary)--> the implicit <code>MessagePort</code> in the case of <span
+  title="DedicatedWorkerGlobalScope">dedicated workers</span>.</p>
 
   <p>Each <code>WorkerGlobalScope</code> also has a list of <dfn>the worker's workers</dfn>.
   Initially this list is empty; it is populated when the worker creates or obtains further
@@ -92979,9 +92996,9 @@
 <!-- v2-onclose
     <p class="note">If the script gets aborted by the "<span>kill a worker</span>" algorithm, then
     that same algorithm will cause there to only be a single <span title="concept-task">task</span>
-    in the <span>event loop</span> at the next step, namely the task for the <code
-    title="message-close">close</code> event. The "<span>terminate a worker</span>" algorithm
-    removes all the events.</p>
+    in the <code>WorkerGlobalScope</code> object's <span>event loop</span> at the next step, namely
+    the task for the <code title="message-close">close</code> event. The "<span>terminate a
+    worker</span>" algorithm removes all the events.</p>
 -->
 
    </li>
@@ -92992,48 +93009,22 @@
 
    <li>
 
-    <p><i title="">Event loop</i>: Wait until either there is a <span
-    title="concept-task">task</span> in one of the <span>event loop</span>'s <span title="task
-    queue">task queues</span> or <var title="">worker global scope</var>'s <span
-    title="dom-WorkerGlobalScope-closing">closing</span> flag is set to true.</p>
+    <p><i title="">Event loop</i>: Create a new <span>event loop</span>, and run it until it is
+    destroyed.</p>
 
-   </li>
-
-   <li>
-
-    <p>Run the oldest task on one of the <span>event loop</span>'s <span title="task queue">task
-    queues</span>, if any. The user agent may pick any <span>task queue</span>.</p>
-
-    <p class="note">The handling of events or the execution of callbacks might get prematurely
+    <p class="note">The handling of events or the execution of callbacks by <span
+    title="concept-task">tasks</span> run by the <span>event loop</span> might get prematurely
     aborted by the "<span>kill a worker</span>" or "<span>terminate a worker</span>" algorithms
     defined below.</p>
 
-   </li>
+    <p class="note">The worker processing model remains on this step until the event loop is
+    destroyed, which happens after the <span title="dom-WorkerGlobalScope-closing">closing</span>
+    flag is set to true, as described in the <span>event loop</span> processing model.</p>
 
-   <li>
-
-    <p>If the <span>storage mutex</span> is now owned by the worker's <span>event loop</span>,
-    release it so that it is once again free.</p>
-
    </li>
 
    <li>
 
-    <p>Remove the task just run in the earlier step, if any, from its <span>task queue</span>.</p>
-
-   </li>
-
-   <li>
-
-    <p>If there are any more events in the <span>event loop</span>'s <span title="task queue">task
-    queues</span> or if <var title="">worker global scope</var>'s <span
-    title="dom-WorkerGlobalScope-closing">closing</span> flag is set to false, then jump back to the
-    step above labeled <i>event loop</i>.</p>
-
-   </li>
-
-   <li>
-
     <p>Empty the <var title="">worker global scope</var>'s <span>list of active timers</span>.</p>
 
    </li>
@@ -93080,7 +93071,7 @@
    shutting down unexpectedly.</p></li>
 -->
 
-   <li><p>If there are any <span title="concept-task">tasks</span> queued in the <span>event
+   <li><p>If there are any <span title="concept-task">tasks</span> queued in the <code>WorkerGlobalScope</code> object's <span>event <!--CLEANUP-->
    loop</span>'s <span title="task queue">task queues</span><!-- v2-onclose other than the <code
    title="event-worker-close">close</code> event that this algorithm just added-->, discard them
    without processing them.</p></li>
@@ -93114,7 +93105,7 @@
    <li><p>Set the worker's <code>WorkerGlobalScope</code> object's <span
    title="dom-WorkerGlobalScope-closing">closing</span> flag to true.</p></li>
 
-   <li><p>If there are any <span title="concept-task">tasks</span> queued in the <span>event
+   <li><p>If there are any <span title="concept-task">tasks</span> queued in the <code>WorkerGlobalScope</code> object's <span>event <!--CLEANUP-->
    loop</span>'s <span title="task queue">task queues</span>, discard them without processing
    them.</p></li>
 




More information about the Commit-Watchers mailing list