[whatwg] ArrayBuffer and the structured clone algorithm

On Mon, Jan 31, 2011 at 10:47 PM, Kenneth Russell <kbr at google.com> wrote:
> On Mon, Jan 31, 2011 at 3:10 PM, Ian Hickson <ian at hixie.ch> wrote:
>> On Fri, 7 Jan 2011, David Flanagan wrote:
>>>
>>> The structured clone algorithm currently allows ImageData and Blob
>>> objects to be cloned but doesn't mention ArrayBuffer. ?Is this
>>> intentional? ?I assume there are no security issues involved, since one
>>> could copy the bytes of an ArrayBuffer into either a Blob or an
>>> ImageData object in order to clone them.
>>
>> It's intentional in that I'm waiting for ArrayBuffer to be more stable
>> before I add it throughout the spec. (Same with CORS and the various
>> places that might support cross-origin communication, e.g. Web Workers,
>> Server-Sent Events, <img>+<canvas>, etc.)
>
> 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.

Apologies for not following up to this thread.

Some strawman proposals for the typed array specification were posted
about a month ago and updated just now based on initial feedback. The
primary goal is to define interactions between the structured cloning
algorithm and ArrayBuffers, so that zero-copy data transfer between
Web Workers can be achieved. These proposals, if agreed upon, would
involve changes to the structured cloning algorithm and Web Messaging
spec. Please see:

http://www.khronos.org/registry/typedarray/specs/latest/

Feedback would be greatly appreciated. There is an ongoing thread on
the public WebGL mailing list ( see
https://www.khronos.org/webgl/public-mailing-list/ ), but I'll take
care of coalescing feedback from mailing lists.

-Ken

Received on Wednesday, 25 May 2011 18:35:23 UTC