Unreviewed, rolling out r225864.
authorjlewis3@apple.com <jlewis3@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Dec 2017 23:58:37 +0000 (23:58 +0000)
committerjlewis3@apple.com <jlewis3@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Dec 2017 23:58:37 +0000 (23:58 +0000)
This caused the Layout test step to crash out on Debug testers

Reverted changeset:

"REGRESSION (r225789): API tests
WKProcessPool.InitialWarmedProcessUsed and
WebKit.WebsiteDataStoreCustomPaths are failing."
https://bugs.webkit.org/show_bug.cgi?id=180722
https://trac.webkit.org/changeset/225864

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225877 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
Source/WebKit/ChangeLog
Source/WebKit/StorageProcess/StorageProcess.cpp
Source/WebKit/StorageProcess/StorageProcess.h
Source/WebKit/StorageProcess/StorageToWebProcessConnection.cpp
Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
Source/WebKit/UIProcess/Storage/StorageProcessProxy.cpp
Source/WebKit/UIProcess/Storage/StorageProcessProxy.h
Source/WebKit/UIProcess/Storage/StorageProcessProxy.messages.in
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/InitialWarmedProcessUsed.mm

index 59bf707..3ea1ba4 100644 (file)
@@ -1,3 +1,17 @@
+2017-12-13  Matt Lewis  <jlewis3@apple.com>
+
+        Unreviewed, rolling out r225864.
+
+        This caused the Layout test step to crash out on Debug testers
+
+        Reverted changeset:
+
+        "REGRESSION (r225789): API tests
+        WKProcessPool.InitialWarmedProcessUsed and
+        WebKit.WebsiteDataStoreCustomPaths are failing."
+        https://bugs.webkit.org/show_bug.cgi?id=180722
+        https://trac.webkit.org/changeset/225864
+
 2017-12-13  Brady Eidson  <beidson@apple.com>
 
         REGRESSION (r225789): API tests WKProcessPool.InitialWarmedProcessUsed and WebKit.WebsiteDataStoreCustomPaths are failing.
index be11328..ed7d650 100644 (file)
@@ -111,7 +111,7 @@ void StorageProcess::connectionToContextProcessWasClosed()
         swServer->markAllWorkersAsTerminated();
 
     if (shouldRelaunch)
-        createServerToContextConnection(std::nullopt);
+        createServerToContextConnection();
 }
 
 // The rule is that we need a context process (and a connection to it) as long as we have SWServerConnections to regular WebProcesses.
@@ -427,16 +427,13 @@ WebSWServerToContextConnection* StorageProcess::globalServerToContextConnection(
     return m_serverToContextConnection.get();
 }
 
-void StorageProcess::createServerToContextConnection(std::optional<PAL::SessionID> sessionID)
+void StorageProcess::createServerToContextConnection()
 {
     if (m_waitingForServerToContextProcessConnection)
         return;
     
     m_waitingForServerToContextProcessConnection = true;
-    if (sessionID)
-        parentProcessConnection()->send(Messages::StorageProcessProxy::EstablishWorkerContextConnectionToStorageProcessForExplicitSession(*sessionID), 0);
-    else
-        parentProcessConnection()->send(Messages::StorageProcessProxy::EstablishWorkerContextConnectionToStorageProcess(), 0);
+    parentProcessConnection()->send(Messages::StorageProcessProxy::EstablishWorkerContextConnectionToStorageProcess(), 0);
 }
 
 void StorageProcess::didFailFetch(SWServerConnectionIdentifier serverConnectionIdentifier, uint64_t fetchIdentifier)
index 8ec67ce..3482e74 100644 (file)
@@ -89,7 +89,7 @@ public:
     // For now we just have one global connection to service worker context processes.
     // This will change in the future.
     WebSWServerToContextConnection* globalServerToContextConnection();
-    void createServerToContextConnection(std::optional<PAL::SessionID>);
+    void createServerToContextConnection();
 
     WebCore::SWServer& swServerForSession(PAL::SessionID);
     void registerSWServerConnection(WebSWServerConnection&);
index 4670828..3282a34 100644 (file)
@@ -171,7 +171,7 @@ void StorageToWebProcessConnection::establishSWServerConnection(SessionID sessio
     ASSERT_UNUSED(addResult, addResult.isNewEntry);
 
     if (!StorageProcess::singleton().globalServerToContextConnection())
-        StorageProcess::singleton().createServerToContextConnection(sessionID);
+        StorageProcess::singleton().createServerToContextConnection();
 }
 
 void StorageToWebProcessConnection::removeSWServerConnection(WebCore::SWServer::Connection::Identifier serverConnectionIdentifier)
index a38cba2..7c947b0 100644 (file)
@@ -437,29 +437,6 @@ static NSDictionary *policiesHashMapToDictionary(const HashMap<String, HashMap<S
     return _processPool->processes().size();
 }
 
-- (size_t)_webPageContentProcessCount
-{
-    auto allWebProcesses = _processPool->processes();
-    auto* serviceWorkerProcess = _processPool->serviceWorkerProxy();
-    if (!serviceWorkerProcess)
-        return allWebProcesses.size();
-
-#if !ASSERT_DISABLED
-    bool serviceWorkerProcessWasFound = false;
-    for (auto& process : allWebProcesses) {
-        if (process == serviceWorkerProcess) {
-            serviceWorkerProcessWasFound = true;
-            break;
-        }
-    }
-
-    ASSERT(serviceWorkerProcessWasFound);
-    ASSERT(allWebProcesses.size() > 1);
-#endif
-
-    return allWebProcesses.size() - 1;
-}
-
 - (void)_preconnectToServer:(NSURL *)serverURL
 {
     _processPool->preconnectToServer(serverURL);
index 5233bc6..adde7c1 100644 (file)
@@ -85,9 +85,6 @@
 - (size_t)_pluginProcessCount WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 - (void)_syncNetworkProcessCookies WK_API_AVAILABLE(macosx(10.13), ios(11.0));
 
-// Test only. Returns web processes running web pages (does not include web processes running service workers)
-- (size_t)_webPageContentProcessCount WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
-
 // Test only. Should be called before any web content processes are launched.
 + (void)_forceGameControllerFramework WK_API_AVAILABLE(macosx(10.13), ios(11.0));
 
index 5b52106..4c0ad60 100644 (file)
@@ -223,12 +223,7 @@ void StorageProcessProxy::didFinishLaunching(ProcessLauncher* launcher, IPC::Con
 #if ENABLE(SERVICE_WORKER)
 void StorageProcessProxy::establishWorkerContextConnectionToStorageProcess()
 {
-    m_processPool.establishWorkerContextConnectionToStorageProcess(*this, std::nullopt);
-}
-
-void StorageProcessProxy::establishWorkerContextConnectionToStorageProcessForExplicitSession(PAL::SessionID sessionID)
-{
-    m_processPool.establishWorkerContextConnectionToStorageProcess(*this, sessionID);
+    m_processPool.establishWorkerContextConnectionToStorageProcess(*this);
 }
 #endif
 
index edb0d22..26dee87 100644 (file)
@@ -81,7 +81,6 @@ private:
 #endif
 #if ENABLE(SERVICE_WORKER)
     void establishWorkerContextConnectionToStorageProcess();
-    void establishWorkerContextConnectionToStorageProcessForExplicitSession(PAL::SessionID);
 #endif
 
     // ProcessLauncher::Client
index 9cb8203..c212b22 100644 (file)
@@ -33,6 +33,5 @@ messages -> StorageProcessProxy LegacyReceiver {
 
 #if ENABLE(SERVICE_WORKER)
     EstablishWorkerContextConnectionToStorageProcess()
-    EstablishWorkerContextConnectionToStorageProcessForExplicitSession(PAL::SessionID explicitSession)
 #endif
 }
index d59b6ae..74f2553 100644 (file)
@@ -589,29 +589,20 @@ void WebProcessPool::storageProcessCrashed(StorageProcessProxy* storageProcessPr
 }
 
 #if ENABLE(SERVICE_WORKER)
-void WebProcessPool::establishWorkerContextConnectionToStorageProcess(StorageProcessProxy& proxy, std::optional<PAL::SessionID> sessionID)
+void WebProcessPool::establishWorkerContextConnectionToStorageProcess(StorageProcessProxy& proxy)
 {
     ASSERT_UNUSED(proxy, &proxy == m_storageProcess);
 
     if (m_serviceWorkerProcess)
         return;
 
-    WebsiteDataStore* websiteDataStore = nullptr;
-    if (sessionID)
-        websiteDataStore = WebsiteDataStore::existingDataStoreForSessionID(*sessionID);
-
-    if (!websiteDataStore) {
-        if (!m_websiteDataStore)
-            m_websiteDataStore = API::WebsiteDataStore::defaultDataStore().ptr();
-        websiteDataStore = &m_websiteDataStore->websiteDataStore();
-    }
+    if (!m_websiteDataStore)
+        m_websiteDataStore = API::WebsiteDataStore::defaultDataStore().ptr();
 
-    auto serviceWorkerProcessProxy = ServiceWorkerProcessProxy::create(*this, *websiteDataStore);
+    auto serviceWorkerProcessProxy = ServiceWorkerProcessProxy::create(*this, m_websiteDataStore->websiteDataStore());
     m_serviceWorkerProcess = serviceWorkerProcessProxy.ptr();
-
     updateProcessAssertions();
-    initializeNewWebProcess(serviceWorkerProcessProxy.get(), *websiteDataStore);
-
+    initializeNewWebProcess(serviceWorkerProcessProxy.get(), m_websiteDataStore->websiteDataStore());
     m_processes.append(WTFMove(serviceWorkerProcessProxy));
 
     m_serviceWorkerProcess->start(m_defaultPageGroup->preferences().store());
index fb14eee..988c33c 100644 (file)
@@ -323,7 +323,7 @@ public:
     void getStorageProcessConnection(bool isServiceWorkerProcess, Ref<Messages::WebProcessProxy::GetStorageProcessConnection::DelayedReply>&&);
     void storageProcessCrashed(StorageProcessProxy*);
 #if ENABLE(SERVICE_WORKER)
-    void establishWorkerContextConnectionToStorageProcess(StorageProcessProxy&, std::optional<PAL::SessionID>);
+    void establishWorkerContextConnectionToStorageProcess(StorageProcessProxy&);
     bool isServiceWorker(uint64_t pageID) const { return m_serviceWorkerProcess && m_serviceWorkerProcess->pageID() == pageID; }
     ServiceWorkerProcessProxy* serviceWorkerProxy() const { return m_serviceWorkerProcess; }
     void setAllowsAnySSLCertificateForServiceWorker(bool allows) { m_allowsAnySSLCertificateForServiceWorker = allows; }
index 27ec260..75ee8bf 100644 (file)
 
 namespace WebKit {
 
-static HashMap<PAL::SessionID, WebsiteDataStore*>& allDataStores()
-{
-    RELEASE_ASSERT(isMainThread());
-    static NeverDestroyed<HashMap<PAL::SessionID, WebsiteDataStore*>> map;
-    return map;
-}
-
 Ref<WebsiteDataStore> WebsiteDataStore::createNonPersistent()
 {
     return adoptRef(*new WebsiteDataStore(PAL::SessionID::generateEphemeralSessionID()));
@@ -78,9 +71,6 @@ WebsiteDataStore::WebsiteDataStore(Configuration configuration, PAL::SessionID s
     , m_storageManager(StorageManager::create(m_configuration.localStorageDirectory))
     , m_queue(WorkQueue::create("com.apple.WebKit.WebsiteDataStore"))
 {
-    auto result = allDataStores().add(sessionID, this);
-    ASSERT_UNUSED(result, result.isNewEntry);
-
     platformInitialize();
 }
 
@@ -89,17 +79,11 @@ WebsiteDataStore::WebsiteDataStore(PAL::SessionID sessionID)
     , m_configuration()
     , m_queue(WorkQueue::create("com.apple.WebKit.WebsiteDataStore"))
 {
-    auto result = allDataStores().add(sessionID, this);
-    ASSERT_UNUSED(result, result.isNewEntry);
-
     platformInitialize();
 }
 
 WebsiteDataStore::~WebsiteDataStore()
 {
-    ASSERT(allDataStores().get(m_sessionID) == this);
-    allDataStores().remove(m_sessionID);
-
     platformDestroy();
 
     if (m_sessionID.isValid() && m_sessionID != PAL::SessionID::defaultSessionID()) {
@@ -108,11 +92,6 @@ WebsiteDataStore::~WebsiteDataStore()
     }
 }
 
-WebsiteDataStore* WebsiteDataStore::existingDataStoreForSessionID(PAL::SessionID sessionID)
-{
-    return allDataStores().get(sessionID);
-}
-
 WebProcessPool* WebsiteDataStore::processPoolForCookieStorageOperations()
 {
     auto pools = processPools(1, false);
index f9522d1..d1deec7 100644 (file)
@@ -91,8 +91,6 @@ public:
     static Ref<WebsiteDataStore> create(Configuration, PAL::SessionID);
     virtual ~WebsiteDataStore();
 
-    static WebsiteDataStore* existingDataStoreForSessionID(PAL::SessionID);
-
     bool isPersistent() const { return !m_sessionID.isEphemeral(); }
     PAL::SessionID sessionID() const { return m_sessionID; }
 
index f3e7dde..73b13c1 100644 (file)
@@ -1,3 +1,17 @@
+2017-12-13  Matt Lewis  <jlewis3@apple.com>
+
+        Unreviewed, rolling out r225864.
+
+        This caused the Layout test step to crash out on Debug testers
+
+        Reverted changeset:
+
+        "REGRESSION (r225789): API tests
+        WKProcessPool.InitialWarmedProcessUsed and
+        WebKit.WebsiteDataStoreCustomPaths are failing."
+        https://bugs.webkit.org/show_bug.cgi?id=180722
+        https://trac.webkit.org/changeset/225864
+
 2017-12-13  Youenn Fablet  <youenn@apple.com>
 
         Update ContentFiltering.LazilyLoadPlatformFrameworks test to account for libwebrtc using VideoProcessing framework
index ad37c96..43389be 100644 (file)
@@ -48,7 +48,7 @@ TEST(WKProcessPool, InitialWarmedProcessUsed)
     [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:loadableURL]]];
     [webView _test_waitForDidFinishNavigation];
 
-    EXPECT_EQ([pool _webPageContentProcessCount], static_cast<size_t>(1));
+    EXPECT_EQ([pool _webProcessCount], static_cast<size_t>(1));
 }
 
 #endif