Bug 230181

Summary: [WK2] Reduce amount of IPC needed by BroadcastChannel
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKit2Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, beidson, darin, esprehn+autocc, ews-watchlist, ggaren, kangil.han, kkinnunen, sam, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 161472, 228089    
Attachments:
Description Flags
WIP patch
none
Patch
none
Patch
none
Patch none

Description Chris Dumez 2021-09-10 16:50:51 PDT
Avoid doing IPC for BroadcastChannel when the destination is within the same process.
Comment 1 Chris Dumez 2021-09-10 16:56:47 PDT
Created attachment 437925 [details]
WIP patch
Comment 2 Chris Dumez 2021-09-11 00:05:24 PDT
Created attachment 437943 [details]
Patch
Comment 3 Chris Dumez 2021-09-11 09:16:57 PDT
Created attachment 437953 [details]
Patch
Comment 4 Alex Christensen 2021-09-13 13:14:22 PDT
Comment on attachment 437953 [details]
Patch

I'm assuming this already handles the case where a process crashes, right?
Comment 5 Chris Dumez 2021-09-13 13:17:34 PDT
(In reply to Alex Christensen from comment #4)
> Comment on attachment 437953 [details]
> Patch
> 
> I'm assuming this already handles the case where a process crashes, right?

No, we don't currently have good handling for network process crashes, meaning that the BroadcastChannelRegistry doesn't get repopulated after a network process relaunch. This is something we should improve but:
1. I don't think it is made worse by this patch (if anything it is better because messaging between BroadcastChannels inside the same WebProcess will still work after a network process relaunch).
2. I suspect we have issues for MessagePort.
Comment 6 Chris Dumez 2021-09-13 16:10:14 PDT
Created attachment 438086 [details]
Patch
Comment 7 Chris Dumez 2021-09-13 16:27:25 PDT
(In reply to Alex Christensen from comment #4)
> Comment on attachment 437953 [details]
> Patch
> 
> I'm assuming this already handles the case where a process crashes, right?

I filed Bug 230236 to track this issue. Will fix in a follow-up.
Comment 8 EWS 2021-09-13 21:15:50 PDT
Committed r282377 (241639@main): <https://commits.webkit.org/241639@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 438086 [details].
Comment 9 Radar WebKit Bug Importer 2021-09-13 21:16:17 PDT
<rdar://problem/83086565>