Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Transferable for OffscreenCanvas #24276

Open
gterzian opened this issue Sep 24, 2019 · 0 comments
Open

Implement Transferable for OffscreenCanvas #24276

gterzian opened this issue Sep 24, 2019 · 0 comments

Comments

@gterzian
Copy link
Member

@gterzian gterzian commented Sep 24, 2019

Spec:

A first implementation of Transferable is currently being done as part of #23637, and that PR introduces a trait and some plumbing in structuredclone to facilitate this.

Implementing this for OffscreenCanvas is likely to involve splitting up the DOM object from some transferable data backing it, as is being done for messageport in the form of MessagePort and MessagePortImpl, with the latter being a non-DOM managed object that is serde serializable, making the transfer across realms basically involve sending the MessagePortImpl inside an IPC message, with some minimal integration with the JS_ReadStructuredClone and JS_WriteStructuredClone SpiderMonkey operations.

Note that the non-DOM managed object doesn't have to be serialiable, and in the case of OffscreenCanvas it probably doesn't have to be since the use case is transferring into a dedicated worker, which will by definition be in the same-process as the window event-loop where the canvas is found. So in such case it would only have to be Send, and basically be moved into the worker realm via a threaded message(We implement the implicit port of dedicated worker as a "normal" threaded channel, not an actual MessagePort).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.