Bugzilla – Bug 13800
Add ArrayBuffer to Transferable types list (2.8.4); update Structured clone algorithm
Last modified: 2013-06-12 23:47:18 UTC
In order to support suggested changes in CanvasPixelArray -> Uint8ClampedArray (per bug 12586), ArrayBuffer should be specified as a Transferable type in section 2.8.4.
Furthermore, in the structured clone algorithm, the cloning of ImageData should be updated to allow the ImageData's Uint8ClampedArray to be transferred:
↪If input is a ImageData object
Let output be a newly constructed ImageData object with the same width and height as input, and with a newly constructed CanvasPixelArray for its data attribute, with the same length and pixel values as the input's.
↪If input is a ImageData object
Let output be a newly constructed ImageData object with the same width and height as input, and with a newly constructed Uint8ClampedArray view of the ArrayBuffer in the destination object of memory for its data attribute, with the same length and pixel values as the input's.
...or similar text to indicate that if the ImageData's Uint8ClampedArray's ArrayBuffer is transfered, then the new Uint8ClampedArray instance will be created over the transferred ArrayBuffer.
This is being specced in the TypedArray spec for the moment, but it'll come over once it's solid. (kbr: Correct me if I'm wrong here.)
Marking this REMIND for now. I will be doing this but we're waiting for the ArrayBuffer part of this to be stable before moving it from ArrayBuffer to HTML.
Please don't hesitate to reopen this if you notice that ArrayBuffer is ready for this before I do.
I'd like to request review of the changes that were made to the typed array spec today in response to http://www.w3.org/Bugs/Public/show_bug.cgi?id=13799 . Please see https://www.khronos.org/registry/typedarray/specs/latest/ . If they look okay, that's a good indication that they're solidifying.
Roger, will do.
kbr: The new text looks good.
kbr: Do you want me to move this to the HTML spec? Or should I wait? (Either is fine by me.)
Thanks for your review above.
(In reply to comment #6)
> kbr: Do you want me to move this to the HTML spec? Or should I wait? (Either is
> fine by me.)
Could we hold off a little longer? Ideally I'd like to snapshot the typed array spec again, so that the new functionality isn't highlighted as strawman proposals.
If this means closing this bug as REMIND again, no problem; I can take responsibility for reopening it when the next snapshot is taken.
Cool, thanks. Will mark it REMIND, just reopen it when you're ready!
This bug was cloned to create HTML WG bug 19071.
kbr: Do you have an update here?
The editors' draft of the typed array spec http://www.khronos.org/registry/typedarray/specs/latest/ has been updated to remove the "strawman" designation from the structured cloning and transfer operations, since there are now multiple implementations of this functionality and it has been non-controversial. Please feel free to incorporate this text into the HTML5 spec. Thanks.
So I was looking at this, and I wonder... should we really move this from the ArrayBuffer spec to the HTML spec? It seems like it works pretty well to have it in the ArrayBuffer spec, and it's unambiguously defined. Having it in ArrayBuffer means that everything you need to know about implementing ArrayBuffer is in one place, which seems like the right choice.
Fine with me. One thing to keep in mind is the typed array types are being subsumed into the ECMAScript 6 spec, and the typed array spec will probably become obsolete. It isn't clear to me where the Transferable functionality, which is specified at the HTML5 level rather than at the ES6 level, should go after this.
Ah, ok. In that case I'll just spec it in HTML, save us some trouble.