[html5] r7669 - [giow] (3) Make MessagePort objects synchronised until they are posted through a [...]

whatwg at whatwg.org whatwg at whatwg.org
Tue Jan 29 12:59:11 PST 2013


Author: ianh
Date: 2013-01-29 12:59:09 -0800 (Tue, 29 Jan 2013)
New Revision: 7669

Modified:
   complete.html
   index
   source
Log:
[giow] (3) Make MessagePort objects synchronised until they are posted through another port.
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=15063
Affected topics: DOM APIs

Modified: complete.html
===================================================================
--- complete.html	2013-01-29 20:12:43 UTC (rev 7668)
+++ complete.html	2013-01-29 20:59:09 UTC (rev 7669)
@@ -84684,8 +84684,27 @@
   queue</a> can be enabled or disabled, and is initially
   disabled. Once enabled, a port can never be disabled again (though
   messages in the queue can get moved to another queue or removed
-  altogether, which has much the same effect).</p>
+  altogether, which has much the same effect).
+  A <code><a href=#messageport>MessagePort</a></code> also has a <dfn id=has-been-shipped>has been shipped</dfn> flag. It must initially be
+  false.</p>
 
+  <p>Each <a href=#event-loop>event loop</a> has a <a href=#task-source>task source</a> called the <dfn id=unshipped-port-message-queue>unshipped port
+  message queue</dfn>. This is a virtual <a href=#task-source>task source</a>: it must act as if it contained
+  the <a href=#concept-task title=concept-task>tasks</a> of each <a href=#port-message-queue>port message queue</a> of each
+  <code><a href=#messageport>MessagePort</a></code> whose <a href=#has-been-shipped>has been shipped</a> flag is false, in the order in which
+  they were added to their respective <a href=#task-source>task source</a>. When a <a href=#concept-task title=concept-task>task</a> would be removed from the <a href=#unshipped-port-message-queue>unshipped port message
+  queue</a>, it must instead be removed from its <a href=#port-message-queue>port message queue</a>.</p>
+
+  <p>When a <code><a href=#messageport>MessagePort</a></code>'s <a href=#has-been-shipped>has been shipped</a> flag is false, its <a href=#port-message-queue>port
+  message queue</a> must be ignored for the purposes of the <a href=#event-loop>event loop</a>. (The
+  <a href=#unshipped-port-message-queue>unshipped port message queue</a> is used instead.)</p>
+
+  <p class=note>The <a href=#has-been-shipped>has been shipped</a> flag is set to true when a port, its twin, or
+  the object it was cloned from, is or has been <a href=#transfer-a-transferable-object title="transfer a transferable
+  object">transferred</a>. When a <code><a href=#messageport>MessagePort</a></code>'s <a href=#has-been-shipped>has been shipped</a> flag
+  is true, its <a href=#port-message-queue>port message queue</a> acts as a first-class <a href=#task-source>task source</a>,
+  unaffected to any <a href=#unshipped-port-message-queue>unshipped port message queue</a>.</p>
+
   <p>When the user agent is to <dfn id=create-a-new-messageport-object>create a new
   <code>MessagePort</code> object</dfn> owned by a <a href="#script's-global-object">script's
   global object</a> object <var title="">owner</var>, it must
@@ -84717,10 +84736,15 @@
   a new <code><a href=#messageport>MessagePort</a></code> object. These steps must be run
   atomically.</p>
 
-  <ol><li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a>
+  <ol><li><p>Set <var title="">original port</var>'s <a href=#has-been-shipped>has been shipped</a> flag to
+   true.</li>
+
+   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a>
    owned by <var title="">owner</var>, and let <var title="">new
    port</var> be that object.</li>
 
+   <li><p>Set <var title="">new port</var>'s <a href=#has-been-shipped>has been shipped</a> flag to true.</li>
+
    <li><p>Move all the events in the <a href=#port-message-queue>port message queue</a>
    of <var title="">original port</var> to the <a href=#port-message-queue>port message
    queue</a> of <var title="">new port</var>, if any, leaving the
@@ -84735,6 +84759,9 @@
     <ol><li><p>Let the <var title="">remote port</var> be the port with
      which the <var title="">original port</var> is entangled.</li>
 
+     <li><p>Set <var title="">remote port</var>'s <a href=#has-been-shipped>has been shipped</a> flag to
+     true.</li>
+
      <li><p><a href=#entangle>Entangle</a> the <var title="">remote port</var>
      and <var title="">new port</var> objects. The <var title="">original port</var> object will be disentangled by this
      process.</li>

Modified: index
===================================================================
--- index	2013-01-29 20:12:43 UTC (rev 7668)
+++ index	2013-01-29 20:59:09 UTC (rev 7669)
@@ -84684,8 +84684,27 @@
   queue</a> can be enabled or disabled, and is initially
   disabled. Once enabled, a port can never be disabled again (though
   messages in the queue can get moved to another queue or removed
-  altogether, which has much the same effect).</p>
+  altogether, which has much the same effect).
+  A <code><a href=#messageport>MessagePort</a></code> also has a <dfn id=has-been-shipped>has been shipped</dfn> flag. It must initially be
+  false.</p>
 
+  <p>Each <a href=#event-loop>event loop</a> has a <a href=#task-source>task source</a> called the <dfn id=unshipped-port-message-queue>unshipped port
+  message queue</dfn>. This is a virtual <a href=#task-source>task source</a>: it must act as if it contained
+  the <a href=#concept-task title=concept-task>tasks</a> of each <a href=#port-message-queue>port message queue</a> of each
+  <code><a href=#messageport>MessagePort</a></code> whose <a href=#has-been-shipped>has been shipped</a> flag is false, in the order in which
+  they were added to their respective <a href=#task-source>task source</a>. When a <a href=#concept-task title=concept-task>task</a> would be removed from the <a href=#unshipped-port-message-queue>unshipped port message
+  queue</a>, it must instead be removed from its <a href=#port-message-queue>port message queue</a>.</p>
+
+  <p>When a <code><a href=#messageport>MessagePort</a></code>'s <a href=#has-been-shipped>has been shipped</a> flag is false, its <a href=#port-message-queue>port
+  message queue</a> must be ignored for the purposes of the <a href=#event-loop>event loop</a>. (The
+  <a href=#unshipped-port-message-queue>unshipped port message queue</a> is used instead.)</p>
+
+  <p class=note>The <a href=#has-been-shipped>has been shipped</a> flag is set to true when a port, its twin, or
+  the object it was cloned from, is or has been <a href=#transfer-a-transferable-object title="transfer a transferable
+  object">transferred</a>. When a <code><a href=#messageport>MessagePort</a></code>'s <a href=#has-been-shipped>has been shipped</a> flag
+  is true, its <a href=#port-message-queue>port message queue</a> acts as a first-class <a href=#task-source>task source</a>,
+  unaffected to any <a href=#unshipped-port-message-queue>unshipped port message queue</a>.</p>
+
   <p>When the user agent is to <dfn id=create-a-new-messageport-object>create a new
   <code>MessagePort</code> object</dfn> owned by a <a href="#script's-global-object">script's
   global object</a> object <var title="">owner</var>, it must
@@ -84717,10 +84736,15 @@
   a new <code><a href=#messageport>MessagePort</a></code> object. These steps must be run
   atomically.</p>
 
-  <ol><li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a>
+  <ol><li><p>Set <var title="">original port</var>'s <a href=#has-been-shipped>has been shipped</a> flag to
+   true.</li>
+
+   <li><p><a href=#create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a>
    owned by <var title="">owner</var>, and let <var title="">new
    port</var> be that object.</li>
 
+   <li><p>Set <var title="">new port</var>'s <a href=#has-been-shipped>has been shipped</a> flag to true.</li>
+
    <li><p>Move all the events in the <a href=#port-message-queue>port message queue</a>
    of <var title="">original port</var> to the <a href=#port-message-queue>port message
    queue</a> of <var title="">new port</var>, if any, leaving the
@@ -84735,6 +84759,9 @@
     <ol><li><p>Let the <var title="">remote port</var> be the port with
      which the <var title="">original port</var> is entangled.</li>
 
+     <li><p>Set <var title="">remote port</var>'s <a href=#has-been-shipped>has been shipped</a> flag to
+     true.</li>
+
      <li><p><a href=#entangle>Entangle</a> the <var title="">remote port</var>
      and <var title="">new port</var> objects. The <var title="">original port</var> object will be disentangled by this
      process.</li>

Modified: source
===================================================================
--- source	2013-01-29 20:12:43 UTC (rev 7668)
+++ source	2013-01-29 20:59:09 UTC (rev 7669)
@@ -98334,8 +98334,28 @@
   queue</span> can be enabled or disabled, and is initially
   disabled. Once enabled, a port can never be disabled again (though
   messages in the queue can get moved to another queue or removed
-  altogether, which has much the same effect).</p>
+  altogether, which has much the same effect).
+  A <code>MessagePort</code> also has a <dfn>has been shipped</dfn> flag. It must initially be
+  false.</p>
 
+  <p>Each <span>event loop</span> has a <span>task source</span> called the <dfn>unshipped port
+  message queue</dfn>. This is a virtual <span>task source</span>: it must act as if it contained
+  the <span title="concept-task">tasks</span> of each <span>port message queue</span> of each
+  <code>MessagePort</code> whose <span>has been shipped</span> flag is false, in the order in which
+  they were added to their respective <span>task source</span>. When a <span
+  title="concept-task">task</span> would be removed from the <span>unshipped port message
+  queue</span>, it must instead be removed from its <span>port message queue</span>.</p>
+
+  <p>When a <code>MessagePort</code>'s <span>has been shipped</span> flag is false, its <span>port
+  message queue</span> must be ignored for the purposes of the <span>event loop</span>. (The
+  <span>unshipped port message queue</span> is used instead.)</p>
+
+  <p class="note">The <span>has been shipped</span> flag is set to true when a port, its twin, or
+  the object it was cloned from, is or has been <span title="transfer a transferable
+  object">transferred</span>. When a <code>MessagePort</code>'s <span>has been shipped</span> flag
+  is true, its <span>port message queue</span> acts as a first-class <span>task source</span>,
+  unaffected to any <span>unshipped port message queue</span>.</p>
+
   <p>When the user agent is to <dfn>create a new
   <code>MessagePort</code> object</dfn> owned by a <span>script's
   global object</span> object <var title="">owner</var>, it must
@@ -98375,10 +98395,15 @@
 
   <ol>
 
+   <li><p>Set <var title="">original port</var>'s <span>has been shipped</span> flag to
+   true.</p></li>
+
    <li><p><span>Create a new <code>MessagePort</code> object</span>
    owned by <var title="">owner</var>, and let <var title="">new
    port</var> be that object.</p></li>
 
+   <li><p>Set <var title="">new port</var>'s <span>has been shipped</span> flag to true.</p></li>
+
    <li><p>Move all the events in the <span>port message queue</span>
    of <var title="">original port</var> to the <span>port message
    queue</span> of <var title="">new port</var>, if any, leaving the
@@ -98395,6 +98420,9 @@
      <li><p>Let the <var title="">remote port</var> be the port with
      which the <var title="">original port</var> is entangled.</p></li>
 
+     <li><p>Set <var title="">remote port</var>'s <span>has been shipped</span> flag to
+     true.</p></li>
+
      <li><p><span>Entangle</span> the <var title="">remote port</var>
      and <var title="">new port</var> objects. The <var
      title="">original port</var> object will be disentangled by this




More information about the Commit-Watchers mailing list