RESOLVED WONTFIX 220627
[WK2] Bypass NetworkProcess for MessagePort communication within a single WebProcess
https://bugs.webkit.org/show_bug.cgi?id=220627
Summary [WK2] Bypass NetworkProcess for MessagePort communication within a single Web...
Chris Dumez
Reported 2021-01-14 11:46:43 PST
Bypass NetworkProcess for MessagePort communication within a single WebProcess. When the 2 MessagePorts are within the same WebProcess, there is no reason to go via the NetworkProcess to do the communication. Doing so is bad for performance and also loses functionality because SerializedScriptValue is not able to encode everything over IPC (e.g. Wasm modules, see Bug 220038).
Attachments
WIP Patch (10.76 KB, patch)
2021-01-14 11:48 PST, Chris Dumez
no flags
Patch (14.80 KB, patch)
2021-01-14 11:53 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (15.33 KB, patch)
2021-01-14 12:06 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2021-01-14 11:48:19 PST
Created attachment 417635 [details] WIP Patch
Chris Dumez
Comment 2 2021-01-14 11:53:21 PST
Chris Dumez
Comment 3 2021-01-14 12:06:58 PST
Chris Dumez
Comment 4 2021-01-14 13:25:28 PST
Comment on attachment 417639 [details] Patch Sadly, this is not as easy as it looks. Current patch breaks cross-process communication (used by service workers). A given WebProcess does not seem to know if its remote MessagePort is within its process or not.
Chris Dumez
Comment 5 2021-01-14 16:50:44 PST
I tried a different approach but it is tricky. At the time a message is posted, we may not know yet if the destination MessagePort will be in the same WebProcess or not. You can send a MessagePort to a worker and call postMessage() on this MessagePort, before the Worker has received the port (so before entanglement has happened). Entanglement is when we know if both ends of the channel are in the same process.
Note You need to log in before you can comment on or make changes to this bug.