Deprecate API to limit the maximum number of WebProcesses
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2019 23:34:22 +0000 (23:34 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2019 23:34:22 +0000 (23:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193725
<rdar://problem/47464879>

Reviewed by Geoff Garen.

Source/WebKit:

Deprecate API to limit the maximum number of WebProcesses and make it a no-op. It adds
complexity and is not safe (conflicts with PSON).

Add a new usesSingleWebProcess SPI to _WKProcessPoolConfiguration to be used by
Minibrowser / Safari in order to disable process per tab (can be useful for debugging).
Note that enabling the single WebProcess mode will disable PSON and process prewarming.

* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::createWithLegacyOptions):
(API::ProcessPoolConfiguration::copy):
* UIProcess/API/APIProcessPoolConfiguration.h:
* UIProcess/API/C/WKContext.cpp:
(WKContextSetMaximumNumberOfProcesses):
(WKContextGetMaximumNumberOfProcesses):
* UIProcess/API/C/WKContext.h:
* UIProcess/API/Cocoa/WKProcessPool.mm:
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
(-[_WKProcessPoolConfiguration maximumProcessCount]):
(-[_WKProcessPoolConfiguration setMaximumProcessCount:]):
(-[_WKProcessPoolConfiguration usesSingleWebProcess]):
(-[_WKProcessPoolConfiguration setUsesSingleWebProcess:]):
(-[_WKProcessPoolConfiguration description]):
* UIProcess/API/glib/WebKitWebContext.cpp:
(webkitWebContextConstructed):
(webkit_web_context_set_process_model):
(webkit_web_context_set_web_process_count_limit):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
(WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
(WebKit::WebProcessPool::processForNavigationInternal):
* UIProcess/WebProcessPool.h:

Tools:

Update existing API tests to stop using deprecated API.

* MiniBrowser/mac/AppDelegate.m:
(defaultConfiguration):
* TestWebKitAPI/Tests/WebKit/UserMedia.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimer.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
* TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm:
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/WKProcessPoolConfiguration.mm:
(TEST):

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

19 files changed:
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp
Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h
Source/WebKit/UIProcess/API/C/WKContext.cpp
Source/WebKit/UIProcess/API/C/WKContext.h
Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h
Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm
Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Tools/ChangeLog
Tools/MiniBrowser/mac/AppDelegate.m
Tools/TestWebKitAPI/Tests/WebKit/UserMedia.cpp
Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimer.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKProcessPoolConfiguration.mm

index 2c5357d..1207e60 100644 (file)
@@ -1,3 +1,45 @@
+2019-01-23  Chris Dumez  <cdumez@apple.com>
+
+        Deprecate API to limit the maximum number of WebProcesses
+        https://bugs.webkit.org/show_bug.cgi?id=193725
+        <rdar://problem/47464879>
+
+        Reviewed by Geoff Garen.
+
+        Deprecate API to limit the maximum number of WebProcesses and make it a no-op. It adds
+        complexity and is not safe (conflicts with PSON).
+
+        Add a new usesSingleWebProcess SPI to _WKProcessPoolConfiguration to be used by
+        Minibrowser / Safari in order to disable process per tab (can be useful for debugging).
+        Note that enabling the single WebProcess mode will disable PSON and process prewarming.
+
+        * UIProcess/API/APIProcessPoolConfiguration.cpp:
+        (API::ProcessPoolConfiguration::createWithLegacyOptions):
+        (API::ProcessPoolConfiguration::copy):
+        * UIProcess/API/APIProcessPoolConfiguration.h:
+        * UIProcess/API/C/WKContext.cpp:
+        (WKContextSetMaximumNumberOfProcesses):
+        (WKContextGetMaximumNumberOfProcesses):
+        * UIProcess/API/C/WKContext.h:
+        * UIProcess/API/Cocoa/WKProcessPool.mm:
+        * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
+        * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
+        * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
+        (-[_WKProcessPoolConfiguration maximumProcessCount]):
+        (-[_WKProcessPoolConfiguration setMaximumProcessCount:]):
+        (-[_WKProcessPoolConfiguration usesSingleWebProcess]):
+        (-[_WKProcessPoolConfiguration setUsesSingleWebProcess:]):
+        (-[_WKProcessPoolConfiguration description]):
+        * UIProcess/API/glib/WebKitWebContext.cpp:
+        (webkitWebContextConstructed):
+        (webkit_web_context_set_process_model):
+        (webkit_web_context_set_web_process_count_limit):
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
+        (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
+        (WebKit::WebProcessPool::processForNavigationInternal):
+        * UIProcess/WebProcessPool.h:
+
 2019-01-23  Brent Fulgham  <bfulgham@apple.com>
 
         Switch NetworkStorageSession portions of ResourceLoadStatistics to Async message passing style
index 8e13c1d..d17978e 100644 (file)
@@ -41,7 +41,6 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::createWithLegacyOptions(
     auto configuration = ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration(WebsiteDataStore::legacyDefaultDataStoreConfiguration());
 
     configuration->m_shouldHaveLegacyDataStore = true;
-    configuration->m_maximumProcessCount = 1;
     configuration->m_cacheModel = WebKit::CacheModel::DocumentViewer;
 
     return configuration;
@@ -90,7 +89,6 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::copy()
     auto copy = this->create();
 
     copy->m_shouldHaveLegacyDataStore = this->m_shouldHaveLegacyDataStore;
-    copy->m_maximumProcessCount = this->m_maximumProcessCount;
     copy->m_cacheModel = this->m_cacheModel;
     copy->m_diskCacheDirectory = this->m_diskCacheDirectory;
     copy->m_diskCacheSpeculativeValidationEnabled = this->m_diskCacheSpeculativeValidationEnabled;
@@ -133,6 +131,7 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::copy()
     copy->m_suppressesConnectionTerminationOnSystemChange = this->m_suppressesConnectionTerminationOnSystemChange;
 #endif
     copy->m_customWebContentServiceBundleIdentifier = this->m_customWebContentServiceBundleIdentifier;
+    copy->m_usesSingleWebProcess = m_usesSingleWebProcess;
 
     return copy;
 }
index 65021b6..ec73ebd 100644 (file)
@@ -56,8 +56,8 @@ public:
     bool shouldHaveLegacyDataStore() const { return m_shouldHaveLegacyDataStore; }
     void setShouldHaveLegacyDataStore(bool shouldHaveLegacyDataStore) { m_shouldHaveLegacyDataStore = shouldHaveLegacyDataStore; }
 
-    unsigned maximumProcessCount() const { return m_maximumProcessCount; }
-    void setMaximumProcessCount(unsigned maximumProcessCount) { m_maximumProcessCount = maximumProcessCount; }
+    bool usesSingleWebProcess() const { return m_usesSingleWebProcess; }
+    void setUsesSingleWebProcess(bool enabled) { m_usesSingleWebProcess = enabled; }
 
     bool isAutomaticProcessWarmingEnabled() const
     {
@@ -187,7 +187,6 @@ public:
 private:
     bool m_shouldHaveLegacyDataStore { false };
 
-    unsigned m_maximumProcessCount { 0 };
     bool m_diskCacheSpeculativeValidationEnabled { false };
     WebKit::CacheModel m_cacheModel { WebKit::CacheModel::PrimaryWebBrowser };
 
@@ -224,6 +223,7 @@ private:
     bool m_clientWouldBenefitFromAutomaticProcessPrewarming { false };
     WTF::String m_customWebContentServiceBundleIdentifier;
     bool m_isJITEnabled { true };
+    bool m_usesSingleWebProcess { false };
 
 #if PLATFORM(IOS_FAMILY)
     WTF::String m_ctDataConnectionServiceType;
index 9fb695a..77f4ba2 100644 (file)
@@ -326,14 +326,15 @@ WKCacheModel WKContextGetCacheModel(WKContextRef contextRef)
     return WebKit::toAPI(WebKit::toImpl(contextRef)->cacheModel());
 }
 
-void WKContextSetMaximumNumberOfProcesses(WKContextRef contextRef, unsigned numberOfProcesses)
+void WKContextSetMaximumNumberOfProcesses(WKContextRef, unsigned)
 {
-    WebKit::toImpl(contextRef)->setMaximumNumberOfProcesses(numberOfProcesses);
+    // Deprecated.
 }
 
-unsigned WKContextGetMaximumNumberOfProcesses(WKContextRef contextRef)
+unsigned WKContextGetMaximumNumberOfProcesses(WKContextRef)
 {
-    return WebKit::toImpl(contextRef)->maximumNumberOfProcesses();
+    // Deprecated.
+    return std::numeric_limits<unsigned>::max();
 }
 
 void WKContextSetAlwaysUsesComplexTextCodePath(WKContextRef contextRef, bool alwaysUseComplexTextCodePath)
@@ -405,6 +406,16 @@ void WKContextSetPrewarmsProcessesAutomatically(WKContextRef contextRef, bool va
     WebKit::toImpl(contextRef)->configuration().setIsAutomaticProcessWarmingEnabled(value);
 }
 
+void WKContextSetUsesSingleWebProcess(WKContextRef contextRef, bool value)
+{
+    WebKit::toImpl(contextRef)->configuration().setUsesSingleWebProcess(value);
+}
+
+bool WKContextGetUsesSingleWebProcess(WKContextRef contextRef)
+{
+    return WebKit::toImpl(contextRef)->configuration().usesSingleWebProcess();
+}
+
 void WKContextSetCustomWebContentServiceBundleIdentifier(WKContextRef contextRef, WKStringRef name)
 {
     WebKit::toImpl(contextRef)->setCustomWebContentServiceBundleIdentifier(WebKit::toImpl(name)->string());
index a840a32..3166e37 100644 (file)
@@ -131,8 +131,11 @@ WK_EXPORT WKCacheModel WKContextGetCacheModel(WKContextRef context);
 // FIXME: Move these to WKDeprecatedFunctions.cpp once support for Mavericks has been dropped.
 WK_EXPORT void WKContextSetProcessModel(WKContextRef, WKProcessModel);
 
-WK_EXPORT void WKContextSetMaximumNumberOfProcesses(WKContextRef context, unsigned numberOfProcesses);
-WK_EXPORT unsigned WKContextGetMaximumNumberOfProcesses(WKContextRef context);
+WK_EXPORT void WKContextSetMaximumNumberOfProcesses(WKContextRef context, unsigned numberOfProcesses) WK_C_API_DEPRECATED;
+WK_EXPORT unsigned WKContextGetMaximumNumberOfProcesses(WKContextRef context) WK_C_API_DEPRECATED;
+
+WK_EXPORT void WKContextSetUsesSingleWebProcess(WKContextRef, bool);
+WK_EXPORT bool WKContextGetUsesSingleWebProcess(WKContextRef);
 
 WK_EXPORT void WKContextStartMemorySampler(WKContextRef context, WKDoubleRef interval);
 WK_EXPORT void WKContextStopMemorySampler(WKContextRef context);
index a18381a..298b44e 100644 (file)
@@ -199,11 +199,6 @@ static WKProcessPool *sharedProcessPool;
     _processPool->registerURLSchemeAsCanDisplayOnlyIfCanRequest(scheme);
 }
 
-- (void)_setMaximumNumberOfProcesses:(NSUInteger)value
-{
-    _processPool->setMaximumNumberOfProcesses(value);
-}
-
 - (void)_setCanHandleHTTPSServerTrustEvaluation:(BOOL)value
 {
     _processPool->setCanHandleHTTPSServerTrustEvaluation(value);
index 3de2c03..470dd53 100644 (file)
 // Test only.
 - (void)_setAllowsAnySSLCertificateForServiceWorker:(BOOL)allows WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
 - (void)_registerURLSchemeServiceWorkersCanHandle:(NSString *)scheme WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
-- (void)_setMaximumNumberOfProcesses:(NSUInteger)value WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
 - (void)_getActivePagesOriginsInWebProcessForTesting:(pid_t)pid completionHandler:(void(^)(NSArray<NSString *> *))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 - (BOOL)_networkProcessHasEntitlementForTesting:(NSString *)entitlement WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
index 71021fe..54a56e9 100644 (file)
@@ -34,7 +34,8 @@ WK_CLASS_AVAILABLE(macosx(10.10), ios(8.0))
 @interface _WKProcessPoolConfiguration : NSObject <NSCopying>
 
 @property (nonatomic, copy) NSURL *injectedBundleURL;
-@property (nonatomic) NSUInteger maximumProcessCount;
+@property (nonatomic) NSUInteger maximumProcessCount WK_API_DEPRECATED("It is no longer possible to limit the number of processes", macosx(WK_MAC_TBA, WK_MAC_TBA), ios(WK_IOS_TBA, WK_IOS_TBA));
+@property (nonatomic) BOOL usesSingleWebProcess WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic, nullable, copy) NSString *customWebContentServiceBundleIdentifier WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 @property (nonatomic) BOOL ignoreSynchronousMessagingTimeoutsForTesting WK_API_AVAILABLE(macosx(10.12), ios(10.0));
index 68737d0..07b13eb 100644 (file)
 
 - (NSUInteger)maximumProcessCount
 {
-    return _processPoolConfiguration->maximumProcessCount();
+    // Deprecated.
+    return NSUIntegerMax;
 }
 
 - (void)setMaximumProcessCount:(NSUInteger)maximumProcessCount
 {
-    _processPoolConfiguration->setMaximumProcessCount(maximumProcessCount);
+    // Deprecated.
 }
 
 - (NSInteger)diskCacheSizeOverride
         _processPoolConfiguration->setCacheModel(WebKit::CacheModel::PrimaryWebBrowser);
 }
 
+- (BOOL)usesSingleWebProcess
+{
+    return _processPoolConfiguration->usesSingleWebProcess();
+}
+
+- (void)setUsesSingleWebProcess:(BOOL)enabled
+{
+    _processPoolConfiguration->setUsesSingleWebProcess(enabled);
+}
+
 - (BOOL)suppressesConnectionTerminationOnSystemChange
 {
     return _processPoolConfiguration->suppressesConnectionTerminationOnSystemChange();
 
 - (NSString *)description
 {
-    NSString *description = [NSString stringWithFormat:@"<%@: %p; maximumProcessCount = %lu", NSStringFromClass(self.class), self, static_cast<unsigned long>([self maximumProcessCount])];
+    NSString *description = [NSString stringWithFormat:@"<%@: %p", NSStringFromClass(self.class), self];
 
     if (!_processPoolConfiguration->injectedBundlePath().isEmpty())
         return [description stringByAppendingFormat:@"; injectedBundleURL: \"%@\">", [self injectedBundleURL]];
index 0f39e12..9bc7f67 100644 (file)
@@ -334,7 +334,6 @@ static void webkitWebContextConstructed(GObject* object)
 
     API::ProcessPoolConfiguration configuration;
     configuration.setInjectedBundlePath(WebCore::FileSystem::stringFromFileSystemRepresentation(bundleFilename.get()));
-    configuration.setMaximumProcessCount(1);
     configuration.setDiskCacheSpeculativeValidationEnabled(true);
 
     WebKitWebContext* webContext = WEBKIT_WEB_CONTEXT(object);
@@ -1495,14 +1494,6 @@ void webkit_web_context_set_process_model(WebKitWebContext* context, WebKitProce
         return;
 
     context->priv->processModel = processModel;
-    switch (context->priv->processModel) {
-    case WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS:
-        context->priv->processPool->setMaximumNumberOfProcesses(1);
-        break;
-    case WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES:
-        context->priv->processPool->setMaximumNumberOfProcesses(context->priv->processCountLimit);
-        break;
-    }
 }
 
 /**
@@ -1545,8 +1536,6 @@ void webkit_web_context_set_web_process_count_limit(WebKitWebContext* context, g
         return;
 
     context->priv->processCountLimit = limit;
-    if (context->priv->processModel != WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS)
-        context->priv->processPool->setMaximumNumberOfProcesses(limit);
 }
 
 /**
index a4ca7d9..a3581c3 100644 (file)
@@ -404,11 +404,6 @@ void WebProcessPool::setLegacyCustomProtocolManagerClient(std::unique_ptr<API::C
 #endif
 }
 
-void WebProcessPool::setMaximumNumberOfProcesses(unsigned maximumNumberOfProcesses)
-{
-    m_configuration->setMaximumProcessCount(maximumNumberOfProcesses);
-}
-
 void WebProcessPool::setCustomWebContentServiceBundleIdentifier(const String& customWebContentServiceBundleIdentifier)
 {
     // Guard against API misuse.
@@ -1086,8 +1081,8 @@ void WebProcessPool::disconnectProcess(WebProcessProxy* process)
 
 WebProcessProxy& WebProcessPool::createNewWebProcessRespectingProcessCountLimit(WebsiteDataStore& websiteDataStore)
 {
-    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=168676
-    // Once WebsiteDataStores are truly per-view instead of per-process, remove this nonsense.
+    if (!usesSingleWebProcess())
+        return createNewWebProcess(websiteDataStore);
 
 #if PLATFORM(COCOA)
     bool mustMatchDataStore = API::WebsiteDataStore::defaultDataStoreExists() && &websiteDataStore != &API::WebsiteDataStore::defaultDataStore()->websiteDataStore();
@@ -1095,10 +1090,6 @@ WebProcessProxy& WebProcessPool::createNewWebProcessRespectingProcessCountLimit(
     bool mustMatchDataStore = false;
 #endif
 
-    if (m_processes.size() < maximumNumberOfProcesses())
-        return createNewWebProcess(websiteDataStore);
-
-    WebProcessProxy* processToReuse = nullptr;
     for (auto& process : m_processes) {
         if (mustMatchDataStore && &process->websiteDataStore() != &websiteDataStore)
             continue;
@@ -1106,11 +1097,9 @@ WebProcessProxy& WebProcessPool::createNewWebProcessRespectingProcessCountLimit(
         if (is<ServiceWorkerProcessProxy>(*process))
             continue;
 #endif
-        // Choose the process with fewest pages.
-        if (!processToReuse || processToReuse->pageCount() > process->pageCount())
-            processToReuse = process.get();
+        return *process;
     }
-    return processToReuse ? *processToReuse : createNewWebProcess(websiteDataStore);
+    return createNewWebProcess(websiteDataStore);
 }
 
 Ref<WebPageProxy> WebProcessPool::createWebPage(PageClient& pageClient, Ref<API::PageConfiguration>&& pageConfiguration)
@@ -1296,7 +1285,7 @@ void WebProcessPool::postMessageToInjectedBundle(const String& messageName, API:
 
 void WebProcessPool::didReachGoodTimeToPrewarm()
 {
-    if (!configuration().isAutomaticProcessWarmingEnabled() || !configuration().processSwapsOnNavigation())
+    if (!configuration().isAutomaticProcessWarmingEnabled() || !configuration().processSwapsOnNavigation() || usesSingleWebProcess())
         return;
 
     if (MemoryPressureHandler::singleton().isUnderMemoryPressure()) {
@@ -2157,6 +2146,9 @@ void WebProcessPool::processForNavigationInternal(WebPageProxy& page, const API:
         return createNewWebProcess(page.websiteDataStore());
     };
 
+    if (usesSingleWebProcess())
+        return completionHandler(page.process(), nullptr, "Single WebProcess mode is enabled"_s);
+
     if (processSwapRequestedByClient == ProcessSwapRequestedByClient::Yes)
         return completionHandler(createNewProcess(), nullptr, "Process swap was requested by the client"_s);
 
index dfc0c04..d8f002f 100644 (file)
@@ -153,9 +153,6 @@ public:
     void setAutomationClient(std::unique_ptr<API::AutomationClient>&&);
     void setLegacyCustomProtocolManagerClient(std::unique_ptr<API::CustomProtocolManagerClient>&&);
 
-    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(); }
-
     void setCustomWebContentServiceBundleIdentifier(const String&);
     const String& customWebContentServiceBundleIdentifier() { return m_configuration->customWebContentServiceBundleIdentifier(); }
 
@@ -516,6 +513,8 @@ private:
     static void languageChanged(void* context);
     void languageChanged();
 
+    bool usesSingleWebProcess() const { return m_configuration->usesSingleWebProcess(); }
+
 #if PLATFORM(IOS_FAMILY)
     String cookieStorageDirectory() const;
 #endif
index b9bf4fc..341a01e 100644 (file)
@@ -1,3 +1,25 @@
+2019-01-23  Chris Dumez  <cdumez@apple.com>
+
+        Deprecate API to limit the maximum number of WebProcesses
+        https://bugs.webkit.org/show_bug.cgi?id=193725
+        <rdar://problem/47464879>
+
+        Reviewed by Geoff Garen.
+
+        Update existing API tests to stop using deprecated API.
+
+        * MiniBrowser/mac/AppDelegate.m:
+        (defaultConfiguration):
+        * TestWebKitAPI/Tests/WebKit/UserMedia.cpp:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimer.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
+        * TestWebKitAPI/Tests/WebKitCocoa/UserContentController.mm:
+        (TEST):
+        * TestWebKitAPI/Tests/WebKitCocoa/WKProcessPoolConfiguration.mm:
+        (TEST):
+
 2019-01-23  Aakash Jain  <aakash_jain@apple.com>
 
         [ews-app] Rename ews model buildermappings to buildermapping
index 618d248..2d70d78 100644 (file)
@@ -100,7 +100,7 @@ static WKWebViewConfiguration *defaultConfiguration()
         _WKProcessPoolConfiguration *processConfiguration = [[[_WKProcessPoolConfiguration alloc] init] autorelease];
         processConfiguration.diskCacheSpeculativeValidationEnabled = ![SettingsController shared].networkCacheSpeculativeRevalidationDisabled;
         if ([SettingsController shared].perWindowWebProcessesDisabled)
-            processConfiguration.maximumProcessCount = 1;
+            processConfiguration.usesSingleWebProcess = YES;
         if ([SettingsController shared].processSwapOnWindowOpenWithOpenerEnabled)
             processConfiguration.processSwapsOnWindowOpenWithOpener = true;
         
index fdecb59..2b06b0b 100644 (file)
@@ -106,7 +106,6 @@ static void didCrashCallback(WKPageRef, const void*)
 TEST(WebKit, OnDeviceChangeCrash)
 {
     auto context = adoptWK(WKContextCreateWithConfiguration(nullptr));
-    WKContextSetMaximumNumberOfProcesses(context.get(), 1);
 
     WKRetainPtr<WKPageGroupRef> pageGroup(AdoptWK, WKPageGroupCreateWithIdentifier(Util::toWK("GetUserMedia").get()));
     WKPreferencesRef preferences = WKPageGroupGetPreferences(pageGroup.get());
@@ -131,7 +130,7 @@ TEST(WebKit, OnDeviceChangeCrash)
     WKPageLoadURL(webView.page(), url.get());
 
     // Load a second page in same process.
-    PlatformWebView webView2(context.get(), pageGroup.get());
+    PlatformWebView webView2(webView.page());
     WKPageSetPageUIClient(webView2.page(), &uiClient.base);
     WKPageNavigationClientV0 navigationClient;
     memset(&navigationClient, 0, sizeof(navigationClient));
index 15759b9..7e3dc38 100644 (file)
@@ -60,7 +60,6 @@ TEST(WebKit, ResponsivenessTimerShouldNotFireAfterTearDown)
 {
     auto processPoolConfiguration = adoptNS([_WKProcessPoolConfiguration new]);
     auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
-    [processPool _setMaximumNumberOfProcesses:1];
     auto delegate = adoptNS([ResponsivenessTimerDelegate new]);
 
     auto configuration = adoptNS([WKWebViewConfiguration new]);
index e324c29..3d715b9 100644 (file)
@@ -970,7 +970,6 @@ void setConfigurationInjectedBundlePath(WKWebViewConfiguration* configuration)
     configuration.processPool = (WKProcessPool *)context.get();
     auto pool = configuration.processPool;
     [pool _registerURLSchemeServiceWorkersCanHandle:@"sw"];
-    [pool _setMaximumNumberOfProcesses:5];
 
     configuration.websiteDataStore = (WKWebsiteDataStore *)WKContextGetWebsiteDataStore(context.get());
 }
@@ -1249,8 +1248,6 @@ TEST(ServiceWorkers, HasServiceWorkerRegistrationBit)
     newConfiguration.get().websiteDataStore = [WKWebsiteDataStore nonPersistentDataStore];
     [newConfiguration.get().websiteDataStore _setServiceWorkerRegistrationDirectory: @"~/nonexistingfolder"];
 
-    [newConfiguration.get().processPool _setMaximumNumberOfProcesses:1];
-
     webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:newConfiguration.get()]);
     request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"sw://host/regularPageWithoutConnection.html"]];
     [webView loadRequest:request];
@@ -1261,14 +1258,14 @@ TEST(ServiceWorkers, HasServiceWorkerRegistrationBit)
     newConfiguration.get().websiteDataStore = [configuration websiteDataStore];
 
     webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:newConfiguration.get()]);
-    EXPECT_EQ(1u, webView.get().configuration.processPool._webProcessCountIgnoringPrewarmed);
+    EXPECT_EQ(2u, webView.get().configuration.processPool._webProcessCountIgnoringPrewarmed);
     request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"sw://host/regularPageWithConnection.html"]];
     [webView loadRequest:request];
     TestWebKitAPI::Util::run(&done);
     done = false;
 
     // Make sure that loading the simple page did not start the service worker process.
-    EXPECT_EQ(1u, webView.get().configuration.processPool._webProcessCountIgnoringPrewarmed);
+    EXPECT_EQ(2u, webView.get().configuration.processPool._webProcessCountIgnoringPrewarmed);
 
     [[configuration websiteDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() {
         done = true;
index 6171645..8061ead 100644 (file)
@@ -237,7 +237,6 @@ TEST(WKUserContentController, ScriptMessageHandlerMultipleHandlerRemoval)
 {
     RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
     RetainPtr<_WKProcessPoolConfiguration> processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);
-    [processPoolConfiguration setMaximumProcessCount:1];
     [configuration setProcessPool:[[[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()] autorelease]];
 
     RetainPtr<WKWebView> webView = webViewForScriptMessageHandlerMultipleHandlerRemovalTest(configuration.get());
index a84ef58..5e12eaf 100644 (file)
@@ -36,7 +36,6 @@ TEST(WKProcessPoolConfiguration, Copy)
     auto configuration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);
 
     [configuration setInjectedBundleURL:[NSURL fileURLWithPath:@"/path/to/injected.wkbundle"]];
-    [configuration setMaximumProcessCount:42];
     [configuration setCustomWebContentServiceBundleIdentifier:@"org.webkit.WebContent.custom"];
     [configuration setIgnoreSynchronousMessagingTimeoutsForTesting:YES];
     [configuration setAttrStyleEnabled:YES];
@@ -65,7 +64,6 @@ TEST(WKProcessPoolConfiguration, Copy)
     auto copy = adoptNS([configuration copy]);
 
     EXPECT_TRUE([[configuration injectedBundleURL] isEqual:[copy injectedBundleURL]]);
-    EXPECT_EQ([configuration maximumProcessCount], [copy maximumProcessCount]);
     EXPECT_TRUE([[configuration customWebContentServiceBundleIdentifier] isEqual:[copy customWebContentServiceBundleIdentifier]]);
     EXPECT_EQ([configuration ignoreSynchronousMessagingTimeoutsForTesting], [copy ignoreSynchronousMessagingTimeoutsForTesting]);
     EXPECT_EQ([configuration attrStyleEnabled], [copy attrStyleEnabled]);