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: Travis Leithead <Travis.Leithead@microsoft.com>
Date: Fri, 10 Jun 2011 05:54:49 +0000
To: Andrew Wilson <atwilson@google.com>, Glenn Maynard <glenn@zewt.org>
CC: Kenneth Russell <kbr@google.com>, Jonas Sicking <jonas@sicking.cc>, "David Levin" <levin@chromium.org>, Arthur Barstow <art.barstow@nokia.com>, "Dmitry Lomov" <dslomov@google.com>, ben turner <bent.mozilla@gmail.com>, "public-webapps@w3.org" <public-webapps@w3.org>, Ian Hickson <ian@hixie.ch>
Message-ID: <9768D477C67135458BF978A45BCF9B38307C7027@TK5EX14MBXW603.wingroup.windeploy.ntdev.microsoft.com>
Honestly, there's something about this whole discussion that just doesn't feel right.

I looks like we're trying to graft-in this new concept of transfer of ownership into the existing postMessage semantics (i.e., object cloning). Any way I try to make it work, it just looks like peaches grafted into an apple tree.

What happened to Jonas' other proposal about a new API? I'd like to direct some mental energy into that proposal.


>> Complexity comes in many forms and shapes. I much more like the idea

>> of explicit APIs that make it clear what happens and make it hard to shoot

>> yourself in the foot. Yes, it can involve more typing, but if it results in more

>> resilient code which contains fewer subtle bugs, then I think we have designed

>> the API well.

>>

>> / Jonas

Ex: void postMessageAndTransfer([in] any transferOwnershipToDestination...);

We're only talking about a scenario that makes sense primarily for Web Workers and applies only to certain types like ArrayBuffer, CanvasPixelArray+ImageData, Blob, File, etc., that have large underlying memory buffers.

We don't really need to support JavaScript objects, arrays, complex graphs, etc. at all with the new API (and since the current proposal requires the web developer to make an explicit list anyway for the 2nd param to post message, it's no _more_ work to do the same for a new API).

We could even try to graft MessagePorts into this API, but why? MessagePorts are unique in function compared to the other objects we are discussing for transfer of ownership (e.g., they facilitate further messaging and can't be re-posted once they are cloned once), and they already have well-defined behavior in MessageEvents and SharedWorkers.

I propose keeping postMessage exactly as it is. Let's eliminate the potential compatibility issues. Let's not re-write the existing specs (that feels like going backwards, not forwards). For transfer of ownership, let's bring this capability on-line through a new API, for the specific scenario where it makes sense (Web Workers) and not pollute the current postMessage concepts (object graph cloning and port-passing).
Received on Friday, 10 June 2011 05:55:20 GMT

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