[whatwg] ArrayBuffer and the structured clone algorithm

Ian Hickson ian at hixie.ch
Mon May 9 15:44:21 PDT 2011


On Mon, 31 Jan 2011, Kenneth Russell wrote:
> 
> There's been some preliminary discussion within the WebGL working group 
> (where ArrayBuffer / Typed Arrays originated) about using ArrayBuffer 
> with Web Workers in particular. There is a strong desire to support 
> handoff of an ArrayBuffer from the main thread to a worker and vice 
> versa; this would allow efficient producer/consumer queues to be built 
> without violating ECMAScript's shared-nothing semantics.
> 
> All of the parties involved are pretty busy getting WebGL 1.0 out the 
> door; once that happens, we aim to make one more revision to the Typed 
> Array spec to support (1) read-only arrays for more efficient XHRs and 
> (2) handoff of ArrayBuffers. Expect public discussions to start in about 
> six to eight weeks.

Ken and I discussed this off-list, editor-to-editor as it were, and the 
plan is to wait for Typed Arrays to settle down a bit more, and then 
once they are stable, to update the structured clone algorithm to handle 
them directly (so that the Typed Array spec doesn't have to be a delta 
spec to the HTML spec).


On Tue, 1 Feb 2011, Boris Zbarsky wrote:
> On 2/1/11 1:04 PM, Anne van Kesteren wrote:
> > On Tue, 01 Feb 2011 18:36:19 +0100, Boris Zbarsky <bzbarsky at mit.edu> 
> > wrote:
> > > For what it's worth, in Gecko that's the same thing, since imagedata 
> > > is just a typed array in our implementation.
> > 
> > I wonder if we can still remove CanvasPixelArray.
> 
> Well, the typed array we use is a custom type that implements the 
> CanvasPixelArray semantics (e.g. the rounding and clamping bits)....

On Tue, 1 Feb 2011, Oliver Hunt wrote:
> 
> I haven't seen anything that depends on CanvasPixelArray the name, but I 
> wonder if people use the constructor to access the CPA prototype?  It 
> could be treated simply as an alias to the appropriate Typed Array 
> constructor i guess, but i'd want to be sure that there's no weirdness 
> with people modifiying both the typed array and cpa prototypes.

On Tue, 1 Feb 2011, Tab Atkins Jr. wrote:
> 
> Only if the out-of-bounds behavior for entries in Typed Arrays matches 
> the current clamping behavior for CanvasPixelArray.  I don't see any 
> explicit indication of what should be done in the Typed Array spec, 
> which I suppose means that they're relying on WebIDL's coercion algos to 
> keep things in-range for the given view.  WebIDL has the wrong behavior 
> here right now (it wraps), though I think heycan is receptive to 
> changing it.

On Tue, 1 Feb 2011, Kenneth Russell wrote:
> 
> For this reason I think we need to keep CanvasPixelArray distinct. I 
> certainly hope that Web IDL does not change its conversion rules to 
> mimic the clamping behavior in CanvasPixelArray. Right now Web IDL 
> delegates to the ECMA-262 specification for primitive conversions, which 
> have the wrapping behavior of C-style casts rather than clamping 
> behavior. Forcing clamping for out-of-range integer values would impose 
> a significant negative performance constraint on typed arrays.

I haven't changed CanvasPixelArray.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list