Skip to content

Commit

Permalink
Support SharedArrayBuffer in StructuredCloneWithTransfer
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Mar 2, 2016
1 parent d667c2a commit 97fb2b0
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -7650,6 +7650,10 @@ interface <dfn>DOMStringMap</dfn> {
<span>StructuredCloneWithTransfer</span> abstract operation directly. (Technically, by
<span>IsTransferable</span> and <span>TransferHelper</span>.)</p>

<p class="note">SharedArrayBuffer objects are unique in that while they are <span>transferable
objects</span>, they are not detached as a result of transfering. Therefore they can be
transferred and used again. Only SharedArrayBuffer objects are given this capability.</p>

<h4 id="structuredclonewithtransfer"><dfn data-export="">StructuredCloneWithTransfer</dfn> (
<var>input</var>, <var>transferList</var>, <var>targetRealm</var> )</h4>

Expand Down Expand Up @@ -8008,6 +8012,9 @@ interface <dfn>DOMStringMap</dfn> {
</ol>
</li>

<li><p>Otherwise, if <var>O</var> has a [[SharedArrayBufferData]] internal slot, then return
true.</p></li>

<li>
<p>Otherwise, if <var>O</var> has a [[<span>Detached</span>]] internal slot, then:</p>

Expand Down Expand Up @@ -8035,12 +8042,19 @@ interface <dfn>DOMStringMap</dfn> {
[[ArrayBufferData]] internal slot value of <var>input</var>.</p></li>

<li><p>Perform ! <span>DetachArrayBuffer</span>(<var>input</var>).</p></li>

<li><p>Return <var>output</var>.</p></li>
</ol>
</li>

<li><p>Return ? <var>input</var>.[[<span>Transfer</span>]](<var>targetRealm</var>).</p></li>
<li><p>Otherwise, if <var>input</var> has a [[SharedArrayBufferData]] internal slot, then let
<var>output</var> be a new SharedArrayBuffer object in <var>targetRealm</var> whose
[[SharedArrayBufferByteLength]] internal slot value is the [[SharedArrayBufferByteLength]]
internal slot value of <var>input</var>, and whose [[SharedArrayBufferData]] internal slot value
is the [[SharedArrayBufferData]] internal slot value of <var>input</var>.</p></li>

<li><p>Otherwise, let <var>output</var> be ?
<var>input</var>.[[<span>Transfer</span>]](<var>targetRealm</var>).</p></li>

<li><p>Return <var>output</var>.</p></li>
</ol>

<h4>Monkey patch for <code>Blob</code> and <code>FileList</code> objects</h4>
Expand Down Expand Up @@ -117018,6 +117032,7 @@ INSERT INTERFACES HERE

<dt id="refsJAVASCRIPT">[JAVASCRIPT]</dt>
<dd><cite><a href="https://tc39.github.io/ecma262/">ECMAScript Language Specification</a></cite>. Ecma International.</dd>
<dd><cite><a href="https://tc39.github.io/ecmascript_sharedmem/shmem.html">ECMAScript Shared Memory and Atomics</a></cite>. Ecma International.</dd>
<dd><cite><a href="https://javascript.spec.whatwg.org/">JavaScript Standard</a></cite>, M. Bynens. WHATWG.</dd>

<dt id="refsJLREQ">[JLREQ]</dt>
Expand Down

0 comments on commit 97fb2b0

Please sign in to comment.