Skip to content

Commit

Permalink
Allow arbitrary inter-document callback ordering
Browse files Browse the repository at this point in the history
Closes #29.
  • Loading branch information
igrigorik committed Apr 27, 2016
1 parent 7e0f559 commit 90eb240
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -353,15 +353,15 @@ <h2>Processing Model</h2>
<li>If <var>deadline</var> - <var>now</var> is greater than 50ms, then cap <var>deadline</var> by setting it to
be <var>now</var> + 50ms.</li>
<li>Let <var>windows</var> be the <code>Window</code> object's list of <a href="https://www.w3.org/TR/html5/browsers.html#browsing-context">browsing context</a>'s <code>WindowProxy</code> objects associated with the event loop in question.</li>
<li>For every <var>window</var> in <var>windows</var>, in any order, perform the following steps:
<li>For every <var>window</var> in <var>windows</var> perform the following steps:
<ol type="a">
<li>Let <var>doclist</var> be <var>window</var>'s <a>list of idle request callbacks</a>.</li>
<li>Let <var>runlist</var> be <var>window</var>'s <a>list of runnable idle callbacks</a>.</li>
<li>Append all entries from <var>doclist</var> into <var>runlist</var> preserving order.</li>
<li>Clear <var>doclist</var>.</li>
<li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> which performs the steps defined in the <a>invoke idle callbacks algorithm</a> with parameters <var>runlist</var> and <var>deadline</var>.</li>
</ol>
</li>
<li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> which performs the steps defined in the <a>invoke idle callbacks algorithm</a> with <var>deadline</var> as parameter.</li>
<li>
Save <var>deadline</var> as the last idle period deadline associated with the current event loop.</li>
</ol>
Expand Down Expand Up @@ -391,14 +391,17 @@ <h2>Processing Model</h2>
</div>
<p>The <dfn>invoke idle callbacks algorithm</dfn>:</p>
<ol>
<li>Let <var>windows</var> be the <code>Window</code> object's list of <a href="https://www.w3.org/TR/html5/browsers.html#browsing-context">browsing context</a>'s <code>WindowProxy</code> objects that have a non-empty <a>list of runnable idle callbacks</a> (<var>runlist</var>).</li>
<li>Let <var>now</var> be the current time.</li>
<li>If <var>now</var> is less than <var>deadline</var>:
<ol>
<li>Pop <var>callback</var> from the <var>runlist</var>.</li>
<li>Select any <var>window</var> from <var>windows</var>.</li>
<li>Pop <var>callback</var> from <var>window</var>'s <var>runlist</var>.</li>
<li>If <var>window</var>'s <var>runlist</var> is now empty, remove <var>window</var> from <var>windows</var>.</li>
<li>Let <var>deadlineArg</var> be an <code>IdleDeadline</code> constructed
with the given <var>deadline</var> and the <code>didTimeout</code> attribute set to <code>false</code></li>
with the given <var>deadline</var> and the <code>didTimeout</code> attribute set to <code>false</code>.</li>
<li>Call <var>callback</var> with <var>deadlineArg</var> as its argument. If an uncaught runtime script error occurs, then <a href="http://www.w3.org/TR/html5/webappapis.html#report-the-error">report the error</a>.</li>
<li id='s2.4'>If <var>runlist</var> is not empty, the user agent SHOULD <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> which performs the steps in the <a>invoke idle callbacks algorithm</a> with parameters <var>runlist</var> and <var>deadline</var>.</li>
<li>If <var>windows</var> is not empty, the user agent SHOULD <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> which performs the steps in the <a>invoke idle callbacks algorithm</a> with <var>deadline</var> as parameter.</li>
</ol>
</li>
</ol>
Expand Down

0 comments on commit 90eb240

Please sign in to comment.