Make ProcessModel always MultipleSecondaryProcesses
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Nov 2015 19:11:09 +0000 (19:11 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Nov 2015 19:11:09 +0000 (19:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151662

Reviewed by Antti Koivisto.

Source/WebKit2:

Single WebProcess behavior can still be achieved by setting the maximum number of WebProcesses to 1.

* Shared/API/c/WKDeprecatedFunctions.cpp:
(WKContextSetUsesNetworkProcess):
(WKContextSetProcessModel):
(WKContextGetProcessModel):
(WKGraphicsContextGetCGContext):
* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::createWithLegacyOptions):
(API::ProcessPoolConfiguration::copy):
* UIProcess/API/APIProcessPoolConfiguration.h:
* UIProcess/API/C/WKAPICast.h:
(WebKit::toAPI):
(WebKit::toFontSmoothingLevel):
(WebKit::toProcessModel): Deleted.
* UIProcess/API/C/WKContext.cpp:
(WKContextGetCacheModel):
(WKContextSetMaximumNumberOfProcesses):
(WKContextSetProcessModel): Deleted.
(WKContextGetProcessModel): Deleted.
* UIProcess/API/C/WKContext.h:
* UIProcess/API/Cocoa/WKProcessGroup.mm:
(-[WKProcessGroup initWithInjectedBundleURL:]):
* UIProcess/API/Cocoa/WKProcessPool.mm:
* UIProcess/API/efl/ewk_context.cpp:
(EwkContext::cacheModel):
(EwkContext::setProcessModel):
(EwkContext::processModel):
(EwkContext::clearResourceCache):
(EwkContext::jsGlobalContext):
(ewk_context_message_from_extensions_callback_set):
(ewk_context_process_model_set):
(ewk_context_process_model_get):
(ewk_context_tls_error_policy_get):
(toWKProcessModel): Deleted.
(toEwkProcessModel): Deleted.
* UIProcess/API/gtk/WebKitWebContext.cpp:
* UIProcess/ProcessModel.h: Removed.
* UIProcess/WebCookieManagerProxy.cpp:
(WebKit::WebCookieManagerProxy::shouldTerminate):
(WebKit::WebCookieManagerProxy::refWebContextSupplement):
* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::inspectorProcessPool):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::reattachToWebProcess):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::create):
(WebKit::WebProcessPool::setDownloadClient):
(WebKit::WebProcessPool::setMaximumNumberOfProcesses):
(WebKit::WebProcessPool::processDidCachePage):
(WebKit::WebProcessPool::createNewWebProcess):
(WebKit::WebProcessPool::disconnectProcess):
(WebKit::WebProcessPool::createWebPage):
(WebKit::WebProcessPool::postMessageToInjectedBundle):
(WebKit::WebProcessPool::requestWebContentStatistics):
(WebKit::WebProcessPool::requestNetworkingStatistics):
(WebKit::WebProcessPool::setProcessModel): Deleted.
(WebKit::WebProcessPool::ensureSharedWebProcess): Deleted.
* UIProcess/WebProcessPool.h:
(WebKit::WebProcessPool::sendToAllProcessesRelaunchingThemIfNecessary):
(WebKit::WebProcessPool::sendToOneProcess):
* WebKit2.xcodeproj/project.pbxproj:

Tools:

* TestWebKitAPI/Tests/WebKit2/Geolocation.cpp:
(TestWebKitAPI::TEST):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::generatePageConfiguration):

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

20 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/c/WKDeprecatedFunctions.cpp
Source/WebKit2/UIProcess/API/APIProcessPoolConfiguration.cpp
Source/WebKit2/UIProcess/API/APIProcessPoolConfiguration.h
Source/WebKit2/UIProcess/API/C/WKAPICast.h
Source/WebKit2/UIProcess/API/C/WKContext.cpp
Source/WebKit2/UIProcess/API/C/WKContext.h
Source/WebKit2/UIProcess/API/Cocoa/WKProcessGroup.mm
Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm
Source/WebKit2/UIProcess/API/efl/ewk_context.cpp
Source/WebKit2/UIProcess/ProcessModel.h [deleted file]
Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp
Source/WebKit2/UIProcess/WebInspectorProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebProcessPool.cpp
Source/WebKit2/UIProcess/WebProcessPool.h
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKit2/Geolocation.cpp
Tools/WebKitTestRunner/TestController.cpp

index 5104ed9..ea8899d 100644 (file)
@@ -1,3 +1,73 @@
+2015-11-30  Alex Christensen  <achristensen@webkit.org>
+
+        Make ProcessModel always MultipleSecondaryProcesses
+        https://bugs.webkit.org/show_bug.cgi?id=151662
+
+        Reviewed by Antti Koivisto.
+
+        Single WebProcess behavior can still be achieved by setting the maximum number of WebProcesses to 1.
+
+        * Shared/API/c/WKDeprecatedFunctions.cpp:
+        (WKContextSetUsesNetworkProcess):
+        (WKContextSetProcessModel):
+        (WKContextGetProcessModel):
+        (WKGraphicsContextGetCGContext):
+        * UIProcess/API/APIProcessPoolConfiguration.cpp:
+        (API::ProcessPoolConfiguration::createWithLegacyOptions):
+        (API::ProcessPoolConfiguration::copy):
+        * UIProcess/API/APIProcessPoolConfiguration.h:
+        * UIProcess/API/C/WKAPICast.h:
+        (WebKit::toAPI):
+        (WebKit::toFontSmoothingLevel):
+        (WebKit::toProcessModel): Deleted.
+        * UIProcess/API/C/WKContext.cpp:
+        (WKContextGetCacheModel):
+        (WKContextSetMaximumNumberOfProcesses):
+        (WKContextSetProcessModel): Deleted.
+        (WKContextGetProcessModel): Deleted.
+        * UIProcess/API/C/WKContext.h:
+        * UIProcess/API/Cocoa/WKProcessGroup.mm:
+        (-[WKProcessGroup initWithInjectedBundleURL:]):
+        * UIProcess/API/Cocoa/WKProcessPool.mm:
+        * UIProcess/API/efl/ewk_context.cpp:
+        (EwkContext::cacheModel):
+        (EwkContext::setProcessModel):
+        (EwkContext::processModel):
+        (EwkContext::clearResourceCache):
+        (EwkContext::jsGlobalContext):
+        (ewk_context_message_from_extensions_callback_set):
+        (ewk_context_process_model_set):
+        (ewk_context_process_model_get):
+        (ewk_context_tls_error_policy_get):
+        (toWKProcessModel): Deleted.
+        (toEwkProcessModel): Deleted.
+        * UIProcess/API/gtk/WebKitWebContext.cpp:
+        * UIProcess/ProcessModel.h: Removed.
+        * UIProcess/WebCookieManagerProxy.cpp:
+        (WebKit::WebCookieManagerProxy::shouldTerminate):
+        (WebKit::WebCookieManagerProxy::refWebContextSupplement):
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::inspectorProcessPool):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::reattachToWebProcess):
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::create):
+        (WebKit::WebProcessPool::setDownloadClient):
+        (WebKit::WebProcessPool::setMaximumNumberOfProcesses):
+        (WebKit::WebProcessPool::processDidCachePage):
+        (WebKit::WebProcessPool::createNewWebProcess):
+        (WebKit::WebProcessPool::disconnectProcess):
+        (WebKit::WebProcessPool::createWebPage):
+        (WebKit::WebProcessPool::postMessageToInjectedBundle):
+        (WebKit::WebProcessPool::requestWebContentStatistics):
+        (WebKit::WebProcessPool::requestNetworkingStatistics):
+        (WebKit::WebProcessPool::setProcessModel): Deleted.
+        (WebKit::WebProcessPool::ensureSharedWebProcess): Deleted.
+        * UIProcess/WebProcessPool.h:
+        (WebKit::WebProcessPool::sendToAllProcessesRelaunchingThemIfNecessary):
+        (WebKit::WebProcessPool::sendToOneProcess):
+        * WebKit2.xcodeproj/project.pbxproj:
+
 2015-11-30  Chris Dumez  <cdumez@apple.com>
 
         [WK2][Cache] We should not speculatively revalidate transient resources
index 7a1351f..563c873 100644 (file)
@@ -139,6 +139,15 @@ void WKContextSetUsesNetworkProcess(WKContextRef, bool)
 {
 }
 
+void WKContextSetProcessModel(WKContextRef, WKProcessModel)
+{
+}
+
+WKProcessModel WKContextGetProcessModel(WKContextRef)
+{
+    return kWKProcessModelMultipleSecondaryProcesses;
+}
+
 #if PLATFORM(MAC)
 CGContextRef WKGraphicsContextGetCGContext(WKGraphicsContextRef graphicsContext)
 {
index fa2675e..672a397 100644 (file)
@@ -41,14 +41,7 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::createWithLegacyOptions(
     auto configuration = ProcessPoolConfiguration::create();
 
     configuration->m_shouldHaveLegacyDataStore = true;
-#if PLATFORM(GTK)
-    // FIXME: Remove this ifdef once all ports have switched to use always NetworkProcess.
-    // See https://bugs.webkit.org/show_bug.cgi?id=151418.
-    configuration->m_processModel = WebKit::ProcessModelMultipleSecondaryProcesses;
     configuration->m_maximumProcessCount = 1;
-#else
-    configuration->m_processModel = WebKit::ProcessModelSharedSecondaryProcess;
-#endif
     configuration->m_cacheModel = WebKit::CacheModelDocumentViewer;
 
     configuration->m_applicationCacheDirectory = WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory();
@@ -80,7 +73,6 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::copy()
     auto copy = this->create();
 
     copy->m_shouldHaveLegacyDataStore = this->m_shouldHaveLegacyDataStore;
-    copy->m_processModel = this->m_processModel;
     copy->m_maximumProcessCount = this->m_maximumProcessCount;
     copy->m_cacheModel = this->m_cacheModel;
     copy->m_diskCacheSizeOverride = this->m_diskCacheSizeOverride;
index ad1abda..826da65 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "APIObject.h"
 #include "CacheModel.h"
-#include "ProcessModel.h"
 #include <wtf/Ref.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
@@ -48,9 +47,6 @@ public:
     bool shouldHaveLegacyDataStore() const { return m_shouldHaveLegacyDataStore; }
     void setShouldHaveLegacyDataStore(bool shouldHaveLegacyDataStore) { m_shouldHaveLegacyDataStore = shouldHaveLegacyDataStore; }
 
-    WebKit::ProcessModel processModel() const { return m_processModel; }
-    void setProcessModel(WebKit::ProcessModel processModel) { m_processModel = processModel; } 
-
     unsigned maximumProcessCount() const { return m_maximumProcessCount; }
     void setMaximumProcessCount(unsigned maximumProcessCount) { m_maximumProcessCount = maximumProcessCount; } 
 
@@ -93,7 +89,6 @@ public:
 private:
     bool m_shouldHaveLegacyDataStore { false };
 
-    WebKit::ProcessModel m_processModel { WebKit::ProcessModelMultipleSecondaryProcesses };
     unsigned m_maximumProcessCount { 0 };
     WebKit::CacheModel m_cacheModel { WebKit::CacheModelPrimaryWebBrowser };
     int64_t m_diskCacheSizeOverride { -1 };
index 8cbb8d5..4846ea3 100644 (file)
@@ -32,7 +32,6 @@
 #include "HTTPCookieAcceptPolicy.h"
 #include "InjectedBundleHitTestResultMediaType.h"
 #include "PluginModuleInfo.h"
-#include "ProcessModel.h"
 #include "ResourceCachesToClear.h"
 #include "WKBundleHitTestResult.h"
 #include "WKContext.h"
@@ -230,31 +229,6 @@ inline WKCacheModel toAPI(CacheModel cacheModel)
     return kWKCacheModelDocumentViewer;
 }
 
-inline ProcessModel toProcessModel(WKProcessModel wkProcessModel)
-{
-    switch (wkProcessModel) {
-    case kWKProcessModelSharedSecondaryProcess:
-        return ProcessModelSharedSecondaryProcess;
-    case kWKProcessModelMultipleSecondaryProcesses:
-        return ProcessModelMultipleSecondaryProcesses;
-    }
-
-    ASSERT_NOT_REACHED();
-    return ProcessModelSharedSecondaryProcess;
-}
-
-inline WKProcessModel toAPI(ProcessModel processModel)
-{
-    switch (processModel) {
-    case ProcessModelSharedSecondaryProcess:
-        return kWKProcessModelSharedSecondaryProcess;
-    case ProcessModelMultipleSecondaryProcesses:
-        return kWKProcessModelMultipleSecondaryProcesses;
-    }
-    
-    return kWKProcessModelSharedSecondaryProcess;
-}
-
 inline FontSmoothingLevel toFontSmoothingLevel(WKFontSmoothingLevel wkLevel)
 {
     switch (wkLevel) {
index cb2c793..8768792 100644 (file)
@@ -329,16 +329,6 @@ WKCacheModel WKContextGetCacheModel(WKContextRef contextRef)
     return toAPI(toImpl(contextRef)->cacheModel());
 }
 
-void WKContextSetProcessModel(WKContextRef contextRef, WKProcessModel processModel)
-{
-    toImpl(contextRef)->setProcessModel(toProcessModel(processModel));
-}
-
-WKProcessModel WKContextGetProcessModel(WKContextRef contextRef)
-{
-    return toAPI(toImpl(contextRef)->processModel());
-}
-
 void WKContextSetMaximumNumberOfProcesses(WKContextRef contextRef, unsigned numberOfProcesses)
 {
     toImpl(contextRef)->setMaximumNumberOfProcesses(numberOfProcesses);
index 1b3d82c..332b147 100644 (file)
@@ -75,6 +75,7 @@ typedef struct WKContextClientV1 {
     WKContextCopyWebCryptoMasterKeyCallback                             copyWebCryptoMasterKey;
 } WKContextClientV1;
 
+// FIXME: Remove these once support for Mavericks has been dropped.
 enum {
     kWKProcessModelSharedSecondaryProcess = 0,
     kWKProcessModelMultipleSecondaryProcesses = 1
@@ -111,8 +112,9 @@ WK_EXPORT void WKContextClearVisitedLinks(WKContextRef contextRef);
 WK_EXPORT void WKContextSetCacheModel(WKContextRef context, WKCacheModel cacheModel);
 WK_EXPORT WKCacheModel WKContextGetCacheModel(WKContextRef context);
 
-WK_EXPORT void WKContextSetProcessModel(WKContextRef context, WKProcessModel processModel);
-WK_EXPORT WKProcessModel WKContextGetProcessModel(WKContextRef context);
+// FIXME: Move these to WKDeprecatedFunctions.cpp once support for Mavericks has been dropped.
+WK_EXPORT void WKContextSetProcessModel(WKContextRef, WKProcessModel);
+WK_EXPORT WKProcessModel WKContextGetProcessModel(WKContextRef);
 
 WK_EXPORT void WKContextSetMaximumNumberOfProcesses(WKContextRef context, unsigned numberOfProcesses);
 WK_EXPORT unsigned WKContextGetMaximumNumberOfProcesses(WKContextRef context);
index d7278eb..ecfc80f 100644 (file)
@@ -192,9 +192,6 @@ static void setUpHistoryClient(WKProcessGroup *processGroup, WKContextRef contex
 
     auto configuration = API::ProcessPoolConfiguration::createWithLegacyOptions();
     configuration->setInjectedBundlePath(bundleURL ? String(bundleURL.path) : String());
-#if PLATFORM(IOS)
-    configuration->setProcessModel(ProcessModelMultipleSecondaryProcesses);
-#endif
 
     _processPool = WebProcessPool::create(configuration);
 
index 9681ae8..18fda50 100644 (file)
@@ -30,7 +30,6 @@
 
 #import "CacheModel.h"
 #import "DownloadClient.h"
-#import "ProcessModel.h"
 #import "SandboxUtilities.h"
 #import "WKObject.h"
 #import "WeakObjCPtr.h"
index 8486d6e..a530ef5 100644 (file)
@@ -257,45 +257,13 @@ Ewk_Cache_Model EwkContext::cacheModel() const
     return static_cast<Ewk_Cache_Model>(WKContextGetCacheModel(m_context.get()));
 }
 
-inline WKProcessModel toWKProcessModel(Ewk_Process_Model processModel)
+void EwkContext::setProcessModel(Ewk_Process_Model)
 {
-    switch (processModel) {
-    case EWK_PROCESS_MODEL_SHARED_SECONDARY:
-        return kWKProcessModelSharedSecondaryProcess;
-    case EWK_PROCESS_MODEL_MULTIPLE_SECONDARY:
-        return kWKProcessModelMultipleSecondaryProcesses;
-    }
-    ASSERT_NOT_REACHED();
-
-    return kWKProcessModelSharedSecondaryProcess;
-}
-
-void EwkContext::setProcessModel(Ewk_Process_Model processModel)
-{
-    WKProcessModel newWKProcessModel = toWKProcessModel(processModel);
-
-    if (WKContextGetProcessModel(m_context.get()) == newWKProcessModel)
-        return;
-
-    WKContextSetProcessModel(m_context.get(), newWKProcessModel);
-}
-
-inline Ewk_Process_Model toEwkProcessModel(WKProcessModel processModel)
-{
-    switch (processModel) {
-    case kWKProcessModelSharedSecondaryProcess:
-        return EWK_PROCESS_MODEL_SHARED_SECONDARY;
-    case kWKProcessModelMultipleSecondaryProcesses:
-        return EWK_PROCESS_MODEL_MULTIPLE_SECONDARY;
-    }
-    ASSERT_NOT_REACHED();
-
-    return EWK_PROCESS_MODEL_SHARED_SECONDARY;
 }
 
 Ewk_Process_Model EwkContext::processModel() const
 {
-    return toEwkProcessModel(WKContextGetProcessModel(m_context.get()));
+    return EWK_PROCESS_MODEL_MULTIPLE_SECONDARY;
 }
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
@@ -311,7 +279,6 @@ void EwkContext::clearResourceCache()
     WKResourceCacheManagerClearCacheForAllOrigins(WKContextGetResourceCacheManager(m_context.get()), WKResourceCachesToClearAll);
 }
 
-
 JSGlobalContextRef EwkContext::jsGlobalContext()
 {
     if (!m_jsGlobalContext)
@@ -567,20 +534,15 @@ void ewk_context_message_from_extensions_callback_set(Ewk_Context* ewkContext, E
     impl->setMessageFromExtensionCallback(callback, userData);
 }
 
-Eina_Bool ewk_context_process_model_set(Ewk_Context* ewkContext, Ewk_Process_Model processModel)
+Eina_Bool ewk_context_process_model_set(Ewk_Context* ewkContext, Ewk_Process_Model)
 {
     EWK_OBJ_GET_IMPL_OR_RETURN(EwkContext, ewkContext, impl, false);
-
-    impl->setProcessModel(processModel);
-
     return true;
 }
 
 Ewk_Process_Model ewk_context_process_model_get(const Ewk_Context* ewkContext)
 {
-    EWK_OBJ_GET_IMPL_OR_RETURN(const EwkContext, ewkContext, impl, EWK_PROCESS_MODEL_SHARED_SECONDARY);
-
-    return impl->processModel();
+    return EWK_PROCESS_MODEL_MULTIPLE_SECONDARY;
 }
 
 Ewk_TLS_Error_Policy ewk_context_tls_error_policy_get(const Ewk_Context* context)
diff --git a/Source/WebKit2/UIProcess/ProcessModel.h b/Source/WebKit2/UIProcess/ProcessModel.h
deleted file mode 100644 (file)
index 6c18da0..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ProcessModel_h
-#define ProcessModel_h
-
-namespace WebKit {
-
-enum ProcessModel {
-    ProcessModelSharedSecondaryProcess,
-    ProcessModelMultipleSecondaryProcesses
-};
-
-} // namespace WebKit
-
-#endif // ProcessModel_h
index a760933..0d23283 100644 (file)
@@ -85,8 +85,7 @@ void WebCookieManagerProxy::processDidClose(NetworkProcessProxy*)
 
 bool WebCookieManagerProxy::shouldTerminate(WebProcessProxy*) const
 {
-    return processPool()->processModel() != ProcessModelSharedSecondaryProcess
-        || (m_arrayCallbacks.isEmpty() && m_httpCookieAcceptPolicyCallbacks.isEmpty());
+    return true;
 }
 
 void WebCookieManagerProxy::refWebContextSupplement()
index fc6c6f5..be606bd 100644 (file)
@@ -312,7 +312,6 @@ WebProcessPool& WebInspectorProxy::inspectorProcessPool()
     // guarantees no process sharing for our user interface.
     if (!s_processPool) {
         auto configuration = API::ProcessPoolConfiguration::createWithLegacyOptions();
-        configuration->setProcessModel(ProcessModelMultipleSecondaryProcesses);
         s_processPool = &WebProcessPool::create(configuration.get()).leakRef();
     };
 
index a37e0ed..f1fa6c9 100644 (file)
@@ -691,10 +691,7 @@ void WebPageProxy::reattachToWebProcess()
     m_process->removeWebPage(m_pageID);
     m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID);
 
-    if (m_process->processPool().processModel() == ProcessModelSharedSecondaryProcess)
-        m_process = m_process->processPool().ensureSharedWebProcess();
-    else
-        m_process = m_process->processPool().createNewWebProcessRespectingProcessCountLimit();
+    m_process = m_process->processPool().createNewWebProcessRespectingProcessCountLimit();
 
     ASSERT(m_process->state() != ChildProcessProxy::State::Terminated);
     if (m_process->state() == ChildProcessProxy::State::Running)
index a781cb5..fc11b73 100644 (file)
@@ -102,8 +102,6 @@ using namespace WebKit;
 
 namespace WebKit {
 
-static const double sharedSecondaryProcessShutdownTimeout = 60;
-
 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, processPoolCounter, ("WebProcessPool"));
 
 Ref<WebProcessPool> WebProcessPool::create(API::ProcessPoolConfiguration& configuration)
@@ -281,17 +279,6 @@ void WebProcessPool::setDownloadClient(std::unique_ptr<API::DownloadClient> down
         m_downloadClient = WTF::move(downloadClient);
 }
 
-void WebProcessPool::setProcessModel(ProcessModel processModel)
-{
-    // Guard against API misuse.
-    if (!m_processes.isEmpty())
-        CRASH();
-    if (processModel != ProcessModelSharedSecondaryProcess && !m_messagesToInjectedBundlePostedToEmptyContext.isEmpty())
-        CRASH();
-
-    m_configuration->setProcessModel(processModel);
-}
-
 void WebProcessPool::setMaximumNumberOfProcesses(unsigned maximumNumberOfProcesses)
 {
     // Guard against API misuse.
@@ -521,14 +508,6 @@ void WebProcessPool::processDidCachePage(WebProcessProxy* process)
     m_processWithPageCache = process;
 }
 
-WebProcessProxy& WebProcessPool::ensureSharedWebProcess()
-{
-    ASSERT(processModel() == ProcessModelSharedSecondaryProcess);
-    if (m_processes.isEmpty())
-        createNewWebProcess();
-    return *m_processes[0];
-}
-
 WebProcessProxy& WebProcessPool::createNewWebProcess()
 {
     ensureNetworkProcess();
@@ -595,7 +574,7 @@ WebProcessProxy& WebProcessPool::createNewWebProcess()
     // iconDatabasePath is non-empty by default, but m_iconDatabase isn't enabled in UI process unless setDatabasePath is called explicitly.
     parameters.iconDatabaseEnabled = !iconDatabasePath().isEmpty();
 
-    parameters.terminationTimeout = (processModel() == ProcessModelSharedSecondaryProcess) ? sharedSecondaryProcessShutdownTimeout : 0;
+    parameters.terminationTimeout = 0;
 
     parameters.textCheckerState = TextChecker::state();
 
@@ -651,15 +630,7 @@ WebProcessProxy& WebProcessPool::createNewWebProcess()
 
     m_processes.append(process.ptr());
 
-    if (processModel() == ProcessModelSharedSecondaryProcess) {
-        for (size_t i = 0; i != m_messagesToInjectedBundlePostedToEmptyContext.size(); ++i) {
-            auto& messageNameAndBody = m_messagesToInjectedBundlePostedToEmptyContext[i];
-
-            process->send(Messages::WebProcess::HandleInjectedBundleMessage(messageNameAndBody.first, UserData(process->transformObjectsToHandles(messageNameAndBody.second.get()).get())), 0);
-        }
-        m_messagesToInjectedBundlePostedToEmptyContext.clear();
-    } else
-        ASSERT(m_messagesToInjectedBundlePostedToEmptyContext.isEmpty());
+    ASSERT(m_messagesToInjectedBundlePostedToEmptyContext.isEmpty());
 
 #if ENABLE(REMOTE_INSPECTOR)
     // Initialize remote inspector connection now that we have a sub-process that is hosting one of our web views.
@@ -741,30 +712,14 @@ void WebProcessPool::disconnectProcess(WebProcessProxy* process)
     if (m_haveInitialEmptyProcess && process == m_processes.last())
         m_haveInitialEmptyProcess = false;
 
-    // FIXME (Multi-WebProcess): <rdar://problem/12239765> Some of the invalidation calls below are still necessary in multi-process mode, but they should only affect data structures pertaining to the process being disconnected.
+    // FIXME (Multi-WebProcess): <rdar://problem/12239765> Some of the invalidation calls of the other supplements are still necessary in multi-process mode, but they should only affect data structures pertaining to the process being disconnected.
     // Clearing everything causes assertion failures, so it's less trouble to skip that for now.
-    if (processModel() != ProcessModelSharedSecondaryProcess) {
-        RefPtr<WebProcessProxy> protect(process);
-        if (m_processWithPageCache == process)
-            m_processWithPageCache = 0;
-
-        static_cast<WebContextSupplement*>(supplement<WebGeolocationManagerProxy>())->processDidClose(process);
-
-        m_processes.removeFirst(process);
-        return;
-    }
-
-    WebContextSupplementMap::const_iterator it = m_supplements.begin();
-    WebContextSupplementMap::const_iterator end = m_supplements.end();
-    for (; it != end; ++it)
-        it->value->processDidClose(process);
-
-    // The vector may have the last reference to process proxy, which in turn may have the last reference to the context.
-    // Since vector elements are destroyed in place, we would recurse into WebProcessProxy destructor
-    // if it were invoked from Vector::remove(). RefPtr delays destruction until it's safe.
     RefPtr<WebProcessProxy> protect(process);
     if (m_processWithPageCache == process)
         m_processWithPageCache = nullptr;
+
+    static_cast<WebContextSupplement*>(supplement<WebGeolocationManagerProxy>())->processDidClose(process);
+
     m_processes.removeFirst(process);
 }
 
@@ -796,18 +751,14 @@ Ref<WebPageProxy> WebProcessPool::createWebPage(PageClient& pageClient, Ref<API:
     }
 
     RefPtr<WebProcessProxy> process;
-    if (processModel() == ProcessModelSharedSecondaryProcess) {
-        process = &ensureSharedWebProcess();
-    } else {
-        if (m_haveInitialEmptyProcess) {
-            process = m_processes.last();
-            m_haveInitialEmptyProcess = false;
-        } else if (pageConfiguration->relatedPage()) {
-            // Sharing processes, e.g. when creating the page via window.open().
-            process = &pageConfiguration->relatedPage()->process();
-        } else
-            process = &createNewWebProcessRespectingProcessCountLimit();
-    }
+    if (m_haveInitialEmptyProcess) {
+        process = m_processes.last();
+        m_haveInitialEmptyProcess = false;
+    } else if (pageConfiguration->relatedPage()) {
+        // Sharing processes, e.g. when creating the page via window.open().
+        process = &pageConfiguration->relatedPage()->process();
+    } else
+        process = &createNewWebProcessRespectingProcessCountLimit();
 
     return process->createWebPage(pageClient, WTF::move(pageConfiguration));
 }
@@ -844,12 +795,6 @@ DownloadProxy* WebProcessPool::resumeDownload(const API::Data* resumeData, const
 
 void WebProcessPool::postMessageToInjectedBundle(const String& messageName, API::Object* messageBody)
 {
-    if (m_processes.isEmpty()) {
-        if (processModel() == ProcessModelSharedSecondaryProcess)
-            m_messagesToInjectedBundlePostedToEmptyContext.append(std::make_pair(messageName, messageBody));
-        return;
-    }
-
     for (auto& process : m_processes) {
         // FIXME: Return early if the message body contains any references to WKPageRefs/WKFrameRefs etc. since they're local to a process.
         process->send(Messages::WebProcess::HandleInjectedBundleMessage(messageName, UserData(process->transformObjectsToHandles(messageBody).get())), 0);
@@ -1157,17 +1102,7 @@ void WebProcessPool::getStatistics(uint32_t statisticsMask, std::function<void (
 
 void WebProcessPool::requestWebContentStatistics(StatisticsRequest* request)
 {
-    if (processModel() == ProcessModelSharedSecondaryProcess) {
-        if (m_processes.isEmpty())
-            return;
-        
-        uint64_t requestID = request->addOutstandingRequest();
-        m_statisticsRequests.set(requestID, request);
-        m_processes[0]->send(Messages::WebProcess::GetWebCoreStatistics(requestID), 0);
-
-    } else {
-        // FIXME (Multi-WebProcess) <rdar://problem/13200059>: Make getting statistics from multiple WebProcesses work.
-    }
+    // FIXME (Multi-WebProcess) <rdar://problem/13200059>: Make getting statistics from multiple WebProcesses work.
 }
 
 void WebProcessPool::requestNetworkingStatistics(StatisticsRequest* request)
index 3b19775..be75a9d 100644 (file)
@@ -37,7 +37,6 @@
 #include "NetworkProcessProxy.h"
 #include "PlugInAutoStartProvider.h"
 #include "PluginInfoStore.h"
-#include "ProcessModel.h"
 #include "ProcessThrottler.h"
 #include "StatisticsRequest.h"
 #include "VisitedLinkStore.h"
@@ -136,9 +135,6 @@ public:
     void setHistoryClient(std::unique_ptr<API::LegacyContextHistoryClient>);
     void setDownloadClient(std::unique_ptr<API::DownloadClient>);
 
-    void setProcessModel(ProcessModel); // Can only be called when there are no processes running.
-    ProcessModel processModel() const { return m_configuration->processModel(); }
-
     void setMaximumNumberOfProcesses(unsigned); // Can only be called when there are no processes running.
     unsigned maximumNumberOfProcesses() const { return !m_configuration->maximumProcessCount() ? UINT_MAX : m_configuration->maximumProcessCount(); }
 
@@ -245,7 +241,6 @@ public:
 
     void allowSpecificHTTPSCertificateForHost(const WebCertificateInfo*, const String& host);
 
-    WebProcessProxy& ensureSharedWebProcess();
     WebProcessProxy& createNewWebProcessRespectingProcessCountLimit(); // Will return an existing one if limit is met.
     void warmInitialProcess();
 
@@ -558,17 +553,12 @@ template<typename T>
 void WebProcessPool::sendToAllProcessesRelaunchingThemIfNecessary(const T& message)
 {
     // FIXME (Multi-WebProcess): WebProcessPool doesn't track processes that have exited, so it cannot relaunch these. Perhaps this functionality won't be needed in this mode.
-    if (processModel() == ProcessModelSharedSecondaryProcess)
-        ensureSharedWebProcess();
     sendToAllProcesses(message);
 }
 
 template<typename T>
 void WebProcessPool::sendToOneProcess(T&& message)
 {
-    if (processModel() == ProcessModelSharedSecondaryProcess)
-        ensureSharedWebProcess();
-
     bool messageSent = false;
     size_t processCount = m_processes.size();
     for (size_t i = 0; i < processCount; ++i) {
@@ -580,7 +570,7 @@ void WebProcessPool::sendToOneProcess(T&& message)
         }
     }
 
-    if (!messageSent && processModel() == ProcessModelMultipleSecondaryProcesses) {
+    if (!messageSent) {
         warmInitialProcess();
         RefPtr<WebProcessProxy> process = m_processes.last();
         if (process->canSendMessage())
index e0242e2..8ac0955 100644 (file)
                BC5750981268F3C6006F0F12 /* WebPopupMenuProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC5750961268F3C6006F0F12 /* WebPopupMenuProxyMac.mm */; };
                BC575613126E0138006F0F12 /* APIError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC575612126E0138006F0F12 /* APIError.cpp */; };
                BC59548915C7868500FD1E3E /* WebKit2.h in Headers */ = {isa = PBXBuildFile; fileRef = BC59548815C7868500FD1E3E /* WebKit2.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               BC597075116591D000551FCA /* ProcessModel.h in Headers */ = {isa = PBXBuildFile; fileRef = BC597074116591D000551FCA /* ProcessModel.h */; };
                BC5C75C814954DA600BC4775 /* WKConnectionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5C75C614954DA600BC4775 /* WKConnectionInternal.h */; };
                BC5D24A116CC3B9E007D5461 /* ChildProcessMain.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC5D249F16CC3B9E007D5461 /* ChildProcessMain.mm */; };
                BC5D24A216CC3B9E007D5461 /* ChildProcessMain.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC5D249F16CC3B9E007D5461 /* ChildProcessMain.mm */; };
                BC5750961268F3C6006F0F12 /* WebPopupMenuProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPopupMenuProxyMac.mm; sourceTree = "<group>"; };
                BC575612126E0138006F0F12 /* APIError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIError.cpp; sourceTree = "<group>"; };
                BC59548815C7868500FD1E3E /* WebKit2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKit2.h; sourceTree = "<group>"; };
-               BC597074116591D000551FCA /* ProcessModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessModel.h; sourceTree = "<group>"; };
                BC5C75C614954DA600BC4775 /* WKConnectionInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKConnectionInternal.h; sourceTree = "<group>"; };
                BC5D249F16CC3B9E007D5461 /* ChildProcessMain.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ChildProcessMain.mm; sourceTree = "<group>"; };
                BC5D24B816CC40BB007D5461 /* BaseLegacyProcess.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = BaseLegacyProcess.xcconfig; sourceTree = "<group>"; };
                                1AC7537A183A9FDB0072CB15 /* PageLoadState.h */,
                                37716A59195B910500EE8B1B /* ProcessAssertion.cpp */,
                                86F9536018FF4FD4001DB2EF /* ProcessAssertion.h */,
-                               BC597074116591D000551FCA /* ProcessModel.h */,
                                86E67A22190F411800004AB7 /* ProcessThrottler.cpp */,
                                86E67A21190F411800004AB7 /* ProcessThrottler.h */,
                                83048AE51ACA45DC0082C832 /* ProcessThrottlerClient.h */,
                                E1CC1B9012D7EADF00625838 /* PrintInfo.h in Headers */,
                                86F9536518FF58F5001DB2EF /* ProcessAssertion.h in Headers */,
                                BC1A7C581136E19C00FB7167 /* ProcessLauncher.h in Headers */,
-                               BC597075116591D000551FCA /* ProcessModel.h in Headers */,
                                86E67A251910B9D100004AB7 /* ProcessThrottler.h in Headers */,
                                83048AE61ACA45DC0082C832 /* ProcessThrottlerClient.h in Headers */,
                                2D7F13101A702FBA009A6FBD /* ProcessType.h in Headers */,
index 897ec3d..ce0a3c2 100644 (file)
@@ -1,5 +1,17 @@
 2015-11-30  Alex Christensen  <achristensen@webkit.org>
 
+        Make ProcessModel always MultipleSecondaryProcesses
+        https://bugs.webkit.org/show_bug.cgi?id=151662
+
+        Reviewed by Antti Koivisto.
+
+        * TestWebKitAPI/Tests/WebKit2/Geolocation.cpp:
+        (TestWebKitAPI::TEST):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::generatePageConfiguration):
+
+2015-11-30  Alex Christensen  <achristensen@webkit.org>
+
         Make usesNetworkProcess always true
         https://bugs.webkit.org/show_bug.cgi?id=151580
 
index f0551ed..90fd379 100644 (file)
@@ -250,6 +250,7 @@ struct GeolocationTransitionToHighAccuracyStateTracker : GeolocationStateTracker
 TEST(WebKit2, GeolocationTransitionToHighAccuracy)
 {
     WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
+    WKContextSetMaximumNumberOfProcesses(context.get(), 1);
 
     GeolocationTransitionToHighAccuracyStateTracker stateTracker;
     setupGeolocationProvider(context.get(), &stateTracker);
@@ -314,6 +315,7 @@ static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef us
 TEST(WebKit2, GeolocationTransitionToLowAccuracy)
 {
     WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
+    WKContextSetMaximumNumberOfProcesses(context.get(), 1);
 
     GeolocationTransitionToLowAccuracyStateTracker stateTracker;
     setupGeolocationProvider(context.get(), &stateTracker);
index 2f3327a..1bf5cc5 100644 (file)
@@ -400,10 +400,6 @@ WKRetainPtr<WKPageConfigurationRef> TestController::generatePageConfiguration(WK
 
     m_geolocationProvider = std::make_unique<GeolocationProviderMock>(m_context.get());
 
-#if PLATFORM(EFL)
-    WKContextSetProcessModel(m_context.get(), kWKProcessModelSharedSecondaryProcess);
-#endif
-
     if (const char* dumpRenderTreeTemp = libraryPathForTesting()) {
         String temporaryFolder = String::fromUTF8(dumpRenderTreeTemp);