Make process-swap-on-navigation an experimental feature.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Jul 2018 20:47:05 +0000 (20:47 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Jul 2018 20:47:05 +0000 (20:47 +0000)
<rdar://problem/41995053> and https://bugs.webkit.org/show_bug.cgi?id=187558

Reviewed by Geoff Garen.

* Shared/WebPreferences.yaml:

* UIProcess/WebPreferences.cpp:
(WebKit::WebPreferences::updateBoolValueForExperimentalFeatureKey):

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::createWebPage): If the new web page has PSON enabled via WebPreferences,
  absorb that setting into this process pool's configuration.

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

Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKit/UIProcess/WebPreferences.cpp
Source/WebKit/UIProcess/WebProcessPool.cpp

index bf15bb0..767022b 100644 (file)
@@ -1,3 +1,19 @@
+2018-07-11  Brady Eidson  <beidson@apple.com>
+
+        Make process-swap-on-navigation an experimental feature.
+        <rdar://problem/41995053> and https://bugs.webkit.org/show_bug.cgi?id=187558
+
+        Reviewed by Geoff Garen.
+
+        * Shared/WebPreferences.yaml:
+
+        * UIProcess/WebPreferences.cpp:
+        (WebKit::WebPreferences::updateBoolValueForExperimentalFeatureKey):
+
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::createWebPage): If the new web page has PSON enabled via WebPreferences,
+          absorb that setting into this process pool's configuration.
+
 2018-07-11  Jer Noble  <jer.noble@apple.com>
 
         Disable all network caching for HLS streams.
index 0ec44f6..c73c4dd 100644 (file)
@@ -1283,3 +1283,12 @@ EncryptedMediaAPIEnabled:
   webcoreBinding: RuntimeEnabledFeatures
   category: experimental
   condition: ENABLE(ENCRYPTED_MEDIA)
+
+ProcessSwapOnNavigationEnabled:
+  type: bool
+  defaultValue: false
+  humanReadableName: "Swap Processes on Navigation"
+  humanReadableDescription: "Swap WebContent processes on cross-origin navigations"
+  category: experimental
+  webcoreBinding: none
+
index 830e0d7..62cadec 100644 (file)
@@ -133,6 +133,13 @@ void WebPreferences::updateBoolValueForKey(const String& key, bool value)
 
 void WebPreferences::updateBoolValueForExperimentalFeatureKey(const String& key, bool value)
 {
+    if (key == WebPreferencesKey::processSwapOnNavigationEnabledKey()) {
+        for (auto* page : m_pages)
+            page->process().processPool().configuration().setProcessSwapsOnNavigation(value);
+
+        return;
+    }
+
     update(); // FIXME: Only send over the changed key and value.
 }
 
index 6991438..e81e20b 100644 (file)
@@ -1149,7 +1149,11 @@ Ref<WebPageProxy> WebProcessPool::createWebPage(PageClient& pageClient, Ref<API:
     ASSERT(!is<ServiceWorkerProcessProxy>(*process));
 #endif
 
-    return process->createWebPage(pageClient, WTFMove(pageConfiguration));
+    auto page = process->createWebPage(pageClient, WTFMove(pageConfiguration));
+    if (page->preferences().processSwapOnNavigationEnabled())
+        m_configuration->setProcessSwapsOnNavigation(true);
+
+    return page;
 }
 
 #if ENABLE(SERVICE_WORKER)