RESOLVED FIXED Bug 233719
[WK2] Make Web Lock API work across multiple WebProcesses
https://bugs.webkit.org/show_bug.cgi?id=233719
Summary [WK2] Make Web Lock API work across multiple WebProcesses
Chris Dumez
Reported 2021-12-01 13:07:30 PST
Make Web Lock API work across multiple WebProcesses when using modern WebKit.
Attachments
WIP Patch (93.15 KB, patch)
2021-12-01 13:44 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (119.25 KB, patch)
2021-12-01 15:16 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (119.34 KB, patch)
2021-12-01 15:27 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (119.37 KB, patch)
2021-12-01 15:42 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (119.88 KB, patch)
2021-12-01 16:11 PST, Chris Dumez
no flags
Patch (119.91 KB, patch)
2021-12-01 16:14 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (120.63 KB, patch)
2021-12-01 16:51 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (120.63 KB, patch)
2021-12-01 17:32 PST, Chris Dumez
no flags
Patch (120.66 KB, patch)
2021-12-01 21:34 PST, Chris Dumez
no flags
Patch (121.23 KB, patch)
2021-12-01 21:46 PST, Chris Dumez
no flags
Patch (122.49 KB, patch)
2021-12-02 09:29 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (122.48 KB, patch)
2021-12-02 10:25 PST, Chris Dumez
no flags
Patch (123.18 KB, patch)
2021-12-02 12:46 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2021-12-01 13:44:40 PST
Created attachment 445610 [details] WIP Patch
Chris Dumez
Comment 2 2021-12-01 15:16:58 PST
Chris Dumez
Comment 3 2021-12-01 15:27:56 PST
Chris Dumez
Comment 4 2021-12-01 15:42:41 PST
Chris Dumez
Comment 5 2021-12-01 16:11:38 PST
Chris Dumez
Comment 6 2021-12-01 16:14:23 PST
Chris Dumez
Comment 7 2021-12-01 16:51:29 PST
Chris Dumez
Comment 8 2021-12-01 17:32:28 PST
Chris Dumez
Comment 9 2021-12-01 21:34:52 PST
Chris Dumez
Comment 10 2021-12-01 21:46:51 PST
Alex Christensen
Comment 11 2021-12-02 08:18:03 PST
Comment on attachment 445670 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=445670&action=review Would it be worth adding a test using _relatedWebView to verify what happens when you have two pages in the same process? > Source/WebCore/Modules/web-locks/WebLockRegistry.h:76 > + HashMap<ClientOrigin, PerOriginRegistry*> m_perOriginRegistries; Can this be a weak pointer? > Source/WebKit/WebProcess/WebCoreSupport/RemoteWebLockRegistry.messages.in:28 > + DidCompleteLockRequest(WebCore::WebLockIdentifier lockIdentifier, WebCore::ScriptExecutionContextIdentifier clientID, bool success); > + DidStealLock(WebCore::WebLockIdentifier lockIdentifier, WebCore::ScriptExecutionContextIdentifier clientID); It seems like this can be a completion handler on the RequestLock message that just contains whether it was success, failure, or stolen. That would be nicer than introducing a new messages.in just for replies.
Chris Dumez
Comment 12 2021-12-02 08:34:14 PST
(In reply to Alex Christensen from comment #11) > Comment on attachment 445670 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=445670&action=review > > Would it be worth adding a test using _relatedWebView to verify what happens > when you have two pages in the same process? > > > Source/WebCore/Modules/web-locks/WebLockRegistry.h:76 > > + HashMap<ClientOrigin, PerOriginRegistry*> m_perOriginRegistries; > > Can this be a weak pointer? It can. It is not strictly needed but it is always better to be safe. I'll make the change. > > > Source/WebKit/WebProcess/WebCoreSupport/RemoteWebLockRegistry.messages.in:28 > > + DidCompleteLockRequest(WebCore::WebLockIdentifier lockIdentifier, WebCore::ScriptExecutionContextIdentifier clientID, bool success); > > + DidStealLock(WebCore::WebLockIdentifier lockIdentifier, WebCore::ScriptExecutionContextIdentifier clientID); > > It seems like this can be a completion handler on the RequestLock message > that just contains whether it was success, failure, or stolen. That would > be nicer than introducing a new messages.in just for replies. There are several issues with that: 1. It could get called twice: once with success because we got the lock and a second time later on because our lock got stolen. 2. It may not get called at all (request may get aborted before it is processed) Both are really compatible with CompletionHandler and this is why the API currently uses 2 Functions.
Chris Dumez
Comment 13 2021-12-02 09:29:46 PST
Chris Dumez
Comment 14 2021-12-02 10:25:36 PST
Chris Dumez
Comment 15 2021-12-02 12:46:58 PST
EWS
Comment 16 2021-12-02 14:59:47 PST
Committed r286455 (244797@main): <https://commits.webkit.org/244797@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 445763 [details].
Radar WebKit Bug Importer
Comment 17 2021-12-02 15:00:39 PST
Note You need to log in before you can comment on or make changes to this bug.