Changeset 185251 in webkit


Ignore:
Timestamp:
Jun 5, 2015 10:19:37 AM (9 years ago)
Author:
andersca@apple.com
Message:

Disable the CFNetwork cache in the web process
https://bugs.webkit.org/show_bug.cgi?id=145700
rdar://problem/20243343

Reviewed by Geoffrey Garen.

  • NetworkProcess/cache/NetworkCacheStorage.cpp:

(WebKit::NetworkCache::Storage::open):

  • Shared/WebProcessCreationParameters.cpp:

(WebKit::WebProcessCreationParameters::WebProcessCreationParameters): Deleted.
(WebKit::WebProcessCreationParameters::encode): Deleted.
(WebKit::WebProcessCreationParameters::decode): Deleted.

  • Shared/WebProcessCreationParameters.h:
  • UIProcess/Cocoa/WebProcessPoolCocoa.mm:

(WebKit::WebProcessPool::platformInitializeWebProcess): Deleted.

  • UIProcess/WebProcessPool.cpp:

(WebKit::WebProcessPool::createNewWebProcess): Deleted.

  • WebProcess/WebProcess.cpp:

(WebKit::WebProcess::WebProcess): Deleted.
(WebKit::WebProcess::initializeWebProcess): Deleted.

  • WebProcess/WebProcess.h:
  • WebProcess/cocoa/WebProcessCocoa.mm:

(WebKit::WebProcess::platformClearResourceCaches):
(WebKit::WebProcess::platformInitializeWebProcess):
(WebKit::WebProcess::platformSetCacheModel): Deleted.
(WebKit::WebProcess::platformTerminate): Deleted.

Location:
trunk/Source/WebKit2
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r185248 r185251  
     12015-06-05  Anders Carlsson  <andersca@apple.com>
     2
     3        Disable the CFNetwork cache in the web process
     4        https://bugs.webkit.org/show_bug.cgi?id=145700
     5        rdar://problem/20243343
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        * NetworkProcess/cache/NetworkCacheStorage.cpp:
     10        (WebKit::NetworkCache::Storage::open):
     11        * Shared/WebProcessCreationParameters.cpp:
     12        (WebKit::WebProcessCreationParameters::WebProcessCreationParameters): Deleted.
     13        (WebKit::WebProcessCreationParameters::encode): Deleted.
     14        (WebKit::WebProcessCreationParameters::decode): Deleted.
     15        * Shared/WebProcessCreationParameters.h:
     16        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
     17        (WebKit::WebProcessPool::platformInitializeWebProcess): Deleted.
     18        * UIProcess/WebProcessPool.cpp:
     19        (WebKit::WebProcessPool::createNewWebProcess): Deleted.
     20        * WebProcess/WebProcess.cpp:
     21        (WebKit::WebProcess::WebProcess): Deleted.
     22        (WebKit::WebProcess::initializeWebProcess): Deleted.
     23        * WebProcess/WebProcess.h:
     24        * WebProcess/cocoa/WebProcessCocoa.mm:
     25        (WebKit::WebProcess::platformClearResourceCaches):
     26        (WebKit::WebProcess::platformInitializeWebProcess):
     27        (WebKit::WebProcess::platformSetCacheModel): Deleted.
     28        (WebKit::WebProcess::platformTerminate): Deleted.
     29
    1302015-06-05  Anders Carlsson  <andersca@apple.com>
    231
  • trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp

    r183755 r185251  
    8181
    8282    String networkCachePath = WebCore::pathByAppendingComponent(cachePath, networkCacheSubdirectory);
     83
    8384    if (!WebCore::makeAllDirectories(networkCachePath))
    8485        return nullptr;
  • trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp

    r184211 r185251  
    4141    , defaultRequestTimeoutInterval(INT_MAX)
    4242#if PLATFORM(COCOA)
    43     , nsURLCacheMemoryCapacity(0)
    44     , nsURLCacheDiskCapacity(0)
    4543    , shouldEnableKerningAndLigaturesByDefault(false)
    4644    , shouldEnableJIT(false)
     
    7270    encoder << webSQLDatabaseDirectory;
    7371    encoder << webSQLDatabaseDirectoryExtensionHandle;
    74     encoder << diskCacheDirectory;
    75     encoder << diskCacheDirectoryExtensionHandle;
    7672#if ENABLE(SECCOMP_FILTERS)
    7773    encoder << cookieStorageDirectory;
     
    123119    encoder << presenterApplicationPid;
    124120    encoder << accessibilityEnhancedUserInterfaceEnabled;
    125     encoder << nsURLCacheMemoryCapacity;
    126     encoder << nsURLCacheDiskCapacity;
    127121    encoder << acceleratedCompositingPort;
    128122    encoder << uiProcessBundleResourcePath;
     
    179173    if (!decoder.decode(parameters.webSQLDatabaseDirectoryExtensionHandle))
    180174        return false;
    181     if (!decoder.decode(parameters.diskCacheDirectory))
    182         return false;
    183     if (!decoder.decode(parameters.diskCacheDirectoryExtensionHandle))
    184         return false;
    185175#if ENABLE(SECCOMP_FILTERS)
    186176    if (!decoder.decode(parameters.cookieStorageDirectory))
     
    268258        return false;
    269259    if (!decoder.decode(parameters.accessibilityEnhancedUserInterfaceEnabled))
    270         return false;
    271     if (!decoder.decode(parameters.nsURLCacheMemoryCapacity))
    272         return false;
    273     if (!decoder.decode(parameters.nsURLCacheDiskCapacity))
    274260        return false;
    275261    if (!decoder.decode(parameters.acceleratedCompositingPort))
  • trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h

    r184211 r185251  
    7373    String webSQLDatabaseDirectory;
    7474    SandboxExtension::Handle webSQLDatabaseDirectoryExtensionHandle;
    75     String diskCacheDirectory;
    76     SandboxExtension::Handle diskCacheDirectoryExtensionHandle;
    7775#if ENABLE(SECCOMP_FILTERS)
    7876    String cookieStorageDirectory;
     
    139137    bool accessibilityEnhancedUserInterfaceEnabled;
    140138
    141     uint64_t nsURLCacheMemoryCapacity;
    142     uint64_t nsURLCacheDiskCapacity;
    143 
    144139    WebCore::MachSendRight acceleratedCompositingPort;
    145140
  • trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm

    r184929 r185251  
    175175#endif
    176176
    177     NSURLCache *urlCache = [NSURLCache sharedURLCache];
    178     parameters.nsURLCacheMemoryCapacity = [urlCache memoryCapacity];
    179     parameters.nsURLCacheDiskCapacity = [urlCache diskCapacity];
    180 
    181177    parameters.shouldEnableKerningAndLigaturesByDefault = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitKerningAndLigaturesEnabledByDefaultDefaultsKey];
    182178    parameters.shouldEnableJIT = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitJSCJITEnabledDefaultsKey];
  • trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp

    r184912 r185251  
    618618        SandboxExtension::createHandleForReadWriteDirectory(parameters.webSQLDatabaseDirectory, parameters.webSQLDatabaseDirectoryExtensionHandle);
    619619
    620     parameters.diskCacheDirectory = diskCacheDirectory();
    621     if (!parameters.diskCacheDirectory.isEmpty())
    622         SandboxExtension::createHandleForReadWriteDirectory(parameters.diskCacheDirectory, parameters.diskCacheDirectoryExtensionHandle);
    623 
    624620#if ENABLE(SECCOMP_FILTERS)
    625621    parameters.cookieStorageDirectory = this->cookieStorageDirectory();
  • trunk/Source/WebKit2/WebProcess/WebProcess.cpp

    r185206 r185251  
    158158    , m_hasSetCacheModel(false)
    159159    , m_cacheModel(CacheModelDocumentViewer)
    160     , m_diskCacheIsDisabledForTesting(false)
    161 #if PLATFORM(COCOA)
    162     , m_clearResourceCachesDispatchGroup(0)
    163 #endif
    164160    , m_fullKeyboardAccessEnabled(false)
    165161    , m_textCheckerState()
     
    301297        ApplicationCacheStorage::singleton().setCacheDirectory(parameters.applicationCacheDirectory);
    302298
    303     m_diskCacheIsDisabledForTesting = parameters.shouldUseTestingNetworkSession;
    304299    setCacheModel(static_cast<uint32_t>(parameters.cacheModel));
    305300
  • trunk/Source/WebKit2/WebProcess/WebProcess.h

    r184326 r185251  
    339339    bool m_hasSetCacheModel;
    340340    CacheModel m_cacheModel;
    341     bool m_diskCacheIsDisabledForTesting;
    342341
    343342#if PLATFORM(COCOA)
    344343    WebCore::MachSendRight m_compositingRenderServerPort;
    345344    pid_t m_presenterApplicationPid;
    346     dispatch_group_t m_clearResourceCachesDispatchGroup;
    347345#endif
    348346
  • trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm

    r184950 r185251  
    9999    memoryCache.setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
    100100    PageCache::singleton().setMaxSize(pageCacheSize);
    101 
    102     NSURLCache *nsurlCache = [NSURLCache sharedURLCache];
    103 
    104     [nsurlCache setMemoryCapacity:urlCacheMemoryCapacity];
    105     if (!m_diskCacheIsDisabledForTesting)
    106         [nsurlCache setDiskCapacity:std::max<unsigned long>(urlCacheDiskCapacity, [nsurlCache diskCapacity])]; // Don't shrink a big disk cache, since that would cause churn.
    107101}
    108102
    109103void WebProcess::platformClearResourceCaches(ResourceCachesToClear cachesToClear)
    110104{
    111     if (cachesToClear == InMemoryResourceCachesOnly)
    112         return;
    113 
    114     // If we're using the network process then it is the only one that needs to clear the disk cache.
    115     if (usesNetworkProcess())
    116         return;
    117 
    118     if (!m_clearResourceCachesDispatchGroup)
    119         m_clearResourceCachesDispatchGroup = dispatch_group_create();
    120 
    121     dispatch_group_async(m_clearResourceCachesDispatchGroup, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    122         [[NSURLCache sharedURLCache] removeAllCachedResponses];
    123     });
     105    // FIXME: Remove this.
    124106}
    125107
     
    141123    SandboxExtension::consumePermanently(parameters.webSQLDatabaseDirectoryExtensionHandle);
    142124    SandboxExtension::consumePermanently(parameters.applicationCacheDirectoryExtensionHandle);
    143     SandboxExtension::consumePermanently(parameters.diskCacheDirectoryExtensionHandle);
    144125    SandboxExtension::consumePermanently(parameters.mediaKeyStorageDirectoryExtensionHandle);
    145126#if PLATFORM(IOS)
     
    154135#endif
    155136
    156     // FIXME: Most of what this function does for cache size gets immediately overridden by setCacheModel().
    157     // - memory cache size passed from UI process is always ignored;
    158     // - disk cache size passed from UI process is effectively a minimum size.
    159     // One non-obvious constraint is that we need to use -setSharedURLCache: even in testing mode, to prevent creating a default one on disk later, when some other code touches the cache.
    160 
    161     ASSERT(!m_diskCacheIsDisabledForTesting || !parameters.nsURLCacheDiskCapacity);
    162 
    163 #if PLATFORM(IOS)
    164     if (!parameters.uiProcessBundleIdentifier.isNull()) {
    165         [NSURLCache setSharedURLCache:adoptNS([[NSURLCache alloc]
    166             _initWithMemoryCapacity:parameters.nsURLCacheMemoryCapacity
    167             diskCapacity:parameters.nsURLCacheDiskCapacity
    168             relativePath:parameters.uiProcessBundleIdentifier]).get()];
    169     }
    170 #else
    171     if (!parameters.diskCacheDirectory.isNull()) {
    172         [NSURLCache setSharedURLCache:adoptNS([[NSURLCache alloc]
    173             initWithMemoryCapacity:parameters.nsURLCacheMemoryCapacity
    174             diskCapacity:parameters.nsURLCacheDiskCapacity
    175             diskPath:parameters.diskCacheDirectory]).get()];
    176     }
    177 #endif
     137    auto urlCache = adoptNS([[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil]);
     138    [NSURLCache setSharedURLCache:urlCache.get()];
    178139
    179140#if PLATFORM(MAC)
     
    232193void WebProcess::platformTerminate()
    233194{
    234     if (m_clearResourceCachesDispatchGroup) {
    235         dispatch_group_wait(m_clearResourceCachesDispatchGroup, DISPATCH_TIME_FOREVER);
    236         dispatch_release(m_clearResourceCachesDispatchGroup);
    237         m_clearResourceCachesDispatchGroup = 0;
    238     }
    239195}
    240196
Note: See TracChangeset for help on using the changeset viewer.