- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Wed, 11 Apr 2012 17:23:50 -0400
- To: Charles Pritchard <chuck@jumis.com>
- CC: Glenn Maynard <glenn@zewt.org>, public-webapps <public-webapps@w3.org>
On 4/11/12 5:04 PM, Charles Pritchard wrote: > When/if we start using the "Binary Data" instead of re-purposing typed > arrays. Then we'll need to add more send() overloads, probably. What those overloads will be, exactly, depends on the final state of the Binary Data spec. I don't see the problem, honestly. >> postMessage does arbitrary object graphs, which can include either >> ArrayBuffers or ArrayBufferViews. If you try to postMessage a typed >> array, the receiver will get a typed array, as expected. > > My understanding is/was that an ArrayBufferView will be copied whereas > an ArrayBuffer will be neutered/transferred. This understanding is incorrect, as stated. The only things that are transferred are the ones listed in the sequence<Transferable> argument. If you don't list anything there, http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#structured-clone will be run on everything. This will call into http://www.khronos.org/registry/typedarray/specs/latest/#9.3 and then http://www.khronos.org/registry/typedarray/specs/latest/#9.1 and copy all the various ArrayBufferViews and ArrayBuffers. You can't list an ArrayBufferView in the trasferable list. You _can_ list an ArrayBufer in the transferable list; if that's the case it will be neutered and transferred. If there are ArrayBufferViews being cloned that reference this ArrayBuffer, the clones will reference the transferred buffer. > These practices are already established. You're exploring ways to make > using them easier. Passing typed arrays to send() can't possibly be "established" since it's not exactly supported very well across browsers (and is disallowed by the spec at the moment). > Typed Arrays have matured. So? I'm not proposing changing anything about typed arrays. I'm proposing expanding the set of things that can be passed to send(). > They're available in all major implementations They're not available in any shipping IE version, last I checked. > I know they can be a pain in the ass, but they are functioning. That has nothing to do with the arguments allowed for XHR.send(). -Boris
Received on Wednesday, 11 April 2012 21:24:20 UTC