Changeset 250148 in webkit


Ignore:
Timestamp:
Sep 20, 2019 1:36:57 PM (5 years ago)
Author:
achristensen@apple.com
Message:

Introduce LegacyGlobalSettings for settings the NetworkProcess needs from a WebProcessPool
https://bugs.webkit.org/show_bug.cgi?id=201970

Reviewed by Geoff Garen.

I'm starting by moving the cache model to this new abstraction.
We were using it in tests to disable the page cache, which should be done with a boolean on the pool configuration, not by changing the cache model.
We were also using it in WKContextSetCacheModel which has several clients that won't change quickly, so this abstraction is used to maintain existing behavior.
I need this so I can make a NetworkProcess not depend on anything from a WebProcessPool when starting.

  • Sources.txt:
  • UIProcess/API/APIProcessPoolConfiguration.cpp:

(API::ProcessPoolConfiguration::copy):

  • UIProcess/API/APIProcessPoolConfiguration.h:
  • UIProcess/API/C/WKContext.cpp:

(WKContextSetCacheModel):
(WKContextGetCacheModel):

  • UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:

(-[_WKProcessPoolConfiguration pageCacheEnabled]):
(-[_WKProcessPoolConfiguration setPageCacheEnabled:]):

  • UIProcess/LegacyGlobalSettings.cpp: Added.

(WebKit::LegacyGlobalSettings::singleton):
(WebKit::LegacyGlobalSettings::setCacheModel):

  • UIProcess/LegacyGlobalSettings.h: Added.

(WebKit::LegacyGlobalSettings::cacheModel const):

  • UIProcess/WebProcessCache.cpp:

(WebKit::WebProcessCache::updateCapacity):

  • UIProcess/WebProcessPool.cpp:

(WebKit::WebProcessPool::ensureNetworkProcess):
(WebKit::WebProcessPool::initializeNewWebProcess):
(WebKit::WebProcessPool::updateMaxSuspendedPageCount):
(WebKit::WebProcessPool::setCacheModel):

  • UIProcess/WebProcessPool.h:
  • WebKit.xcodeproj/project.pbxproj:
Location:
trunk/Source/WebKit
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r250146 r250148  
     12019-09-20  Alex Christensen  <achristensen@webkit.org>
     2
     3        Introduce LegacyGlobalSettings for settings the NetworkProcess needs from a WebProcessPool
     4        https://bugs.webkit.org/show_bug.cgi?id=201970
     5
     6        Reviewed by Geoff Garen.
     7
     8        I'm starting by moving the cache model to this new abstraction.
     9        We were using it in tests to disable the page cache, which should be done with a boolean on the pool configuration, not by changing the cache model.
     10        We were also using it in WKContextSetCacheModel which has several clients that won't change quickly, so this abstraction is used to maintain existing behavior.
     11        I need this so I can make a NetworkProcess not depend on anything from a WebProcessPool when starting.
     12
     13        * Sources.txt:
     14        * UIProcess/API/APIProcessPoolConfiguration.cpp:
     15        (API::ProcessPoolConfiguration::copy):
     16        * UIProcess/API/APIProcessPoolConfiguration.h:
     17        * UIProcess/API/C/WKContext.cpp:
     18        (WKContextSetCacheModel):
     19        (WKContextGetCacheModel):
     20        * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
     21        (-[_WKProcessPoolConfiguration pageCacheEnabled]):
     22        (-[_WKProcessPoolConfiguration setPageCacheEnabled:]):
     23        * UIProcess/LegacyGlobalSettings.cpp: Added.
     24        (WebKit::LegacyGlobalSettings::singleton):
     25        (WebKit::LegacyGlobalSettings::setCacheModel):
     26        * UIProcess/LegacyGlobalSettings.h: Added.
     27        (WebKit::LegacyGlobalSettings::cacheModel const):
     28        * UIProcess/WebProcessCache.cpp:
     29        (WebKit::WebProcessCache::updateCapacity):
     30        * UIProcess/WebProcessPool.cpp:
     31        (WebKit::WebProcessPool::ensureNetworkProcess):
     32        (WebKit::WebProcessPool::initializeNewWebProcess):
     33        (WebKit::WebProcessPool::updateMaxSuspendedPageCount):
     34        (WebKit::WebProcessPool::setCacheModel):
     35        * UIProcess/WebProcessPool.h:
     36        * WebKit.xcodeproj/project.pbxproj:
     37
    1382019-09-20  Alex Christensen  <achristensen@webkit.org>
    239
  • trunk/Source/WebKit/Sources.txt

    r249778 r250148  
    245245UIProcess/GeolocationPermissionRequestProxy.cpp
    246246UIProcess/InspectorTargetProxy.cpp
     247UIProcess/LegacyGlobalSettings.cpp
    247248UIProcess/PageLoadState.cpp
    248249UIProcess/ProcessAssertion.cpp
  • trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp

    r250143 r250148  
    4545    auto copy = this->create();
    4646
    47     copy->m_cacheModel = this->m_cacheModel;
    4847    copy->m_diskCacheSpeculativeValidationEnabled = this->m_diskCacheSpeculativeValidationEnabled;
    4948    copy->m_injectedBundlePath = this->m_injectedBundlePath;
     
    7372    copy->m_isAutomaticProcessWarmingEnabledByClient = this->m_isAutomaticProcessWarmingEnabledByClient;
    7473    copy->m_usesWebProcessCache = this->m_usesWebProcessCache;
     74    copy->m_usesPageCache = this->m_usesPageCache;
    7575#if PLATFORM(COCOA)
    7676    copy->m_suppressesConnectionTerminationOnSystemChange = this->m_suppressesConnectionTerminationOnSystemChange;
  • trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h

    r250143 r250148  
    7575    void setDiskCacheSpeculativeValidationEnabled(bool enabled) { m_diskCacheSpeculativeValidationEnabled = enabled; }
    7676
    77     WebKit::CacheModel cacheModel() const { return m_cacheModel; }
    78     void setCacheModel(WebKit::CacheModel cacheModel) { m_cacheModel = cacheModel; }
     77    void setUsesPageCache(bool value) { m_usesPageCache = value; }
     78    bool usesPageCache() const { return m_usesPageCache; }
    7979
    8080    const WTF::String& injectedBundlePath() const { return m_injectedBundlePath; }
     
    159159private:
    160160    bool m_diskCacheSpeculativeValidationEnabled { false };
    161     WebKit::CacheModel m_cacheModel { WebKit::CacheModel::PrimaryWebBrowser };
    162161
    163162    WTF::String m_injectedBundlePath;
     
    182181    Optional<bool> m_isAutomaticProcessWarmingEnabledByClient;
    183182    bool m_usesWebProcessCache { false };
     183    bool m_usesPageCache { true };
    184184    bool m_clientWouldBenefitFromAutomaticProcessPrewarming { false };
    185185    WTF::String m_customWebContentServiceBundleIdentifier;
  • trunk/Source/WebKit/UIProcess/API/C/WKContext.cpp

    r249671 r250148  
    3636#include "AuthenticationChallengeProxy.h"
    3737#include "DownloadProxy.h"
     38#include "LegacyGlobalSettings.h"
    3839#include "WKAPICast.h"
    3940#include "WKArray.h"
     
    321322void WKContextSetCacheModel(WKContextRef contextRef, WKCacheModel cacheModel)
    322323{
    323     WebKit::toImpl(contextRef)->setCacheModel(WebKit::toCacheModel(cacheModel));
     324    LegacyGlobalSettings::singleton().setCacheModel(WebKit::toCacheModel(cacheModel));
    324325}
    325326
    326327WKCacheModel WKContextGetCacheModel(WKContextRef contextRef)
    327328{
    328     return WebKit::toAPI(WebKit::toImpl(contextRef)->cacheModel());
     329    return WebKit::toAPI(LegacyGlobalSettings::singleton().cacheModel());
    329330}
    330331
  • trunk/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm

    r250093 r250148  
    2727#import "_WKProcessPoolConfigurationInternal.h"
    2828
     29#import "LegacyGlobalSettings.h"
    2930#import <objc/runtime.h>
    3031#import <wtf/RetainPtr.h>
     
    314315- (BOOL)pageCacheEnabled
    315316{
    316     return _processPoolConfiguration->cacheModel() != WebKit::CacheModel::DocumentViewer;
     317    return _processPoolConfiguration->usesPageCache();
    317318}
    318319
    319320- (void)setPageCacheEnabled:(BOOL)enabled
    320321{
    321     if (!enabled)
    322         _processPoolConfiguration->setCacheModel(WebKit::CacheModel::DocumentViewer);
    323     else if (![self pageCacheEnabled])
    324         _processPoolConfiguration->setCacheModel(WebKit::CacheModel::PrimaryWebBrowser);
     322    return _processPoolConfiguration->setUsesPageCache(enabled);
    325323}
    326324
  • trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp

    r250143 r250148  
    2828#include "APIProcessPoolConfiguration.h"
    2929#include "APIString.h"
     30#include "LegacyGlobalSettings.h"
    3031#include "TextChecker.h"
    3132#include "TextCheckerState.h"
     
    691692 * %WEBKIT_CACHE_MODEL_WEB_BROWSER.
    692693 */
    693 void webkit_web_context_set_cache_model(WebKitWebContext* context, WebKitCacheModel model)
     694void webkit_web_context_set_cache_model(WebKitWebContext*, WebKitCacheModel model)
    694695{
    695696    CacheModel cacheModel;
    696 
    697     g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
    698697
    699698    switch (model) {
     
    711710    }
    712711
    713     if (cacheModel != context->priv->processPool->cacheModel())
    714         context->priv->processPool->setCacheModel(cacheModel);
     712    if (cacheModel != LegacyGlobalSettings::singleton().cacheModel())
     713        LegacyGlobalSettings::singleton().setCacheModel(cacheModel);
    715714}
    716715
     
    729728    g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), WEBKIT_CACHE_MODEL_WEB_BROWSER);
    730729
    731     switch (context->priv->processPool->cacheModel()) {
     730    switch (LegacyGlobalSettings::singleton().cacheModel()) {
    732731    case CacheModel::DocumentViewer:
    733732        return WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER;
  • trunk/Source/WebKit/UIProcess/WebProcessCache.cpp

    r249948 r250148  
    2727#include "WebProcessCache.h"
    2828
     29#include "LegacyGlobalSettings.h"
    2930#include "Logging.h"
    3031#include "WebProcessPool.h"
     
    151152void WebProcessCache::updateCapacity(WebProcessPool& processPool)
    152153{
    153     if (!processPool.configuration().processSwapsOnNavigation() || !processPool.configuration().usesWebProcessCache() || processPool.cacheModel() != CacheModel::PrimaryWebBrowser) {
     154    if (!processPool.configuration().processSwapsOnNavigation() || !processPool.configuration().usesWebProcessCache() || LegacyGlobalSettings::singleton().cacheModel() != CacheModel::PrimaryWebBrowser) {
    154155        if (!processPool.configuration().processSwapsOnNavigation())
    155156            RELEASE_LOG(ProcessSwapping, "%p - WebProcessCache::updateCapacity: Cache is disabled because process swap on navigation is disabled", this);
  • trunk/Source/WebKit/UIProcess/WebProcessPool.cpp

    r250144 r250148  
    493493    }
    494494
    495     parameters.cacheModel = cacheModel();
     495    parameters.cacheModel = LegacyGlobalSettings::singleton().cacheModel();
    496496    parameters.canHandleHTTPSServerTrustEvaluation = m_canHandleHTTPSServerTrustEvaluation;
    497497
     
    920920#endif
    921921
    922     parameters.cacheModel = cacheModel();
     922    parameters.cacheModel = LegacyGlobalSettings::singleton().cacheModel();
    923923    parameters.languages = configuration().overrideLanguages().isEmpty() ? userPreferredLanguages() : configuration().overrideLanguages();
    924924
     
    15761576void WebProcessPool::updateMaxSuspendedPageCount()
    15771577{
     1578    if (!m_configuration->usesPageCache())
     1579        return;
     1580
    15781581    unsigned dummy = 0;
    15791582    Seconds dummyInterval;
    15801583    unsigned pageCacheSize = 0;
    1581     calculateMemoryCacheSizes(m_configuration->cacheModel(), dummy, dummy, dummy, dummyInterval, pageCacheSize);
     1584    calculateMemoryCacheSizes(LegacyGlobalSettings::singleton().cacheModel(), dummy, dummy, dummy, dummyInterval, pageCacheSize);
    15821585
    15831586    m_maxSuspendedPageCount = pageCacheSize;
     
    15891592void WebProcessPool::setCacheModel(CacheModel cacheModel)
    15901593{
    1591     m_configuration->setCacheModel(cacheModel);
    15921594    updateMaxSuspendedPageCount();
    15931595
  • trunk/Source/WebKit/UIProcess/WebProcessPool.h

    r250143 r250148  
    282282
    283283    void setCacheModel(CacheModel);
    284     CacheModel cacheModel() const { return m_configuration->cacheModel(); }
    285284
    286285    void setDefaultRequestTimeoutInterval(double);
  • trunk/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp

    r250077 r250148  
    2929#include "WebProcessPool.h"
    3030
     31#include "LegacyGlobalSettings.h"
    3132#include "WebMemoryPressureHandler.h"
    3233#include "WebProcessCreationParameters.h"
     
    126127#endif
    127128
    128     parameters.memoryCacheDisabled = m_memoryCacheDisabled || cacheModel() == CacheModel::DocumentViewer;
     129    parameters.memoryCacheDisabled = m_memoryCacheDisabled || LegacyGlobalSettings::singleton().cacheModel() == CacheModel::DocumentViewer;
    129130    parameters.proxySettings = m_networkProxySettings;
    130131
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r249778 r250148  
    17261726                        filePatterns = "*.h";
    17271727                        fileType = pattern.proxy;
     1728                        inputFiles = (
     1729                        );
    17281730                        isEditable = 1;
    17291731                        outputFiles = (
     
    36953697                5CE9120C2293C1E0005BEC78 /* WKMain.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKMain.mm; sourceTree = "<group>"; };
    36963698                5CE9120F2293C25F005BEC78 /* AuxiliaryProcessMain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AuxiliaryProcessMain.cpp; path = Cocoa/AuxiliaryProcessMain.cpp; sourceTree = "<group>"; };
     3699                5CEABA2A2333247700797797 /* LegacyGlobalSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LegacyGlobalSettings.h; sourceTree = "<group>"; };
     3700                5CEABA2B2333251400797797 /* LegacyGlobalSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LegacyGlobalSettings.cpp; sourceTree = "<group>"; };
    36973701                5CFECB031E1ED1C800F88504 /* LegacyCustomProtocolManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LegacyCustomProtocolManager.cpp; sourceTree = "<group>"; };
    36983702                5DAD73F1116FF90C00EE5396 /* BaseTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = BaseTarget.xcconfig; sourceTree = "<group>"; };
     
    77567760                                A5E391FB2183C1E900C8FB31 /* InspectorTargetProxy.cpp */,
    77577761                                A5E391FC2183C1E900C8FB31 /* InspectorTargetProxy.h */,
     7762                                5CEABA2B2333251400797797 /* LegacyGlobalSettings.cpp */,
     7763                                5CEABA2A2333247700797797 /* LegacyGlobalSettings.h */,
    77587764                                31607F3819627002009B87DA /* LegacySessionStateCoding.h */,
    77597765                                BC6EDAA5111271C600E7678B /* PageClient.h */,
Note: See TracChangeset for help on using the changeset viewer.