Skip to content

Commit

Permalink
[e] (0) Allow workers that become suspendable but still have outstand…
Browse files Browse the repository at this point in the history
…ing work to get GC'ed.

Affected topics: DOM APIs, Workers

git-svn-id: http://svn.whatwg.org/webapps@8330 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Dec 3, 2013
1 parent 315d9d4 commit ca1c582
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 15 deletions.
20 changes: 15 additions & 5 deletions complete.html
Expand Up @@ -82315,14 +82315,15 @@ <h4 id="the-worker's-lifetime"><span class=secno>10.2.3 </span>The worker's life
<hr><p>A worker is said to be a <dfn id=permissible-worker>permissible worker</dfn> if its list of <a href="#the-worker's-documents">the worker's
<code>Document</code>s</a> is not empty.</p>

<p>A worker is said to be a <dfn id=protected-worker>protected worker</dfn> if it is a <a href=#permissible-worker>permissible worker</a>
<p>A worker is said to be an <dfn id=active-needed-worker>active needed worker</dfn> if any of the <code><a href=#document>Document</a></code>
objects in <a href="#the-worker's-documents">the worker's <code>Document</code>s</a> are <a href=#fully-active>fully active</a>.</p>

<!--CLEANUP-->
<p>A worker is said to be a <dfn id=protected-worker>protected worker</dfn> if it is an <a href=#active-needed-worker>active needed worker</a>
and either it has outstanding timers, database transactions, or network connections, or its list
of <a href="#the-worker's-ports">the worker's ports</a> is not empty, or its <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> is actually
a <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object (i.e. the worker is a shared worker).</p>

<p>A worker is said to be an <dfn id=active-needed-worker>active needed worker</dfn> if any of the <code><a href=#document>Document</a></code>
objects in <a href="#the-worker's-documents">the worker's <code>Document</code>s</a> are <a href=#fully-active>fully active</a>.</p>

<p>A worker is said to be a <dfn id=suspendable-worker>suspendable worker</dfn> if it is not an <a href=#active-needed-worker>active needed
worker</a> but it is a <a href=#permissible-worker>permissible worker</a>.</p>

Expand Down Expand Up @@ -82407,7 +82408,7 @@ <h4 id=processing-model-7><span class=secno>10.2.4 </span>Processing model</h4>

<!--CLEANUP-->
<p><strong>Closing orphan workers</strong>: Start monitoring the worker such that no sooner than
it stops being either a <a href=#protected-worker>protected worker</a>, and
it stops being a <a href=#protected-worker>protected worker</a>, and
no later than it stops being a <a href=#permissible-worker>permissible worker</a>, <var title="">worker global
scope</var>'s <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is set to true<!--
v2-onclose and <span title="queue a task">a task is queued</span> to <span>fire a simple
Expand Down Expand Up @@ -82481,6 +82482,15 @@ <h4 id=processing-model-7><span class=secno>10.2.4 </span>Processing model</h4>

</li>
-->

<li>

<!-- this has no normative impact but makes it clearer that the worker is irrelevant now, and
doesn't have to survive until its Documents all die off too -->
<p>Empty the worker's list of <a href="#the-worker's-documents">the worker's <code>Document</code>s</a>.</p>

</li>

</ol><hr><p>When a user agent is to <dfn id=kill-a-worker>kill a worker</dfn> it must run the following steps in parallel
with the worker's main loop (the "<a href=#run-a-worker>run a worker</a>" processing model defined above):</p>

Expand Down
20 changes: 15 additions & 5 deletions index
Expand Up @@ -82315,14 +82315,15 @@ worker.port.postMessage({ foo: 'structured', bar: ['data', 'also', 'possible']})
<hr><p>A worker is said to be a <dfn id=permissible-worker>permissible worker</dfn> if its list of <a href="#the-worker's-documents">the worker's
<code>Document</code>s</a> is not empty.</p>

<p>A worker is said to be a <dfn id=protected-worker>protected worker</dfn> if it is a <a href=#permissible-worker>permissible worker</a>
<p>A worker is said to be an <dfn id=active-needed-worker>active needed worker</dfn> if any of the <code><a href=#document>Document</a></code>
objects in <a href="#the-worker's-documents">the worker's <code>Document</code>s</a> are <a href=#fully-active>fully active</a>.</p>

<!--CLEANUP-->
<p>A worker is said to be a <dfn id=protected-worker>protected worker</dfn> if it is an <a href=#active-needed-worker>active needed worker</a>
and either it has outstanding timers, database transactions, or network connections, or its list
of <a href="#the-worker's-ports">the worker's ports</a> is not empty, or its <code><a href=#workerglobalscope>WorkerGlobalScope</a></code> is actually
a <code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object (i.e. the worker is a shared worker).</p>

<p>A worker is said to be an <dfn id=active-needed-worker>active needed worker</dfn> if any of the <code><a href=#document>Document</a></code>
objects in <a href="#the-worker's-documents">the worker's <code>Document</code>s</a> are <a href=#fully-active>fully active</a>.</p>

<p>A worker is said to be a <dfn id=suspendable-worker>suspendable worker</dfn> if it is not an <a href=#active-needed-worker>active needed
worker</a> but it is a <a href=#permissible-worker>permissible worker</a>.</p>

Expand Down Expand Up @@ -82407,7 +82408,7 @@ worker.port.postMessage({ foo: 'structured', bar: ['data', 'also', 'possible']})

<!--CLEANUP-->
<p><strong>Closing orphan workers</strong>: Start monitoring the worker such that no sooner than
it stops being either a <a href=#protected-worker>protected worker</a>, and
it stops being a <a href=#protected-worker>protected worker</a>, and
no later than it stops being a <a href=#permissible-worker>permissible worker</a>, <var title="">worker global
scope</var>'s <a href=#dom-workerglobalscope-closing title=dom-WorkerGlobalScope-closing>closing</a> flag is set to true<!--
v2-onclose and <span title="queue a task">a task is queued</span> to <span>fire a simple
Expand Down Expand Up @@ -82481,6 +82482,15 @@ worker.port.postMessage({ foo: 'structured', bar: ['data', 'also', 'possible']})

</li>
-->

<li>

<!-- this has no normative impact but makes it clearer that the worker is irrelevant now, and
doesn't have to survive until its Documents all die off too -->
<p>Empty the worker's list of <a href="#the-worker's-documents">the worker's <code>Document</code>s</a>.</p>

</li>

</ol><hr><p>When a user agent is to <dfn id=kill-a-worker>kill a worker</dfn> it must run the following steps in parallel
with the worker's main loop (the "<a href=#run-a-worker>run a worker</a>" processing model defined above):</p>

Expand Down
20 changes: 15 additions & 5 deletions source
Expand Up @@ -91536,14 +91536,15 @@ worker.port.postMessage({ foo: 'structured', bar: ['data', 'also', 'possible']})
<p>A worker is said to be a <dfn>permissible worker</dfn> if its list of <span>the worker's
<code>Document</code>s</span> is not empty.</p>

<p>A worker is said to be a <dfn>protected worker</dfn> if it is a <span>permissible worker</span>
<p>A worker is said to be an <dfn>active needed worker</dfn> if any of the <code>Document</code>
objects in <span>the worker's <code>Document</code>s</span> are <span>fully active</span>.</p>

<!--CLEANUP-->
<p>A worker is said to be a <dfn>protected worker</dfn> if it is an <span>active needed worker</span>
and either it has outstanding timers, database transactions, or network connections, or its list
of <span>the worker's ports</span> is not empty, or its <code>WorkerGlobalScope</code> is actually
a <code>SharedWorkerGlobalScope</code> object (i.e. the worker is a shared worker).</p>

<p>A worker is said to be an <dfn>active needed worker</dfn> if any of the <code>Document</code>
objects in <span>the worker's <code>Document</code>s</span> are <span>fully active</span>.</p>

<p>A worker is said to be a <dfn>suspendable worker</dfn> if it is not an <span>active needed
worker</span> but it is a <span>permissible worker</span>.</p>

Expand Down Expand Up @@ -91632,7 +91633,7 @@ worker.port.postMessage({ foo: 'structured', bar: ['data', 'also', 'possible']})

<!--CLEANUP-->
<p><strong>Closing orphan workers</strong>: Start monitoring the worker such that no sooner than
it stops being either a <span>protected worker</span>, and
it stops being a <span>protected worker</span>, and
no later than it stops being a <span>permissible worker</span>, <var data-x="">worker global
scope</var>'s <span data-x="dom-WorkerGlobalScope-closing">closing</span> flag is set to true<!--
v2-onclose and <span data-x="queue a task">a task is queued</span> to <span>fire a simple
Expand Down Expand Up @@ -91710,6 +91711,15 @@ worker.port.postMessage({ foo: 'structured', bar: ['data', 'also', 'possible']})

</li>
-->

<li>

<!-- this has no normative impact but makes it clearer that the worker is irrelevant now, and
doesn't have to survive until its Documents all die off too -->
<p>Empty the worker's list of <span>the worker's <code>Document</code>s</span>.</p>

</li>

</ol>

<hr>
Expand Down

0 comments on commit ca1c582

Please sign in to comment.