Skip to content
Permalink
Browse files

[e] (0) Try to clarify event loop terminology.

Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=21632
Affected topics: HTML

git-svn-id: http://svn.whatwg.org/webapps@7874 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed May 30, 2013
1 parent e00922c commit d828ceae9bfaee65d65a7e88e7234dcb921f3b22
Showing with 62 additions and 38 deletions.
  1. +20 −13 complete.html
  2. +20 −13 index
  3. +22 −12 source
<dd><p>Some elements have tasks that trigger in response to DOM 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>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 timers, the events fired
for mouse movements, the tasks queued for the parser) must always be added to the same <a href=#task-queue>task
queue</a>, but tasks from different <a href=#task-source title="task source">task sources</a> may be placed
in different <a href=#task-queue title="task queue">task queues</a>.</p>
</dl><p>Each <a href=#concept-task title=concept-task>task</a> is associated with a <code><a href=#document>Document</a></code>; if the
task was queued in the context of an element, then it is the element's <code><a href=#document>Document</a></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-document">script's document</a>.</p>

<p>A <a href=#concept-task title=concept-task>task</a> is intended for a specific <a href=#event-loop>event loop</a>:
the <a href=#event-loop>event loop</a> that is handling <a href=#concept-task title=concept-task>tasks</a> for the <a href=#concept-task title=concept-task>task</a>'s associated <code><a href=#document>Document</a></code>.</p>

<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>.</p>

<p>Each <a href=#concept-task title=concept-task>task</a> is defined as coming from a specific <dfn id=task-source>task
source</dfn>. All the tasks from one particular <a href=#task-source>task source</a> and destined to a
particular <a href=#event-loop>event loop</a> (e.g. the callbacks generated by timers of a
<code><a href=#document>Document</a></code>, the events fired for mouse movements over that <code><a href=#document>Document</a></code>, the
tasks queued for the parser of that <code><a href=#document>Document</a></code>) must always be added to the same
<a href=#task-queue>task queue</a>, but <span concept-task="" title="title=">tasks</span> from different <a href=#task-source title="task source">task sources</a> may be placed in different <a href=#task-queue title="task queue">task
queues</a>.</p>

<p class=example>For example, a user agent could have one <a href=#task-queue>task queue</a> for mouse and
key events (the <a href=#user-interaction-task-source>user interaction task source</a>), and another for everything else. The
user agent could then give keyboard and mouse events preference over other tasks three quarters of
the time, keeping the interface responsive but not starving other task queues, and never
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><a href=#document>Document</a></code>; if the task was queued in the context of an element, then
it is the element's <code><a href=#document>Document</a></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-document">script's document</a>.</p>

<p>A user agent may have one <dfn id=storage-mutex>storage mutex</dfn>. This mutex is used to control access to
<hr><p>A user agent may 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 either free, or
owned by a particular <a href=#event-loop>event loop</a> or instance of the <a href=#fetch title=fetch>fetching</a> algorithm.</p>

33 index
<dd><p>Some elements have tasks that trigger in response to DOM 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>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 timers, the events fired
for mouse movements, the tasks queued for the parser) must always be added to the same <a href=#task-queue>task
queue</a>, but tasks from different <a href=#task-source title="task source">task sources</a> may be placed
in different <a href=#task-queue title="task queue">task queues</a>.</p>
</dl><p>Each <a href=#concept-task title=concept-task>task</a> is associated with a <code><a href=#document>Document</a></code>; if the
task was queued in the context of an element, then it is the element's <code><a href=#document>Document</a></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-document">script's document</a>.</p>

<p>A <a href=#concept-task title=concept-task>task</a> is intended for a specific <a href=#event-loop>event loop</a>:
the <a href=#event-loop>event loop</a> that is handling <a href=#concept-task title=concept-task>tasks</a> for the <a href=#concept-task title=concept-task>task</a>'s associated <code><a href=#document>Document</a></code>.</p>

<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>.</p>

<p>Each <a href=#concept-task title=concept-task>task</a> is defined as coming from a specific <dfn id=task-source>task
source</dfn>. All the tasks from one particular <a href=#task-source>task source</a> and destined to a
particular <a href=#event-loop>event loop</a> (e.g. the callbacks generated by timers of a
<code><a href=#document>Document</a></code>, the events fired for mouse movements over that <code><a href=#document>Document</a></code>, the
tasks queued for the parser of that <code><a href=#document>Document</a></code>) must always be added to the same
<a href=#task-queue>task queue</a>, but <span concept-task="" title="title=">tasks</span> from different <a href=#task-source title="task source">task sources</a> may be placed in different <a href=#task-queue title="task queue">task
queues</a>.</p>

<p class=example>For example, a user agent could have one <a href=#task-queue>task queue</a> for mouse and
key events (the <a href=#user-interaction-task-source>user interaction task source</a>), and another for everything else. The
user agent could then give keyboard and mouse events preference over other tasks three quarters of
the time, keeping the interface responsive but not starving other task queues, and never
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><a href=#document>Document</a></code>; if the task was queued in the context of an element, then
it is the element's <code><a href=#document>Document</a></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-document">script's document</a>.</p>

<p>A user agent may have one <dfn id=storage-mutex>storage mutex</dfn>. This mutex is used to control access to
<hr><p>A user agent may 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 either free, or
owned by a particular <a href=#event-loop>event loop</a> or instance of the <a href=#fetch title=fetch>fetching</a> algorithm.</p>

34 source

</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 document</span>.</p>

<p>A <span title="concept-task">task</span> is intended for a specific <span>event loop</span>:
the <span>event loop</span> that is handling <span title="concept-task">tasks</span> for the <span
title="concept-task">task</span>'s associated <code>Document</code>.</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 particular <dfn>task source</dfn> (e.g. the callbacks generated by timers, the events fired
for mouse movements, the tasks queued for the parser) must always be added to the same <span>task
queue</span>, but tasks from different <span title="task source">task sources</span> may be placed
in different <span title="task queue">task queues</span>.</p>
title="task queue">task queues</span> of the relevant <span>event loop</span>.</p>

<p>Each <span title="concept-task">task</span> is defined as coming from a specific <dfn>task
source</dfn>. All the tasks from one particular <span>task source</span> and destined to a
particular <span>event loop</span> (e.g. the callbacks generated by timers of a
<code>Document</code>, the events fired for mouse movements over that <code>Document</code>, the
tasks queued for the parser of that <code>Document</code>) must always be added to the same
<span>task queue</span>, but <span title="title="concept-task">tasks</span> from different <span
title="task source">task sources</span> may be placed in different <span title="task queue">task
queues</span>.</p>

<p class="example">For example, a user agent could have one <span>task queue</span> for mouse and
key events (the <span>user interaction task source</span>), and another for everything else. The
user agent could then give keyboard and mouse events preference over other tasks three quarters of
the time, keeping the interface responsive but not starving other task queues, and never
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 document</span>.</p>
<hr>

<p>A user agent may 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 either free, or

0 comments on commit d828cea

Please sign in to comment.
You can’t perform that action at this time.