whatwg / webidl

Web IDL Standard
https://webidl.spec.whatwg.org/
Other
410 stars 164 forks source link

Introduce a "transferable" algorithm for BufferSource #1419

Closed inexorabletash closed 4 months ago

inexorabletash commented 4 months ago

The new "transferable" algorithm allows an invoker to determine if a BufferSource can be detached without errors before invoking transfer. This is particularly helpful if several buffers are processed in a batch, as the validity of the operation can be determined up front, rather than during processing which could leave the buffers in a mix of states.

See discussion in [1]. A local copy of the algorithm was landed as [2] (as "detachable") but this seems like a useful addition to WebIDL.

1: https://github.com/webmachinelearning/webnn/issues/351 2: https://webmachinelearning.github.io/webnn/#buffersource-detachable

Eliding the checklist since this is a helper algorithm not new functionality, but please ask if more details are desired


Preview | Diff

inexorabletash commented 4 months ago

@domenic - could you please take a look? Low priority.

Also, feedback on whether the checklist (re: implementation commitments, etc) is needed in this case would helpful.