@@ -130479,6 +130479,46 @@ interface <dfn interface>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope
130479130479 </ol>
130480130480 </div>
130481130481
130482+ <div class="note" id="note-worker-lifetime-terminology-relationships">
130483+ <p>The following relationships hold between these terms:</p>
130484+
130485+ <ul>
130486+ <li><p>Every <code>WorkerGlobalScope</code> that is <span data-x="active needed worker">actively
130487+ needed</span> or <span data-x="protected worker">protected</span> is <span data-x="permissible
130488+ worker">permissible</span>.</p></li>
130489+
130490+ <li><p>Every <code>WorkerGlobalScope</code> that is <span data-x="protected
130491+ worker">protected</span> is <span data-x="active needed worker">actively needed</span>.</p></li>
130492+ </ul>
130493+
130494+ <p>However, the converses do not always hold:</p>
130495+
130496+ <ul>
130497+ <li><p>A <code>WorkerGlobalScope</code> can be <span data-x="active needed worker">actively
130498+ needed</span> but not <span data-x="protected worker">protected</span>, if it's a dedicated
130499+ worker with no outstanding async work that is still performing computation on behalf of a fully
130500+ active owner, but whose corresponding <code>Worker</code> object has been garbage collected. <a
130501+ href="#ports-and-garbage-collection">Because of the garbage collection</a>, the <span
130502+ data-x="the worker's ports">ports</span> collection is empty, so it is no longer protected.
130503+ However, its event loop has not yet yielded to <a
130504+ href="#step-empty-worker-global-scope-owner-set">empty its owner set</a>, so it is still
130505+ actively needed.</p></li>
130506+
130507+ <li><p>A <code>WorkerGlobalScope</code> can be <span data-x="permissible
130508+ worker">permissible</span> but not <span data-x="protected worker">protected</span> or <span
130509+ data-x="active needed worker">actively needed</span>, if all the <code>Document</code>s in its
130510+ transitive set of owners are in <a href="#note-bfcache">bfcache</a>, or if it's a
130511+ <code>SharedWorkerGlobalScope</code> with no current owners being kept alive for the duration of
130512+ the <span>between-loads shared worker timeout</span>.</p></li>
130513+ </ul>
130514+ </div>
130515+
130516+ <p class="note" id="note-between-loads-shared-worker-timeout-lifetime">The <span>between-loads
130517+ shared worker timeout</span> only influences the definition of <span data-x="permissible
130518+ worker">permissible</span>, not <span data-x="protected worker">protected</span>, and so
130519+ implementations are not required to keep shared workers alive for that duration. Rather, they are
130520+ required to close shared workers after the timeout is reached.</p>
130521+
130482130522 <div algorithm>
130483130523 <p>A <code>WorkerGlobalScope</code> <var>global</var> is <dfn data-x="suspendable
130484130524 worker">suspendable</dfn> if the following algorithm returns true:</p>
@@ -130503,33 +130543,15 @@ interface <dfn interface>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope
130503130543 they stop being <span data-x="protected worker">protected</span> and when they stop being <span
130504130544 data-x="permissible worker">permissible</span>.</p></li>
130505130545
130506- <li><p>Workers get <a href="#step-suspending-workers">suspended or un-suspended</a> based on
130507- whether they are <span data-x="suspendable worker">suspendable</span>.</p></li>
130508-
130509130546 <li><p>Workers that have been closed, but keep executing, <a
130510130547 href="#terminate-rampant-workers">can be terminated</a> at the user agent's discretion, once
130511130548 they stop being <span data-x="active needed worker">actively needed</span>.</p></li>
130512- </ul>
130513130549
130514- <p>Note that every <code>WorkerGlobalScope</code> that is <span data-x="active needed
130515- worker">actively needed</span> is <span data-x="protected worker">protected</span>, and every
130516- <code>WorkerGlobalScope</code> that is <span data-x="protected worker">protected</span> is <span
130517- data-x="permissible worker">permissible</span>. (But the converses do not hold.)</p>
130518-
130519- <p>An important difference between <span data-x="protected worker">protected</span> and <span
130520- data-x="permissible worker">permissible</span> is that a <code>WorkerGlobalScope</code> is <span
130521- data-x="protected worker">protected</span> only if its transitive set of owners contains at least
130522- one <span>fully active</span> <code>Document</code>, whereas a <code>WorkerGlobalScope</code> can
130523- be <span data-x="permissible worker">permissible</span> even if all the <code>Document</code>s in
130524- its transitive set of owners are in <a href="#note-bfcache">bfcache</a>.</p>
130550+ <li><p>Workers get <a href="#step-suspending-workers">suspended or un-suspended</a> based on
130551+ whether they are <span data-x="suspendable worker">suspendable</span>.</p></li>
130552+ </ul>
130525130553 </div>
130526130554
130527- <p class="note" id="note-between-loads-shared-worker-timeout-lifetime">The <span>between-loads
130528- shared worker timeout</span> only influences the definition of <span data-x="permissible
130529- worker">permissible</span>, not <span data-x="protected worker">protected</span>, and so
130530- implementations are not required to keep shared workers alive for that duration. Rather, they are
130531- required to close shared workers after the timeout is reached.</p>
130532-
130533130555
130534130556 <h4 id="worker-processing-model"><span id="processing-model-10"></span>Processing model</h4>
130535130557
@@ -130824,11 +130846,8 @@ interface <dfn interface>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope
130824130846 <p>Disentangle all the ports in the list of <span>the worker's ports</span>.</p>
130825130847 </li>
130826130848
130827- <li>
130828- <!-- this has no normative impact but makes it clearer that the worker is irrelevant now, and
130829- doesn't have to survive until its Documents all die off too --> <p><span data-x="list
130830- empty">Empty</span> <var>worker global scope</var>'s <span>owner set</span>.</p>
130831- </li>
130849+ <li id="step-empty-worker-global-scope-owner-set"><p><span data-x="list empty">Empty</span>
130850+ <var>worker global scope</var>'s <span>owner set</span>.</p></li>
130832130851 </ol>
130833130852 </li>
130834130853 </ol>
0 commit comments