Open kenchris opened 5 years ago
This was related to the feedback given in w3ctag/design-reviews#277. I think the issue there was that specs that can be used on multiple threads ought to describe what their model for threadsafety is (e.g., exclusive access to what, at what points).
I am with you on that @dbaron but it also affects other things, like today Bluetooth and USB devices are requested which pops up a dialog and you get access to a handle. With sensors, you construct them and there are currently no permission prompt
@reillyeon @anssik
We discussed on breakout 31-march and agreed to put it on the back burner for now.
I'm a bit skeptical about the design choices made in w3ctag/design-reviews#277.
The pattern here is unique to this use-case, and it's unclear how it works with regard to using the device from both the worker and the main thread since there is no explicit ownership transfer. It feels like our recommendation should be around the pattern that transferable streams uses, which transfers the entire object over postMessage, at which point the object on the main thread is considered dead as the ownership has been transferred over to the worker. Whether or not this is technically possible given the underlying implementation details is something we should solicit implementer feedback on though.
If this sounds reasonable I can draft up something.
Permission and choosing devices happens on the main thread so in order to work with these "objects" on a dedicated worker, the access somehow has to be handed over.
Document the best way of doing this