Skip to content

Commit

Permalink
[e] (0) Vaguely clarify event loop mechanics for web workers.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@3222 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jun 11, 2009
1 parent bd33998 commit 79cb339
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 29 deletions.
25 changes: 14 additions & 11 deletions index
Expand Up @@ -47626,17 +47626,7 @@ interface <dfn id=window>Window</dfn> {
manipulation, e.g. when that element is <a href=#insert-an-element-into-a-document title="insert an
element into a document">inserted into the document</a>.</p>

</dl><p>Each <a href=#concept-task title=concept-task>task</a> is associated with a
<code>Document</code>; if the task was queued in the context of an
element, then it is the element's <code>Document</code>; if the task
was queued in the context of a <a href=#browsing-context>browsing context</a>, then
it is the <a href=#browsing-context>browsing context</a>'s <a href=#active-document>active
document</a> at the time the task was queued; if the task was
queued by or for a <a href=#concept-script title=concept-script>script</a> then
the document is the <a href="#script's-browsing-context">script's browsing context</a>'s
<a href=#active-document>active document</a> at the time the task was queued.</p>

<p>When a user agent is to <dfn id=queue-a-task>queue a task</dfn>, it must add the
</dl><p>When a user agent is to <dfn id=queue-a-task>queue a task</dfn>, it must add the
given task to one of the <a href=#task-queue title="task queue">task queues</a>
of the relevant <a href=#event-loop>event loop</a>. All the tasks from one
particular <dfn id=task-source>task source</dfn> (e.g. the callbacks generated by
Expand All @@ -47654,6 +47644,17 @@ interface <dfn id=window>Window</dfn> {
processing events from any one <a href=#task-source>task source</a> out of
order.</p>

<p>Each <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a task">queued</a> onto a <a href=#task-queue>task queue</a> of
an <a href=#event-loop>event loop</a> defined by this specification is
associated with a <code>Document</code>; if the task was queued in
the context of an element, then it is the element's
<code>Document</code>; if the task was queued in the context of a
<a href=#browsing-context>browsing context</a>, then it is the <a href=#browsing-context>browsing
context</a>'s <a href=#active-document>active document</a> at the time the task
was queued; if the task was queued by or for a <a href=#concept-script title=concept-script>script</a> then the document is the
<a href="#script's-browsing-context">script's browsing context</a>'s <a href=#active-document>active
document</a> at the time the task was queued.</p>

<p>A user agent is required to have one <dfn id=storage-mutex>storage
mutex</dfn>. This mutex is used to control access to shared state
like cookies. At any one point, the <a href=#storage-mutex>storage mutex</a> is
Expand All @@ -47665,6 +47666,8 @@ interface <dfn id=window>Window</dfn> {
a <a href=#concept-script title=concept-script>script</a>, the user agent must
release the <a href=#storage-mutex>storage mutex</a>.</p>

<p class=note>Other specifications can define other <a href=#event-loop title="event loop">event loops</a>; in particular, the Web
Workers specification does so.</p>


<h5 id=processing-model-2><span class=secno>6.5.4.2 </span>Processing model</h5>
Expand Down
45 changes: 27 additions & 18 deletions source
Expand Up @@ -54270,16 +54270,6 @@ interface <dfn>Window</dfn> {

</dl>

<p>Each <span title="concept-task">task</span> is associated with a
<code>Document</code>; if the task was queued in the context of an
element, then it is the element's <code>Document</code>; if the task
was queued in the context of a <span>browsing context</span>, then
it is the <span>browsing context</span>'s <span>active
document</span> at the time the task was queued; if the task was
queued by or for a <span title="concept-script">script</span> then
the document is the <span>script's browsing context</span>'s
<span>active document</span> at the time the task was queued.</p>

<p>When a user agent is to <dfn>queue a task</dfn>, it must add the
given task to one of the <span title="task queue">task queues</span>
of the relevant <span>event loop</span>. All the tasks from one
Expand All @@ -54299,6 +54289,19 @@ interface <dfn>Window</dfn> {
processing events from any one <span>task source</span> out of
order.</p>

<p>Each <span title="concept-task">task</span> that is <span
title="queue a task">queued</span> onto a <span>task queue</span> of
an <span>event loop</span> defined by this specification is
associated with a <code>Document</code>; if the task was queued in
the context of an element, then it is the element's
<code>Document</code>; if the task was queued in the context of a
<span>browsing context</span>, then it is the <span>browsing
context</span>'s <span>active document</span> at the time the task
was queued; if the task was queued by or for a <span
title="concept-script">script</span> then the document is the
<span>script's browsing context</span>'s <span>active
document</span> at the time the task was queued.</p>

<p>A user agent is required to have one <dfn>storage
mutex</dfn>. This mutex is used to control access to shared state
like cookies. At any one point, the <span>storage mutex</span> is
Expand All @@ -54310,6 +54313,9 @@ interface <dfn>Window</dfn> {
a <span title="concept-script">script</span>, the user agent must
release the <span>storage mutex</span>.</p>

<p class="note">Other specifications can define other <span
title="event loop">event loops</span>; in particular, the Web
Workers specification does so.</p>


<h5>Processing model</h5>
Expand Down Expand Up @@ -68066,16 +68072,19 @@ XXX Once we resolve the style="" issue, address these:

</ol>


<h4>The event loop</h4>

<p>Each <code>WorkerGlobalScope</code> object is asssociated with a
<span>event loop</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>
<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
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>

<p>Each <code>WorkerGlobalScope</code> object also has a <dfn
title="dom-WorkerGlobalScope-closing">closing</dfn> flag, which must
Expand Down

0 comments on commit 79cb339

Please sign in to comment.