Title: [238183] trunk/Source/WebKit
Revision
238183
Author
cdu...@apple.com
Date
2018-11-14 10:13:13 -0800 (Wed, 14 Nov 2018)

Log Message

Client should be able to disable PSON even if the experimental feature is on by default
https://bugs.webkit.org/show_bug.cgi?id=191634

Reviewed by Dean Jackson.

Instead of overriding the APIProcessPoolConfiguration's m_processSwapsOnNavigation flag to true
when the experimental is enabled, use a separate flag to store this information. If the client
explicitly sets the APIProcessPoolConfiguration's m_processSwapsOnNavigation flag then we obey
the client's request, otherwise, we fall back to using the state from experimental features.

This allows:
- API tests to explicitely disable PSON / Process prewarming even if those are on by default
  in experimental features.
- If the client does not set those flags on the APIProcessPoolConfiguration (Safari for e.g.),
  then the experimental feature flag still fully controls the feature.

* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::copy):
* UIProcess/API/APIProcessPoolConfiguration.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::createWebPage):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (238182 => 238183)


--- trunk/Source/WebKit/ChangeLog	2018-11-14 17:53:21 UTC (rev 238182)
+++ trunk/Source/WebKit/ChangeLog	2018-11-14 18:13:13 UTC (rev 238183)
@@ -1,5 +1,29 @@
 2018-11-14  Chris Dumez  <cdu...@apple.com>
 
+        Client should be able to disable PSON even if the experimental feature is on by default
+        https://bugs.webkit.org/show_bug.cgi?id=191634
+
+        Reviewed by Dean Jackson.
+
+        Instead of overriding the APIProcessPoolConfiguration's m_processSwapsOnNavigation flag to true
+        when the experimental is enabled, use a separate flag to store this information. If the client
+        explicitly sets the APIProcessPoolConfiguration's m_processSwapsOnNavigation flag then we obey
+        the client's request, otherwise, we fall back to using the state from experimental features.
+
+        This allows:
+        - API tests to explicitely disable PSON / Process prewarming even if those are on by default
+          in experimental features.
+        - If the client does not set those flags on the APIProcessPoolConfiguration (Safari for e.g.),
+          then the experimental feature flag still fully controls the feature.
+
+        * UIProcess/API/APIProcessPoolConfiguration.cpp:
+        (API::ProcessPoolConfiguration::copy):
+        * UIProcess/API/APIProcessPoolConfiguration.h:
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::createWebPage):
+
+2018-11-14  Chris Dumez  <cdu...@apple.com>
+
         WebKit.ApplicationManifestBasic API test is failing when enabling PSON
         https://bugs.webkit.org/show_bug.cgi?id=191602
 

Modified: trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp (238182 => 238183)


--- trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp	2018-11-14 17:53:21 UTC (rev 238182)
+++ trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp	2018-11-14 18:13:13 UTC (rev 238183)
@@ -120,10 +120,11 @@
     copy->m_ctDataConnectionServiceType = this->m_ctDataConnectionServiceType;
 #endif
     copy->m_presentingApplicationPID = this->m_presentingApplicationPID;
-    copy->m_processSwapsOnNavigation = this->m_processSwapsOnNavigation;
+    copy->m_processSwapsOnNavigationFromClient = this->m_processSwapsOnNavigationFromClient;
+    copy->m_processSwapsOnNavigationFromExperimentalFeatures = this->m_processSwapsOnNavigationFromExperimentalFeatures;
     copy->m_alwaysKeepAndReuseSwappedProcesses = this->m_alwaysKeepAndReuseSwappedProcesses;
     copy->m_processSwapsOnWindowOpenWithOpener = this->m_processSwapsOnWindowOpenWithOpener;
-    copy->m_isAutomaticProcessWarmingEnabled = this->m_isAutomaticProcessWarmingEnabled;
+    copy->m_isAutomaticProcessWarmingEnabledByClient = this->m_isAutomaticProcessWarmingEnabledByClient;
 #if ENABLE(PROXIMITY_NETWORKING)
     copy->m_wirelessContextIdentifier = this->m_wirelessContextIdentifier;
 #endif

Modified: trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h (238182 => 238183)


--- trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h	2018-11-14 17:53:21 UTC (rev 238182)
+++ trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h	2018-11-14 18:13:13 UTC (rev 238183)
@@ -59,8 +59,13 @@
     unsigned maximumProcessCount() const { return m_maximumProcessCount; }
     void setMaximumProcessCount(unsigned maximumProcessCount) { m_maximumProcessCount = maximumProcessCount; }
 
-    bool isAutomaticProcessWarmingEnabled() const { return m_isAutomaticProcessWarmingEnabled; }
-    void setIsAutomaticProcessWarmingEnabled(bool value) { m_isAutomaticProcessWarmingEnabled = value; }
+    bool isAutomaticProcessWarmingEnabled() const
+    {
+        // FIXME: For now, turning on PSON from the experimental features menu also turns on
+        // automatic process warming until clients can be updated.
+        return m_isAutomaticProcessWarmingEnabledByClient.value_or(m_processSwapsOnNavigationFromExperimentalFeatures);
+    }
+    void setIsAutomaticProcessWarmingEnabled(bool value) { m_isAutomaticProcessWarmingEnabledByClient = value; }
 
     bool diskCacheSpeculativeValidationEnabled() const { return m_diskCacheSpeculativeValidationEnabled; }
     void setDiskCacheSpeculativeValidationEnabled(bool enabled) { m_diskCacheSpeculativeValidationEnabled = enabled; }
@@ -150,8 +155,12 @@
     ProcessID presentingApplicationPID() const { return m_presentingApplicationPID; }
     void setPresentingApplicationPID(ProcessID pid) { m_presentingApplicationPID = pid; }
 
-    bool processSwapsOnNavigation() const { return m_processSwapsOnNavigation; }
-    void setProcessSwapsOnNavigation(bool swaps) { m_processSwapsOnNavigation = swaps; }
+    bool processSwapsOnNavigation() const
+    {
+        return m_processSwapsOnNavigationFromClient.value_or(m_processSwapsOnNavigationFromExperimentalFeatures);
+    }
+    void setProcessSwapsOnNavigation(bool swaps) { m_processSwapsOnNavigationFromClient = swaps; }
+    void setProcessSwapsOnNavigationFromExperimentalFeatures(bool swaps) { m_processSwapsOnNavigationFromExperimentalFeatures = swaps; }
 
     bool alwaysKeepAndReuseSwappedProcesses() const { return m_alwaysKeepAndReuseSwappedProcesses; }
     void setAlwaysKeepAndReuseSwappedProcesses(bool keepAndReuse) { m_alwaysKeepAndReuseSwappedProcesses = keepAndReuse; }
@@ -205,10 +214,11 @@
     bool m_shouldCaptureAudioInUIProcess { false };
     bool m_shouldCaptureDisplayInUIProcess { DEFAULT_CAPTURE_DISPLAY_IN_UI_PROCESS };
     ProcessID m_presentingApplicationPID { getCurrentProcessID() };
-    bool m_processSwapsOnNavigation { false };
+    std::optional<bool> m_processSwapsOnNavigationFromClient;
+    bool m_processSwapsOnNavigationFromExperimentalFeatures { false };
     bool m_alwaysKeepAndReuseSwappedProcesses { false };
     bool m_processSwapsOnWindowOpenWithOpener { false };
-    bool m_isAutomaticProcessWarmingEnabled { false };
+    std::optional<bool> m_isAutomaticProcessWarmingEnabledByClient { false };
     WTF::String m_customWebContentServiceBundleIdentifier;
 
 #if PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (238182 => 238183)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2018-11-14 17:53:21 UTC (rev 238182)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2018-11-14 18:13:13 UTC (rev 238183)
@@ -1126,12 +1126,7 @@
 #endif
 
     auto page = process->createWebPage(pageClient, WTFMove(pageConfiguration));
-    if (page->preferences().processSwapOnCrossSiteNavigationEnabled()) {
-        m_configuration->setProcessSwapsOnNavigation(true);
-        // FIXME: For now, turning on PSON from the debug features menu also turns on
-        // automatic process warming until clients can be updated.
-        m_configuration->setIsAutomaticProcessWarmingEnabled(true);
-    }
+    m_configuration->setProcessSwapsOnNavigationFromExperimentalFeatures(page->preferences().processSwapOnCrossSiteNavigationEnabled());
 
     return page;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to