Skip to content

Commit

Permalink
Reference newly landed WebIDL "transferable" definition (#732)
Browse files Browse the repository at this point in the history
As promised, the local algorithm "detachable" migrated to WebIDL[1],
so we can drop our copy of the algorithm and reference WebIDL's
version instead, which is identical except for a name change[3].

(If you're building the spec locally and run into errors, force
a Bikeshed update[2] to ensure you have the latest indexes.)

1: whatwg/webidl@d6927d5
2: https://speced.github.io/bikeshed/#updating-bikeshed
3: whatwg/webidl#1419 (comment)

Ref: #351
  • Loading branch information
inexorabletash authored Jul 19, 2024
1 parent 6be80a4 commit 46ba167
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -937,29 +937,12 @@ When the {{MLContext/[[contextType]]}} is set to [=context type/default=] with t

### {{MLNamedArrayBufferViews}} transfer algorithm ### {#mlnamedarraybufferviews-transfer-alg}

<details open algorithm>
<summary>
A [=buffer source type=] instance |bufferSource| is
<dfn for="BufferSource">detachable</dfn> if the following steps return true:
</summary>
1. Let |jsArrayBuffer| be the result of [=converted to a JavaScript value|converting=]
|bufferSource| to a JavaScript value.
1. If |jsArrayBuffer| has a \[[ViewedArrayBuffer]] internal slot, then set |jsArrayBuffer| to
|jsArrayBuffer|.\[[ViewedArrayBuffer]].
1. If [$IsSharedArrayBuffer$](|jsArrayBuffer|) is true, then return false.
1. If [$IsDetachedBuffer$](|jsArrayBuffer|) is true, return false.
1. If |jsArrayBuffer|.\[[ArrayBufferDetachKey]] is not undefined, return false.
1. Return true.
</details>

Issue(351): Move the above algorithm into [[WEBIDL]].

<details open algorithm>
<summary>
To <dfn for="MLNamedArrayBufferViews">transfer</dfn> an {{MLNamedArrayBufferViews}} |views| with [=realm=] |realm|:
</summary>
1. [=map/For each=] |name| → |view| of |views|:
1. If |view| is not [=BufferSource/detachable=], then throw a {{TypeError}}.
1. If |view| is not [=BufferSource/transferable=], then throw a {{TypeError}}.
1. Let |transferredViews| be a new {{MLNamedArrayBufferViews}}.
1. [=map/For each=] |name| → |view| of |views|:
1. Let |transferredBuffer| be the result of [=ArrayBuffer/transfer|transferring=] |view|'s [=BufferSource/underlying buffer=].
Expand Down

0 comments on commit 46ba167

Please sign in to comment.