Changeset 238183 in webkit


Ignore:
Timestamp:
Nov 14, 2018 10:13:13 AM (5 years ago)
Author:
Chris Dumez
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):

Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r238179 r238183  
     12018-11-14  Chris Dumez  <cdumez@apple.com>
     2
     3        Client should be able to disable PSON even if the experimental feature is on by default
     4        https://bugs.webkit.org/show_bug.cgi?id=191634
     5
     6        Reviewed by Dean Jackson.
     7
     8        Instead of overriding the APIProcessPoolConfiguration's m_processSwapsOnNavigation flag to true
     9        when the experimental is enabled, use a separate flag to store this information. If the client
     10        explicitly sets the APIProcessPoolConfiguration's m_processSwapsOnNavigation flag then we obey
     11        the client's request, otherwise, we fall back to using the state from experimental features.
     12
     13        This allows:
     14        - API tests to explicitely disable PSON / Process prewarming even if those are on by default
     15          in experimental features.
     16        - If the client does not set those flags on the APIProcessPoolConfiguration (Safari for e.g.),
     17          then the experimental feature flag still fully controls the feature.
     18
     19        * UIProcess/API/APIProcessPoolConfiguration.cpp:
     20        (API::ProcessPoolConfiguration::copy):
     21        * UIProcess/API/APIProcessPoolConfiguration.h:
     22        * UIProcess/WebProcessPool.cpp:
     23        (WebKit::WebProcessPool::createWebPage):
     24
    1252018-11-14  Chris Dumez  <cdumez@apple.com>
    226
  • trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp

    r238076 r238183  
    121121#endif
    122122    copy->m_presentingApplicationPID = this->m_presentingApplicationPID;
    123     copy->m_processSwapsOnNavigation = this->m_processSwapsOnNavigation;
     123    copy->m_processSwapsOnNavigationFromClient = this->m_processSwapsOnNavigationFromClient;
     124    copy->m_processSwapsOnNavigationFromExperimentalFeatures = this->m_processSwapsOnNavigationFromExperimentalFeatures;
    124125    copy->m_alwaysKeepAndReuseSwappedProcesses = this->m_alwaysKeepAndReuseSwappedProcesses;
    125126    copy->m_processSwapsOnWindowOpenWithOpener = this->m_processSwapsOnWindowOpenWithOpener;
    126     copy->m_isAutomaticProcessWarmingEnabled = this->m_isAutomaticProcessWarmingEnabled;
     127    copy->m_isAutomaticProcessWarmingEnabledByClient = this->m_isAutomaticProcessWarmingEnabledByClient;
    127128#if ENABLE(PROXIMITY_NETWORKING)
    128129    copy->m_wirelessContextIdentifier = this->m_wirelessContextIdentifier;
  • trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h

    r237281 r238183  
    6060    void setMaximumProcessCount(unsigned maximumProcessCount) { m_maximumProcessCount = maximumProcessCount; }
    6161
    62     bool isAutomaticProcessWarmingEnabled() const { return m_isAutomaticProcessWarmingEnabled; }
    63     void setIsAutomaticProcessWarmingEnabled(bool value) { m_isAutomaticProcessWarmingEnabled = value; }
     62    bool isAutomaticProcessWarmingEnabled() const
     63    {
     64        // FIXME: For now, turning on PSON from the experimental features menu also turns on
     65        // automatic process warming until clients can be updated.
     66        return m_isAutomaticProcessWarmingEnabledByClient.value_or(m_processSwapsOnNavigationFromExperimentalFeatures);
     67    }
     68    void setIsAutomaticProcessWarmingEnabled(bool value) { m_isAutomaticProcessWarmingEnabledByClient = value; }
    6469
    6570    bool diskCacheSpeculativeValidationEnabled() const { return m_diskCacheSpeculativeValidationEnabled; }
     
    151156    void setPresentingApplicationPID(ProcessID pid) { m_presentingApplicationPID = pid; }
    152157
    153     bool processSwapsOnNavigation() const { return m_processSwapsOnNavigation; }
    154     void setProcessSwapsOnNavigation(bool swaps) { m_processSwapsOnNavigation = swaps; }
     158    bool processSwapsOnNavigation() const
     159    {
     160        return m_processSwapsOnNavigationFromClient.value_or(m_processSwapsOnNavigationFromExperimentalFeatures);
     161    }
     162    void setProcessSwapsOnNavigation(bool swaps) { m_processSwapsOnNavigationFromClient = swaps; }
     163    void setProcessSwapsOnNavigationFromExperimentalFeatures(bool swaps) { m_processSwapsOnNavigationFromExperimentalFeatures = swaps; }
    155164
    156165    bool alwaysKeepAndReuseSwappedProcesses() const { return m_alwaysKeepAndReuseSwappedProcesses; }
     
    206215    bool m_shouldCaptureDisplayInUIProcess { DEFAULT_CAPTURE_DISPLAY_IN_UI_PROCESS };
    207216    ProcessID m_presentingApplicationPID { getCurrentProcessID() };
    208     bool m_processSwapsOnNavigation { false };
     217    std::optional<bool> m_processSwapsOnNavigationFromClient;
     218    bool m_processSwapsOnNavigationFromExperimentalFeatures { false };
    209219    bool m_alwaysKeepAndReuseSwappedProcesses { false };
    210220    bool m_processSwapsOnWindowOpenWithOpener { false };
    211     bool m_isAutomaticProcessWarmingEnabled { false };
     221    std::optional<bool> m_isAutomaticProcessWarmingEnabledByClient { false };
    212222    WTF::String m_customWebContentServiceBundleIdentifier;
    213223
  • trunk/Source/WebKit/UIProcess/WebProcessPool.cpp

    r238174 r238183  
    11271127
    11281128    auto page = process->createWebPage(pageClient, WTFMove(pageConfiguration));
    1129     if (page->preferences().processSwapOnCrossSiteNavigationEnabled()) {
    1130         m_configuration->setProcessSwapsOnNavigation(true);
    1131         // FIXME: For now, turning on PSON from the debug features menu also turns on
    1132         // automatic process warming until clients can be updated.
    1133         m_configuration->setIsAutomaticProcessWarmingEnabled(true);
    1134     }
     1129    m_configuration->setProcessSwapsOnNavigationFromExperimentalFeatures(page->preferences().processSwapOnCrossSiteNavigationEnabled());
    11351130
    11361131    return page;
Note: See TracChangeset for help on using the changeset viewer.