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: David Levin <levin@chromium.org>
Date: Thu, 2 Jun 2011 12:53:17 -0700
Message-ID: <BANLkTimgzgUKTXvf5m6rqXBUNpkU+jamv7fzkHxpP3+1-qMGoQ@mail.gmail.com>
To: Jonas Sicking <jonas@sicking.cc>
Cc: ben turner <bent.mozilla@gmail.com>, "public-webapps@w3.org" <public-webapps@w3.org>
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,

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

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?

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:19 UTC