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

In summary, there is a desire for a mechanism to transfer objects (to allow
for potentially better perf) across a MessagePort.

The mechanism:

   - needs to have an intuitive feel for developers,
   - must preserve backwards compatibility,
   - should ideally allow the port to function the same regardless of
   whether the message was cloned or transferred.
   - should be easy to use.

There are three ideas for how to accomplish this:

1. Mixing in the list of objects to be cloned with the ports and use that
list to determine what objects in the message should be cloned.

This allows a lot of flexibility.
It feels odd mixing in a list of objects with the ports when the two have
nothing related.
It also feels complicated having to add objects in two places (the message
and this extra array).


2. Adding another parameter to postMessage "clone"/"transfer" or true/false,
etc.

It is less flexible than 1.
It is very simple and easy to use.
It may not be as noticeable when reading the code that this postMessage does
a transfer of items.


3. Adding another method transferMessage with the same parameters as
postMessage.

It is less flexible than 1.
It is very simple and easy to use.
It may be a pain to keep this in sync with postMessage.
It should be very noticeable when reading code.


What do you think is the best way to expose this to web developers?

dave

Received on Thursday, 2 June 2011 19:54:01 UTC