W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2011

Re: What changes to Web Messaging spec are proposed? [Was: Re: Using ArrayBuffer as payload for binary data to/from Web Workers]

From: Jonas Sicking <jonas@sicking.cc>
Date: Thu, 2 Jun 2011 10:34:34 -0700
Message-ID: <BANLkTinApgO_CTVQb=why0ryEdtT1iMfNw@mail.gmail.com>
To: ben turner <bent.mozilla@gmail.com>
Cc: "public-webapps@w3.org" <public-webapps@w3.org>
On Thu, Jun 2, 2011 at 10:22 AM, ben turner <bent.mozilla@gmail.com> wrote:
> On Thu, Jun 2, 2011 at 9:58 AM, Travis Leithead
> <Travis.Leithead@microsoft.com> wrote:
>>
>> This plan requires all objects that want to opt-in to a new transfer-of-ownership (or really
>> any special custom behavior for postMessage) to 1) participate in the special inheritance
>> interface and 2) be isolated from the primary object graph being passed to the first
>> parameter.
>
> I interpreted the proposal differently... This is what I envisioned:
>
>  var bufferToTransfer = /* make ArrayBuffer */;
>  var bufferToCopy = /* make ArrayBuffer */;
>  var worker = /* make Worker */;
>  var message = { buf1: bufferToTransfer, buf2: bufferToCopy };
>  worker.postMessage(message, [bufferToTransfer]);
>
> We'd keep the structure exactly the same, it's just that when we clone
> 'message' we compare each object value to one of the ones passed in
> the transfer array. If the objects match (===) then we'd transfer it
> rather than copy it.
>
> Does that sound like what you were hoping for?

This would work for me. It's also a better design for MessagePorts IMO.

I also don't understand the reason for the requirement to have the
type participate in some specific inheritance chain. All that seems
needed to me is to enumerate the types which can be transferred rather
than copied as obviously transferring normal JS arrays or JS objects
is unlikely to be possible in todays JS implementations.

/ Jonas
Received on Thursday, 2 June 2011 17:35:31 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:45 GMT