- Revision
- 255909
- Author
- [email protected]
- Date
- 2020-02-06 00:07:06 -0800 (Thu, 06 Feb 2020)
Log Message
ServiceWorkerProvider::registerServiceWorkerClients is no longer needed
https://bugs.webkit.org/show_bug.cgi?id=207193
Reviewed by Chris Dumez.
Source/WebCore:
registerServiceWorkerClients is no longer needed since we moved service worker handling to network process.
We no longer have to optimize creating a sw server connection since we piggy back on the webprocess to network process connection.
As can be seen from DocumentLoader, we register service worker clients in DocumentLoader::commitData.
The only documents we do not register are documents for which we exit early due to creatingInitialEmptyDocument check.
registerServiceWorkerClients was used initially when starting the first service worker process.
This is obsolete since now we split service workers according sessionID and registrable domains.
No observable change of behavior if network process does not crash.
Covered by existing service worker tests crashing network process in the middle of processing.
* workers/service/SWClientConnection.cpp:
(WebCore::SWClientConnection::registerServiceWorkerClients):
* workers/service/SWClientConnection.h:
* workers/service/ServiceWorkerProvider.cpp:
* workers/service/ServiceWorkerProvider.h:
Source/WebKit:
Remove the request from WebProcessPool to register all service worker clients at launch of the first service worker process.
This is no longer needed and does not scale since our service workers are launched in different processes nowadays.
In case network process crashes, WebProcess will need to reregister their service worker clients.
This is lazily done when WebProcess tries to reconnect to the Network Process.
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::ensureNetworkProcessConnection):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (255908 => 255909)
--- trunk/Source/WebCore/ChangeLog 2020-02-06 07:00:37 UTC (rev 255908)
+++ trunk/Source/WebCore/ChangeLog 2020-02-06 08:07:06 UTC (rev 255909)
@@ -1,3 +1,28 @@
+2020-02-06 youenn fablet <[email protected]>
+
+ ServiceWorkerProvider::registerServiceWorkerClients is no longer needed
+ https://bugs.webkit.org/show_bug.cgi?id=207193
+
+ Reviewed by Chris Dumez.
+
+ registerServiceWorkerClients is no longer needed since we moved service worker handling to network process.
+ We no longer have to optimize creating a sw server connection since we piggy back on the webprocess to network process connection.
+
+ As can be seen from DocumentLoader, we register service worker clients in DocumentLoader::commitData.
+ The only documents we do not register are documents for which we exit early due to creatingInitialEmptyDocument check.
+
+ registerServiceWorkerClients was used initially when starting the first service worker process.
+ This is obsolete since now we split service workers according sessionID and registrable domains.
+
+ No observable change of behavior if network process does not crash.
+ Covered by existing service worker tests crashing network process in the middle of processing.
+
+ * workers/service/SWClientConnection.cpp:
+ (WebCore::SWClientConnection::registerServiceWorkerClients):
+ * workers/service/SWClientConnection.h:
+ * workers/service/ServiceWorkerProvider.cpp:
+ * workers/service/ServiceWorkerProvider.h:
+
2020-02-05 David Kilzer <[email protected]>
Crash when printing at WebCore: WebCore::FrameView::paintContents
Modified: trunk/Source/WebCore/workers/service/SWClientConnection.cpp (255908 => 255909)
--- trunk/Source/WebCore/workers/service/SWClientConnection.cpp 2020-02-06 07:00:37 UTC (rev 255908)
+++ trunk/Source/WebCore/workers/service/SWClientConnection.cpp 2020-02-06 08:07:06 UTC (rev 255909)
@@ -263,6 +263,14 @@
}
}
+void SWClientConnection::registerServiceWorkerClients()
+{
+ for (auto* document : Document::allDocuments()) {
+ auto controllingServiceWorkerRegistrationIdentifier = document->activeServiceWorker() ? makeOptional<ServiceWorkerRegistrationIdentifier>(document->activeServiceWorker()->registrationIdentifier()) : WTF::nullopt;
+ registerServiceWorkerClient(document->topOrigin(), ServiceWorkerClientData::from(*document, *this), controllingServiceWorkerRegistrationIdentifier, document->userAgent(document->url()));
+ }
+}
+
} // namespace WebCore
#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebCore/workers/service/SWClientConnection.h (255908 => 255909)
--- trunk/Source/WebCore/workers/service/SWClientConnection.h 2020-02-06 07:00:37 UTC (rev 255908)
+++ trunk/Source/WebCore/workers/service/SWClientConnection.h 2020-02-06 08:07:06 UTC (rev 255909)
@@ -87,6 +87,8 @@
virtual void storeRegistrationsOnDiskForTesting(CompletionHandler<void()>&& callback) { callback(); }
virtual void isServiceWorkerRunning(ServiceWorkerIdentifier, CompletionHandler<void(bool)>&& callback) { callback(false); }
+ WEBCORE_EXPORT void registerServiceWorkerClients();
+
protected:
WEBCORE_EXPORT SWClientConnection();
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerProvider.cpp (255908 => 255909)
--- trunk/Source/WebCore/workers/service/ServiceWorkerProvider.cpp 2020-02-06 07:00:37 UTC (rev 255908)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerProvider.cpp 2020-02-06 08:07:06 UTC (rev 255909)
@@ -55,17 +55,6 @@
sharedProvider = &newProvider;
}
-void ServiceWorkerProvider::registerServiceWorkerClients()
-{
- setMayHaveRegisteredServiceWorkers();
- for (auto* document : Document::allDocuments()) {
- if (!document->page() || document->page()->mainFrame().loader().client().isServiceWorkerFrameLoaderClient())
- continue;
- if (LegacySchemeRegistry::canServiceWorkersHandleURLScheme(document->url().protocol().toStringWithoutCopying()))
- document->setServiceWorkerConnection(&serviceWorkerConnection());
- }
-}
-
} // namespace WebCore
#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerProvider.h (255908 => 255909)
--- trunk/Source/WebCore/workers/service/ServiceWorkerProvider.h 2020-02-06 07:00:37 UTC (rev 255908)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerProvider.h 2020-02-06 08:07:06 UTC (rev 255909)
@@ -42,8 +42,6 @@
virtual SWClientConnection& serviceWorkerConnection() = 0;
- void registerServiceWorkerClients();
-
void setMayHaveRegisteredServiceWorkers() { m_mayHaveRegisteredServiceWorkers = true; }
private:
Modified: trunk/Source/WebKit/ChangeLog (255908 => 255909)
--- trunk/Source/WebKit/ChangeLog 2020-02-06 07:00:37 UTC (rev 255908)
+++ trunk/Source/WebKit/ChangeLog 2020-02-06 08:07:06 UTC (rev 255909)
@@ -1,3 +1,23 @@
+2020-02-06 youenn fablet <[email protected]>
+
+ ServiceWorkerProvider::registerServiceWorkerClients is no longer needed
+ https://bugs.webkit.org/show_bug.cgi?id=207193
+
+ Reviewed by Chris Dumez.
+
+ Remove the request from WebProcessPool to register all service worker clients at launch of the first service worker process.
+ This is no longer needed and does not scale since our service workers are launched in different processes nowadays.
+
+ In case network process crashes, WebProcess will need to reregister their service worker clients.
+ This is lazily done when WebProcess tries to reconnect to the Network Process.
+
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::ensureNetworkProcessConnection):
+ * WebProcess/WebProcess.h:
+ * WebProcess/WebProcess.messages.in:
+
2020-02-05 Wenson Hsieh <[email protected]>
[iOS] Provide a way to suppress software keyboards on WKWebView's WKContentView
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (255908 => 255909)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2020-02-06 07:00:37 UTC (rev 255908)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2020-02-06 08:07:06 UTC (rev 255909)
@@ -756,9 +756,6 @@
return;
}
- if (m_serviceWorkerProcesses.isEmpty())
- sendToAllProcesses(Messages::WebProcess::RegisterServiceWorkerClients { });
-
WebProcessProxy* serviceWorkerProcessProxy { nullptr };
if (!m_useSeparateServiceWorkerProcess) {
for (auto& process : m_processes) {
Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (255908 => 255909)
--- trunk/Source/WebKit/WebProcess/WebProcess.cpp 2020-02-06 07:00:37 UTC (rev 255908)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp 2020-02-06 08:07:06 UTC (rev 255909)
@@ -70,6 +70,7 @@
#include "WebProcessPoolMessages.h"
#include "WebProcessProxyMessages.h"
#include "WebResourceLoadObserver.h"
+#include "WebSWClientConnection.h"
#include "WebSWContextManagerConnection.h"
#include "WebSWContextManagerConnectionMessages.h"
#include "WebServiceWorkerProvider.h"
@@ -1202,6 +1203,11 @@
m_networkProcessConnection->setNetworkProcessAuditToken(WTFMove(connectionInfo.auditToken));
#endif
m_networkProcessConnection->connection().send(Messages::NetworkConnectionToWebProcess::RegisterURLSchemesAsCORSEnabled(WebCore::LegacySchemeRegistry::allURLSchemesRegisteredAsCORSEnabled()), 0);
+
+#if ENABLE(SERVICE_WORKER)
+ if (!Document::allDocuments().isEmpty())
+ m_networkProcessConnection->serviceWorkerConnection().registerServiceWorkerClients();
+#endif
}
return *m_networkProcessConnection;
@@ -1860,11 +1866,6 @@
SWContextManager::singleton().connection()->establishConnection(WTFMove(completionHandler));
}
-void WebProcess::registerServiceWorkerClients()
-{
- ServiceWorkerProvider::singleton().registerServiceWorkerClients();
-}
-
void WebProcess::addServiceWorkerRegistration(WebCore::ServiceWorkerRegistrationIdentifier identifier)
{
m_swRegistrationCounts.add(identifier);
Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (255908 => 255909)
--- trunk/Source/WebKit/WebProcess/WebProcess.h 2020-02-06 07:00:37 UTC (rev 255908)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h 2020-02-06 08:07:06 UTC (rev 255909)
@@ -405,7 +405,6 @@
#if ENABLE(SERVICE_WORKER)
void establishWorkerContextConnectionToNetworkProcess(uint64_t pageGroupID, WebPageProxyIdentifier, WebCore::PageIdentifier, const WebPreferencesStore&, WebCore::RegistrableDomain&&, ServiceWorkerInitializationData&&, CompletionHandler<void()>&&);
- void registerServiceWorkerClients();
#endif
void fetchWebsiteData(OptionSet<WebsiteDataType>, CompletionHandler<void(WebsiteData&&)>&&);
Modified: trunk/Source/WebKit/WebProcess/WebProcess.messages.in (255908 => 255909)
--- trunk/Source/WebKit/WebProcess/WebProcess.messages.in 2020-02-06 07:00:37 UTC (rev 255908)
+++ trunk/Source/WebKit/WebProcess/WebProcess.messages.in 2020-02-06 08:07:06 UTC (rev 255909)
@@ -107,7 +107,6 @@
#if ENABLE(SERVICE_WORKER)
EstablishWorkerContextConnectionToNetworkProcess(uint64_t pageGroupID, WebKit::WebPageProxyIdentifier webPageProxyID, WebCore::PageIdentifier pageID, struct WebKit::WebPreferencesStore store, WebCore::RegistrableDomain domain, struct WebKit::ServiceWorkerInitializationData initializationData) -> () Async
- RegisterServiceWorkerClients()
#endif
SetHasSuspendedPageProxy(bool hasSuspendedPageProxy);