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

On Fri, 10 Jun 2011, Travis Leithead wrote:
> 
> This looks like a mis-reading on my part of step 2 of the postMessage 
> algorithm:
> 
> "2.If the method was called with a second argument ports and that 
> argument isn't null, then, if any of the entries in ports are null, if 
> any MessagePort object is listed in ports more than once, ***if any of 
> the MessagePort objects listed in ports have already been cloned once 
> before,**** or if any of the entries in ports are either the source port 
> or the target port (if any), then throw an INVALID_STATE_ERR exception.
> 
> Depending on how you look at it, this could be referring to the 
> underlying port object, or to the current port instance. Ian is on this 
> thread--I assume you now meant purely transfer of ownership?

It's referring to the MessagePort object itself, not the underlying port. 
Hence why it says "the MessagePort objects". :-)


With MessagePort, it never makes sense to copy them rather than transfer 
ownership. With ArrayBuffer and ImageData, both make sense in different 
scenarios (right now, ImageData is always copied, and ArrayBuffer isn't 
supported), so we presumably need something to support saying which you 
want. One way is to always copy unless the object is listed in an argument 
listing all the things to transfer instead of copy. Another way is to 
have two methods, one that copies and one that transfers (the things that 
can be transferred). The latter is slightly problematic in that you can't 
pick which things to transfer and which to copy if you need to mix them, 
and you can't later make something that today can only be copied (e.g. 
ImageData) into something that can also be transferred, which you _could_ 
do if we had the array model.

I haven't gone through this thread in detail to study all the proposals 
yet, but I am saving the e-mails on this thread to be able to do that when 
I get to this particular topic (hopefully quite soon, since I've received 
vendor feedback that Workers should get some attention soon).

HTH,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 10 June 2011 20:33:59 UTC