Re: [css-houdini-drafts] [worklets] relationship to JavaScript agent clusters

I might have confused things a bit, as we meandered through this thread. Let me try to re-summarize.

The agent/agent cluster formalism defines two separable things:

- Who you share memory with
- Whether you can use the Atomics.wait() API.

Atomics.wait() is governed by a boolean, [[CanBlock]]. It seems like everyone is on board with that boolean being false (so you cannot use Atomics.wait()). Thus when people say "false for AudioWorklet v1", since false is a boolean, it is easy to interpret this as being about Atomics.wait(), and unrelated to sharing memory.

The question of who you can share memory with is a separate question that also needs to be resolved. It could be the case that we say for "v1" you cannot share memory with anyone. But it is a pretty easy change to allow sharing memory with the parent window, and it is entirely on the HTML side. It is basically the same issue as #385 / #224.

If you say that worklets and their main thread cannot share memory ("are not in the same agent cluster"), then postMessaging SABs between them will cause messageerror events (instead of the usual message event).

Another thing to note is that even if you don't allow sharing memory between the worklet and main thread, SharedArrayBuffer still "works" inside worklets. You just can't share it with anyone, so it's kind of pointless. SharedArrayBuffer is a JavaScript global like Promise or Map or Math and can't be turned off.

So it seems like we are still not settled on whether worklets can share memory with the main thread. @padenot thinks they should be able to. @hoch would like to discuss in the WG. I think that is where we are now.

-- 
GitHub Notification of comment by domenic
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/380#issuecomment-294923775 using your GitHub account

Received on Tuesday, 18 April 2017 17:42:04 UTC