- Revision
- 230500
- Author
- cdu...@apple.com
- Date
- 2018-04-10 16:19:53 -0700 (Tue, 10 Apr 2018)
Log Message
Avoid constructing a service worker RegistrationStore for private sessions
https://bugs.webkit.org/show_bug.cgi?id=184463
<rdar://problem/36613948>
Reviewed by Youenn Fablet.
Avoid constructing a service worker RegistrationStore for private sessions since there
is no need for persistence and the registrationDatabaseDirectory is the empty string in
such cases.
Source/WebCore:
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::removeRegistration):
(WebCore::SWServer::clearAll):
(WebCore::SWServer::clear):
(WebCore::SWServer::SWServer):
(WebCore::SWServer::didFinishActivation):
* workers/service/server/SWServer.h:
Source/WebKit:
* StorageProcess/StorageProcess.cpp:
(WebKit::StorageProcess::initializeWebsiteDataStore):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (230499 => 230500)
--- trunk/Source/WebCore/ChangeLog 2018-04-10 23:06:05 UTC (rev 230499)
+++ trunk/Source/WebCore/ChangeLog 2018-04-10 23:19:53 UTC (rev 230500)
@@ -1,5 +1,25 @@
2018-04-10 Chris Dumez <cdu...@apple.com>
+ Avoid constructing a service worker RegistrationStore for private sessions
+ https://bugs.webkit.org/show_bug.cgi?id=184463
+ <rdar://problem/36613948>
+
+ Reviewed by Youenn Fablet.
+
+ Avoid constructing a service worker RegistrationStore for private sessions since there
+ is no need for persistence and the registrationDatabaseDirectory is the empty string in
+ such cases.
+
+ * workers/service/server/SWServer.cpp:
+ (WebCore::SWServer::removeRegistration):
+ (WebCore::SWServer::clearAll):
+ (WebCore::SWServer::clear):
+ (WebCore::SWServer::SWServer):
+ (WebCore::SWServer::didFinishActivation):
+ * workers/service/server/SWServer.h:
+
+2018-04-10 Chris Dumez <cdu...@apple.com>
+
Unreviewed build fix.
* page/LayoutContext.cpp:
Modified: trunk/Source/WebCore/workers/service/server/SWServer.cpp (230499 => 230500)
--- trunk/Source/WebCore/workers/service/server/SWServer.cpp 2018-04-10 23:06:05 UTC (rev 230499)
+++ trunk/Source/WebCore/workers/service/server/SWServer.cpp 2018-04-10 23:19:53 UTC (rev 230500)
@@ -165,7 +165,8 @@
ASSERT_UNUSED(wasRemoved, wasRemoved);
m_originStore->remove(topOrigin);
- m_registrationStore.removeRegistration(*registration);
+ if (m_registrationStore)
+ m_registrationStore->removeRegistration(*registration);
}
Vector<ServiceWorkerRegistrationData> SWServer::getRegistrations(const SecurityOriginData& topOrigin, const URL& clientURL)
@@ -202,7 +203,8 @@
ASSERT(m_registrationsByID.isEmpty());
m_pendingContextDatas.clear();
m_originStore->clearAll();
- m_registrationStore.clearAll(WTFMove(completionHandler));
+ if (m_registrationStore)
+ m_registrationStore->clearAll(WTFMove(completionHandler));
}
void SWServer::clear(const SecurityOriginData& securityOrigin, CompletionHandler<void()>&& completionHandler)
@@ -240,7 +242,8 @@
for (auto* registration : registrationsToRemove)
registration->clear();
- m_registrationStore.flushChanges(WTFMove(completionHandler));
+ if (m_registrationStore)
+ m_registrationStore->flushChanges(WTFMove(completionHandler));
}
void SWServer::Connection::finishFetchingScriptInServer(const ServiceWorkerFetchResult& result)
@@ -271,9 +274,14 @@
SWServer::SWServer(UniqueRef<SWOriginStore>&& originStore, String&& registrationDatabaseDirectory, PAL::SessionID sessionID)
: m_originStore(WTFMove(originStore))
- , m_registrationStore(*this, WTFMove(registrationDatabaseDirectory))
, m_sessionID(sessionID)
{
+ ASSERT(!registrationDatabaseDirectory.isEmpty() || m_sessionID.isEphemeral());
+ if (!m_sessionID.isEphemeral())
+ m_registrationStore = std::make_unique<RegistrationStore>(*this, WTFMove(registrationDatabaseDirectory));
+ else
+ registrationStoreImportComplete();
+
UNUSED_PARAM(registrationDatabaseDirectory);
allServers().add(this);
}
@@ -406,7 +414,8 @@
if (!registration)
return;
- m_registrationStore.updateRegistration(worker.contextData());
+ if (m_registrationStore)
+ m_registrationStore->updateRegistration(worker.contextData());
registration->didFinishActivation(worker.identifier());
}
Modified: trunk/Source/WebCore/workers/service/server/SWServer.h (230499 => 230500)
--- trunk/Source/WebCore/workers/service/server/SWServer.h 2018-04-10 23:06:05 UTC (rev 230499)
+++ trunk/Source/WebCore/workers/service/server/SWServer.h 2018-04-10 23:19:53 UTC (rev 230500)
@@ -29,7 +29,6 @@
#include "ClientOrigin.h"
#include "DocumentIdentifier.h"
-#include "RegistrationStore.h"
#include "SWServerWorker.h"
#include "SecurityOriginData.h"
#include "ServiceWorkerClientData.h"
@@ -49,6 +48,7 @@
namespace WebCore {
+class RegistrationStore;
class SWOriginStore;
class SWServerJobQueue;
class SWServerRegistration;
@@ -228,7 +228,7 @@
HashMap<ServiceWorkerClientIdentifier, ServiceWorkerRegistrationIdentifier> m_clientToControllingRegistration;
UniqueRef<SWOriginStore> m_originStore;
- RegistrationStore m_registrationStore;
+ std::unique_ptr<RegistrationStore> m_registrationStore;
HashMap<SecurityOriginData, Vector<ServiceWorkerContextData>> m_pendingContextDatas;
HashMap<SecurityOriginData, HashMap<ServiceWorkerIdentifier, Vector<RunServiceWorkerCallback>>> m_serviceWorkerRunRequests;
PAL::SessionID m_sessionID;
Modified: trunk/Source/WebCore/workers/service/server/SWServerWorker.h (230499 => 230500)
--- trunk/Source/WebCore/workers/service/server/SWServerWorker.h 2018-04-10 23:06:05 UTC (rev 230499)
+++ trunk/Source/WebCore/workers/service/server/SWServerWorker.h 2018-04-10 23:19:53 UTC (rev 230500)
@@ -27,6 +27,7 @@
#if ENABLE(SERVICE_WORKER)
+#include "ContentSecurityPolicyResponseHeaders.h"
#include "ServiceWorkerClientData.h"
#include "ServiceWorkerData.h"
#include "ServiceWorkerIdentifier.h"
Modified: trunk/Source/WebKit/ChangeLog (230499 => 230500)
--- trunk/Source/WebKit/ChangeLog 2018-04-10 23:06:05 UTC (rev 230499)
+++ trunk/Source/WebKit/ChangeLog 2018-04-10 23:19:53 UTC (rev 230500)
@@ -1,3 +1,18 @@
+2018-04-10 Chris Dumez <cdu...@apple.com>
+
+ Avoid constructing a service worker RegistrationStore for private sessions
+ https://bugs.webkit.org/show_bug.cgi?id=184463
+ <rdar://problem/36613948>
+
+ Reviewed by Youenn Fablet.
+
+ Avoid constructing a service worker RegistrationStore for private sessions since there
+ is no need for persistence and the registrationDatabaseDirectory is the empty string in
+ such cases.
+
+ * StorageProcess/StorageProcess.cpp:
+ (WebKit::StorageProcess::initializeWebsiteDataStore):
+
2018-04-10 Andy Estes <aes...@apple.com>
[iOS] Navigate to URL and page number annotations in WKPDFView
Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.cpp (230499 => 230500)
--- trunk/Source/WebKit/StorageProcess/StorageProcess.cpp 2018-04-10 23:06:05 UTC (rev 230499)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.cpp 2018-04-10 23:19:53 UTC (rev 230500)
@@ -194,7 +194,8 @@
});
if (addResult.isNewEntry) {
SandboxExtension::consumePermanently(parameters.indexedDatabaseDirectoryExtensionHandle);
- postStorageTask(createCrossThreadTask(*this, &StorageProcess::ensurePathExists, parameters.indexedDatabaseDirectory));
+ if (!parameters.indexedDatabaseDirectory.isEmpty())
+ postStorageTask(createCrossThreadTask(*this, &StorageProcess::ensurePathExists, parameters.indexedDatabaseDirectory));
}
#endif
#if ENABLE(SERVICE_WORKER)
@@ -206,7 +207,8 @@
});
if (addResult.isNewEntry) {
SandboxExtension::consumePermanently(parameters.serviceWorkerRegistrationDirectoryExtensionHandle);
- postStorageTask(createCrossThreadTask(*this, &StorageProcess::ensurePathExists, parameters.serviceWorkerRegistrationDirectory));
+ if (!parameters.serviceWorkerRegistrationDirectory.isEmpty())
+ postStorageTask(createCrossThreadTask(*this, &StorageProcess::ensurePathExists, parameters.serviceWorkerRegistrationDirectory));
}
for (auto& scheme : parameters.urlSchemesServiceWorkersCanHandle)