Bug 203410 - WebProcess should unregister its interest for a SWServerRegistration when all its corresponding ServiceWorkerRegistrations are destroyed
Summary: WebProcess should unregister its interest for a SWServerRegistration when all...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Service Workers (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
: 203218 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-10-25 07:22 PDT by youenn fablet
Modified: 2019-10-25 12:04 PDT (History)
6 users (show)

See Also:


Attachments
Patch (8.40 KB, patch)
2019-10-25 07:28 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (8.39 KB, patch)
2019-10-25 07:35 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (8.50 KB, patch)
2019-10-25 08:06 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (8.48 KB, patch)
2019-10-25 08:51 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2019-10-25 07:22:42 PDT
WebProcess should unregister its interest for a SWServerRegistration when all its corresponding ServiceWorkerRegistrations are destroyed
Comment 1 youenn fablet 2019-10-25 07:28:07 PDT
Created attachment 381913 [details]
Patch
Comment 2 youenn fablet 2019-10-25 07:30:02 PDT
*** Bug 203218 has been marked as a duplicate of this bug. ***
Comment 3 youenn fablet 2019-10-25 07:30:38 PDT
<rdar://problem/56480245>
Comment 4 youenn fablet 2019-10-25 07:35:08 PDT
Created attachment 381914 [details]
Patch
Comment 5 youenn fablet 2019-10-25 08:06:55 PDT
Created attachment 381923 [details]
Patch
Comment 6 Chris Dumez 2019-10-25 08:14:37 PDT
Comment on attachment 381923 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=381923&action=review

> Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp:89
>      send(Messages::WebSWServerConnection::AddServiceWorkerRegistrationInServer { identifier });

Why do we send unconditionally and and not when going from 0 to 1?

> Source/WebKit/WebProcess/WebProcess.cpp:1765
> +bool WebProcess::decrementServiceWorkerRegistrationCount(WebCore::ServiceWorkerRegistrationIdentifier identifier)

It is unclear from the name what the returned boolean means. I think it should be factored differently.

> Source/WebKit/WebProcess/WebProcess.h:585
> +    HashMap<WebCore::ServiceWorkerRegistrationIdentifier, size_t> m_swRegistrationCounts;

Seems like a perfect use case for a HashCountedSet?
Comment 7 youenn fablet 2019-10-25 08:37:13 PDT
> > Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp:89
> >      send(Messages::WebSWServerConnection::AddServiceWorkerRegistrationInServer { identifier });
> 
> Why do we send unconditionally and and not when going from 0 to 1?

I preferred not doing that because we probably have an issue in case of network process crash where we should reregister them.
Currently, we keep the status quo which gives a chance for a reload to fix the issue.
Once we update the code to handle network process crash, we should indeed do that.

> > Source/WebKit/WebProcess/WebProcess.h:585
> > +    HashMap<WebCore::ServiceWorkerRegistrationIdentifier, size_t> m_swRegistrationCounts;
> 
> Seems like a perfect use case for a HashCountedSet?

OK, will do.
Comment 8 youenn fablet 2019-10-25 08:51:46 PDT
Created attachment 381927 [details]
Patch
Comment 9 Chris Dumez 2019-10-25 08:56:31 PDT
Comment on attachment 381927 [details]
Patch

r=me.
Comment 10 WebKit Commit Bot 2019-10-25 12:04:35 PDT
Comment on attachment 381927 [details]
Patch

Clearing flags on attachment: 381927

Committed r251598: <https://trac.webkit.org/changeset/251598>
Comment 11 WebKit Commit Bot 2019-10-25 12:04:36 PDT
All reviewed patches have been landed.  Closing bug.