html5/workers Overview.html,1.3,1.4

Update of /sources/public/html5/workers
In directory hutz:/tmp/cvs-serv24048

Modified Files:
	Overview.html 
Log Message:
First draft of the 'inside workers' section. (whatwg r5)

Index: Overview.html
===================================================================
RCS file: /sources/public/html5/workers/Overview.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Overview.html	10 Jul 2008 01:10:39 -0000	1.3
+++ Overview.html	16 Jul 2008 01:39:59 -0000	1.4
@@ -19,7 +19,7 @@
     specification for HTML5</h2>
 
    <h2 class="no-num no-toc" id=editors><!-- "W3C Working Draft" --> Editor's
-    Draft <!--ZZZ-->10 July 2008</h2>
+    Draft <!--ZZZ-->16 July 2008</h2>
 
    <dl><!-- ZZZ: update the month/day
     <dt>This Version:</dt>
@@ -144,7 +144,7 @@
 
   <p>The W3C <a href="http://www.w3.org/html/wg/">HTML Working Group</a> is
    the W3C working group responsible for this specification's progress along
-   the W3C Recommendation track. <!--ZZZ:--> This specification is the 10
+   the W3C Recommendation track. <!--ZZZ:--> This specification is the 16
    July 2008 <!--ZZZ "Working Draft"-->Editor's Draft. <!--:ZZZ--></p>
   <!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST -->
   <!-- relationship to other work (required) -->
@@ -181,31 +181,35 @@
   <ul class=toc>
    <li><a href="#introduction"><span class=secno>1. </span>Introduction</a>
     <ul class=toc>
-     <li><a href="#background"><span class=secno>1.1 </span>Background</a>
+     <li><a href="#tutorial"><span class=secno>1.1 </span>Tutorial</a>
 
      <li><a href="#requirements"><span class=secno>1.2
       </span>Requirements</a>
 
-     <li><a href="#relationships"><span class=secno>1.3 </span>Relationships
-      to other specifications</a>
-      <ul class=toc>
-       <li><a href="#relationship"><span class=secno>1.3.1
-        </span>Relationship to HTML5</a>
-
-       <li><a href="#relationship0"><span class=secno>1.3.2
-        </span>Relationship to ECMAScript</a>
-      </ul>
-
-     <li><a href="#conformance"><span class=secno>1.4 </span>Conformance
+     <li><a href="#conformance"><span class=secno>1.3 </span>Conformance
       requirements</a>
       <ul class=toc>
-       <li><a href="#dependencies"><span class=secno>1.4.1
+       <li><a href="#dependencies"><span class=secno>1.3.1
         </span>Dependencies</a>
       </ul>
 
-     <li><a href="#terminology"><span class=secno>1.5 </span>Terminology</a>
+     <li><a href="#terminology"><span class=secno>1.4 </span>Terminology</a>
     </ul>
 
+   <li><a href="#inside"><span class=secno>2. </span>Inside workers</a>
+    <ul class=toc>
+     <li><a href="#the-windowworker"><span class=secno>2.1 </span>The
+      <code>WindowWorker</code> interface</a>
+
+     <li><a href="#the-queue"><span class=secno>2.2 </span>The queue of
+      events</a>
+
+     <li><a href="#processing"><span class=secno>2.3 </span>Processing
+      model</a>
+    </ul>
+
+   <li><a href="#creating"><span class=secno>3. </span>Creating workers</a>
+
    <li class=no-num><a href="#references">References</a>
 
    <li class=no-num><a href="#acknowledgements">Acknowledgements</a>
@@ -216,10 +220,12 @@
 
   <h2 id=introduction><span class=secno>1. </span>Introduction</h2>
 
-  <h3 id=background><span class=secno>1.1 </span>Background</h3>
+  <h3 id=tutorial><span class=secno>1.1 </span>Tutorial</h3>
 
   <p><em>This section is non-normative.</em>
 
+  <p class=big-issue>This section is missing.
+
   <h3 id=requirements><span class=secno>1.2 </span>Requirements</h3>
 
   <p><em>This section is non-normative.</em>
@@ -270,19 +276,7 @@
     should be able to detect this is about to happen and exit gracefully.
   </ul>
 
-  <h3 id=relationships><span class=secno>1.3 </span>Relationships to other
-   specifications</h3>
-
-  <h4 id=relationship><span class=secno>1.3.1 </span>Relationship to HTML5</h4>
-
-  <p><em>This section is non-normative.</em>
-
-  <h4 id=relationship0><span class=secno>1.3.2 </span>Relationship to
-   ECMAScript</h4>
-
-  <p><em>This section is non-normative.</em>
-
-  <h3 id=conformance><span class=secno>1.4 </span>Conformance requirements</h3>
+  <h3 id=conformance><span class=secno>1.3 </span>Conformance requirements</h3>
 
   <p>All diagrams, examples, and notes in this specification are
    non-normative, as are all sections explicitly marked non-normative.
@@ -318,7 +312,7 @@
    against running out of memory, or to work around platform-specific
    limitations.
 
-  <h4 id=dependencies><span class=secno>1.4.1 </span>Dependencies</h4>
+  <h4 id=dependencies><span class=secno>1.3.1 </span>Dependencies</h4>
 
   <p>This specification relies on several other underlying specifications.
 
@@ -342,7 +336,7 @@
      specification. <a href="#refsWebIDL">[WebIDL]</a></p>
   </dl>
 
-  <h3 id=terminology><span class=secno>1.5 </span>Terminology</h3>
+  <h3 id=terminology><span class=secno>1.4 </span>Terminology</h3>
 
   <p>For simplicity, terms such as <em>shown</em>, <em>displayed</em>, and
    <em>visible</em> might sometimes be used when referring to the way a
@@ -350,9 +344,10 @@
    visual medium; they must be considered to apply to other media in
    equivalent ways.
 
-  <p>The construction "a <code>Foo</code> object", where <code>Foo</code> is
-   actually an interface, is sometimes used instead of the more accurate "an
-   object implementing the interface <code>Foo</code>".
+  <p>The construction "a <code title="">Foo</code> object", where <code
+   title="">Foo</code> is actually an interface, is sometimes used instead of
+   the more accurate "an object implementing the interface <code
+   title="">Foo</code>".
 
   <p>The term DOM is used to refer to the API set made available to scripts
    in Web applications, and does not necessarily imply the existence of an
@@ -370,6 +365,132 @@
    that object must operate on the actual underlying data, not a snapshot of
    the data.
 
+  <h2 id=inside><span class=secno>2. </span>Inside workers</h2>
+
+  <h3 id=the-windowworker><span class=secno>2.1 </span>The <code><a
+   href="#windowworker">WindowWorker</a></code> interface</h3>
+
+  <pre
+   class=idl>[NoInterfaceObject] interface <dfn id=windowworker>WindowWorker</dfn> {
+  readonly attribute boolean <a href="#closing" title=dom-windowworker-closing>closing</a>;
+};</pre>
+
+  <p>Objects that implement the <code><a
+   href="#windowworker">WindowWorker</a></code> interface must also implement
+   the <code>Window</code> interface (and thus also the
+   <code>WindowTimers</code> interface) and the <code>EventTarget</code>
+   interface.
+
+  <p>The <dfn id=closing
+   title=dom-windowworker-closing><code>closing</code></dfn> attribute must
+   return false until the "<a href="#kill-a">kill a worker</a>" processing
+   model defined below sets it to false.
+
+  <h3 id=the-queue><span class=secno>2.2 </span>The queue of events</h3>
+
+  <p>Each <code><a href="#windowworker">WindowWorker</a></code> object is
+   asssociated with a <dfn id=queue>queue of events</dfn>, which is initially
+   empty.
+
+  <p>An event in the queue can be a DOM event or a timeout callback.
+
+  <h3 id=processing><span class=secno>2.3 </span>Processing model</h3>
+
+  <p>When a user agent is to <dfn id=run-a>run a worker</dfn> for a script
+   <var title="">script</var> and a browsing context <var title="">owner
+   browsing context</var> and a <code>Document</code> <var title="">owner
+   document</var>, it must run the following steps in a completely separate
+   and parallel execution environment:
+
+  <ol>
+   <li>
+    <p>Create a new <code><a href="#windowworker">WindowWorker</a></code>
+     object, <var title="">window</var>.</p>
+
+   <li>
+    <p>Let <var title="">script</var>'s <span>script execution context</span>
+     (and thus also <span>global object</span>) be <var
+     title="">window</var>.</p>
+
+   <li>
+    <p>Let <var title="">script</var>'s <span>script browsing context</span>
+     be <var title="">owner browsing context</var>.</p>
+
+   <li>
+    <p>Let <var title="">script</var>'s <span>script document context</span>
+     be <var title="">owner document</var>.</p>
+
+   <li>
+    <p>Run <var title="">script</var> until it returns.</p>
+
+   <li>
+    <p><i>Event loop</i>: Wait until there is an event in the <a
+     href="#queue">queue of events</a> associated with <var
+     title="">window</var>.</p>
+
+   <li>
+    <p>Dispatch the oldest event or callback in the <a href="#queue">queue of
+     events</a>. Events must be targetted at the <code><a
+     href="#windowworker">WindowWorker</a></code> object.</p>
+
+   <li>
+    <p>If there are any more events in the <a href="#queue">queue of
+     events</a> or if the <var title="">window</var> object's <code
+     title=dom-windowworker-closing><a href="#closing">closing</a></code>
+     attribute is set to false, then jump back to the step above labeled
+     <i>event loop</i>.</p>
+
+   <li>
+    <p class=big-issue>timers, intervals, XMLHttpRequests, database
+     transactions, etc, must be killed; ports must be deactivated and
+     unentangled</p>
+  </ol>
+
+  <hr>
+
+  <p>When a user agent is to <dfn id=kill-a>kill a worker</dfn>, it must run
+   the following steps in parallel with the worker's main loop (the "<a
+   href="#run-a">run a worker</a>" processing model defined above):
+
+  <ol>
+   <li>
+    <p>Set the worker's <code><a href="#windowworker">WindowWorker</a></code>
+     object's <code title=dom-windowworker-closing><a
+     href="#closing">closing</a></code> attribute to true.
+
+   <li>
+    <p>Create an <code>Event</code> object with the event name <code
+     title=event-unload>unload</code>, which does not bubble and is not
+     cancelable, and add it to the worker's <code><a
+     href="#windowworker">WindowWorker</a></code> object's <a
+     href="#queue">queue of events</a>.
+
+   <li>
+    <p>Wait a user-agent-defined amount of time.
+
+   <li>
+    <p>If there are any events in the <a href="#queue">queue of events</a>
+     other than the <code title=event-unload>unload</code> event that this
+     algorithm just added, discard them without dispatching them.
+
+   <li>
+    <p>If the <code title=event-unload>unload</code> event that this
+     algorithm just added hasn't yet been dispatched, then abort the script
+     currently running in the worker.
+
+   <li>
+    <p>Wait a user-agent-defined amount of time.
+
+   <li>
+    <p>Abort the script currently running in the worker (if any script is
+     running, then it will be a handler for the <code
+     title=event-unload>unload</code> event).
+  </ol>
+
+  <h2 id=creating><span class=secno>3. </span>Creating workers</h2>
+
+  <p class=big-issue>...
+
   <h2 class=no-num id=references>References</h2>
 
   <p class=big-issue>This section will be written in a future
@@ -380,3 +501,6 @@
 
   <p>Thanks to Maciej Stachowiak and Mike Smith for their useful and
    substantial comments.
+
+  <p>Huge thanks to the whole Gears team, who pioneered this technology and
+   whose experience has been a huge influence on this specification.

Received on Wednesday, 16 July 2008 01:40:36 UTC