- From: Jonas Sicking <jonas@sicking.cc>
- Date: Fri, 11 Oct 2013 11:56:30 -0700
- To: Glenn Maynard <glenn@zewt.org>
- Cc: Andrea Marchesini <amarchesini@mozilla.com>, David Bruant <bruant.d@gmail.com>, "public-webapps@w3.org" <public-webapps@w3.org>
On Wed, Sep 5, 2012 at 7:03 PM, Jonas Sicking <jonas@sicking.cc> wrote: > Hence I think something like the following would work: > > [Constructor] > interface SyncMessageChannel { > readonly attribute MessagePortSyncSide syncPort; > readonly attribute MessagePortAsyncSide asyncPort; > }; > > interface MessagePortSyncSide { > void postMessage(any message, optional sequence<Transferable> transfer); > any waitForMessage(); > void close(); > }; > MessagePortSyncSide implements Transferable; > > interface MessagePortAsyncSide : EventTarget { > void postMessage(any message, optional sequence<Transferable> transfer); > void start(); > void close(); > > // event handlers > attribute EventHandler onmessage; > }; > MessagePortAsyncSide implements Transferable; > > > Where there's the additional limitation that MessagePortSyncSide can > only be transferred though MessagePortAsyncSide.postMessage() or > Worker.postMessage(), and MessagePortAsyncSide can only be transferred > though MessagePortSyncSide.postMessage() or > DedicatedWorkerGlobalScope.postMessage(). We're planning on implementing this API soon in Gecko. The main use cases that we're looking to solve are: * Enable libraries to implement APIs that require functionality that are not yet available in workers but that is available on the main thread. There will likely be such functionality for a long time to come given that we're constantly adding new functionality to the web platform and implementations tend to add APIs to the main thread before they do so to workers. * Enable compiling code that was written for other platforms to the web. Specifically where such code uses synchronous APIs, but where we for good reasons have chosen not to expose synchronous counterparts in the web platform. The most obvious example here is synchronous filesystem access which is very commonly used in other platforms like posix and windows. If people have other ideas for how to solve those use-cases, we're of course always open to other proposals. But please look through this thread first as there has been lots of good discussion. If people are not interested in solving these use-cases I'm always interested in that input too. / Jonas
Received on Friday, 11 October 2013 18:57:27 UTC