Title: [185251] trunk/Source/WebKit2
Revision
185251
Author
[email protected]
Date
2015-06-05 10:19:37 -0700 (Fri, 05 Jun 2015)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (185250 => 185251)


--- trunk/Source/WebKit2/ChangeLog	2015-06-05 17:17:30 UTC (rev 185250)
+++ trunk/Source/WebKit2/ChangeLog	2015-06-05 17:19:37 UTC (rev 185251)
@@ -1,5 +1,34 @@
 2015-06-05  Anders Carlsson  <[email protected]>
 
+        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.
+
+2015-06-05  Anders Carlsson  <[email protected]>
+
         Consolidate default website data directory computations
         https://bugs.webkit.org/show_bug.cgi?id=145698
 

Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp (185250 => 185251)


--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp	2015-06-05 17:17:30 UTC (rev 185250)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp	2015-06-05 17:19:37 UTC (rev 185251)
@@ -80,6 +80,7 @@
     ASSERT(RunLoop::isMain());
 
     String networkCachePath = WebCore::pathByAppendingComponent(cachePath, networkCacheSubdirectory);
+
     if (!WebCore::makeAllDirectories(networkCachePath))
         return nullptr;
     return std::unique_ptr<Storage>(new Storage(networkCachePath));

Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp (185250 => 185251)


--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp	2015-06-05 17:17:30 UTC (rev 185250)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp	2015-06-05 17:19:37 UTC (rev 185251)
@@ -40,8 +40,6 @@
     , shouldUseFontSmoothing(true)
     , defaultRequestTimeoutInterval(INT_MAX)
 #if PLATFORM(COCOA)
-    , nsURLCacheMemoryCapacity(0)
-    , nsURLCacheDiskCapacity(0)
     , shouldEnableKerningAndLigaturesByDefault(false)
     , shouldEnableJIT(false)
     , shouldEnableFTLJIT(false)
@@ -71,8 +69,6 @@
     encoder << applicationCacheDirectoryExtensionHandle;
     encoder << webSQLDatabaseDirectory;
     encoder << webSQLDatabaseDirectoryExtensionHandle;
-    encoder << diskCacheDirectory;
-    encoder << diskCacheDirectoryExtensionHandle;
 #if ENABLE(SECCOMP_FILTERS)
     encoder << cookieStorageDirectory;
 #endif
@@ -122,8 +118,6 @@
 #if PLATFORM(COCOA)
     encoder << presenterApplicationPid;
     encoder << accessibilityEnhancedUserInterfaceEnabled;
-    encoder << nsURLCacheMemoryCapacity;
-    encoder << nsURLCacheDiskCapacity;
     encoder << acceleratedCompositingPort;
     encoder << uiProcessBundleResourcePath;
     encoder << uiProcessBundleResourcePathExtensionHandle;
@@ -178,10 +172,6 @@
         return false;
     if (!decoder.decode(parameters.webSQLDatabaseDirectoryExtensionHandle))
         return false;
-    if (!decoder.decode(parameters.diskCacheDirectory))
-        return false;
-    if (!decoder.decode(parameters.diskCacheDirectoryExtensionHandle))
-        return false;
 #if ENABLE(SECCOMP_FILTERS)
     if (!decoder.decode(parameters.cookieStorageDirectory))
         return false;
@@ -268,10 +258,6 @@
         return false;
     if (!decoder.decode(parameters.accessibilityEnhancedUserInterfaceEnabled))
         return false;
-    if (!decoder.decode(parameters.nsURLCacheMemoryCapacity))
-        return false;
-    if (!decoder.decode(parameters.nsURLCacheDiskCapacity))
-        return false;
     if (!decoder.decode(parameters.acceleratedCompositingPort))
         return false;
     if (!decoder.decode(parameters.uiProcessBundleResourcePath))

Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h (185250 => 185251)


--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h	2015-06-05 17:17:30 UTC (rev 185250)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h	2015-06-05 17:19:37 UTC (rev 185251)
@@ -72,8 +72,6 @@
     SandboxExtension::Handle applicationCacheDirectoryExtensionHandle;
     String webSQLDatabaseDirectory;
     SandboxExtension::Handle webSQLDatabaseDirectoryExtensionHandle;
-    String diskCacheDirectory;
-    SandboxExtension::Handle diskCacheDirectoryExtensionHandle;
 #if ENABLE(SECCOMP_FILTERS)
     String cookieStorageDirectory;
 #endif
@@ -138,9 +136,6 @@
 
     bool accessibilityEnhancedUserInterfaceEnabled;
 
-    uint64_t nsURLCacheMemoryCapacity;
-    uint64_t nsURLCacheDiskCapacity;
-
     WebCore::MachSendRight acceleratedCompositingPort;
 
     String uiProcessBundleResourcePath;

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm (185250 => 185251)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2015-06-05 17:17:30 UTC (rev 185250)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2015-06-05 17:19:37 UTC (rev 185251)
@@ -174,10 +174,6 @@
     parameters.accessibilityEnhancedUserInterfaceEnabled = false;
 #endif
 
-    NSURLCache *urlCache = [NSURLCache sharedURLCache];
-    parameters.nsURLCacheMemoryCapacity = [urlCache memoryCapacity];
-    parameters.nsURLCacheDiskCapacity = [urlCache diskCapacity];
-
     parameters.shouldEnableKerningAndLigaturesByDefault = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitKerningAndLigaturesEnabledByDefaultDefaultsKey];
     parameters.shouldEnableJIT = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitJSCJITEnabledDefaultsKey];
     parameters.shouldEnableFTLJIT = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitJSCFTLJITEnabledDefaultsKey];

Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (185250 => 185251)


--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp	2015-06-05 17:17:30 UTC (rev 185250)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp	2015-06-05 17:19:37 UTC (rev 185251)
@@ -617,10 +617,6 @@
     if (!parameters.webSQLDatabaseDirectory.isEmpty())
         SandboxExtension::createHandleForReadWriteDirectory(parameters.webSQLDatabaseDirectory, parameters.webSQLDatabaseDirectoryExtensionHandle);
 
-    parameters.diskCacheDirectory = diskCacheDirectory();
-    if (!parameters.diskCacheDirectory.isEmpty())
-        SandboxExtension::createHandleForReadWriteDirectory(parameters.diskCacheDirectory, parameters.diskCacheDirectoryExtensionHandle);
-
 #if ENABLE(SECCOMP_FILTERS)
     parameters.cookieStorageDirectory = this->cookieStorageDirectory();
 #endif

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (185250 => 185251)


--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2015-06-05 17:17:30 UTC (rev 185250)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2015-06-05 17:19:37 UTC (rev 185251)
@@ -157,10 +157,6 @@
     , m_inDidClose(false)
     , m_hasSetCacheModel(false)
     , m_cacheModel(CacheModelDocumentViewer)
-    , m_diskCacheIsDisabledForTesting(false)
-#if PLATFORM(COCOA)
-    , m_clearResourceCachesDispatchGroup(0)
-#endif
     , m_fullKeyboardAccessEnabled(false)
     , m_textCheckerState()
     , m_iconDatabaseProxy(new WebIconDatabaseProxy(this))
@@ -300,7 +296,6 @@
     if (!parameters.applicationCacheDirectory.isEmpty())
         ApplicationCacheStorage::singleton().setCacheDirectory(parameters.applicationCacheDirectory);
 
-    m_diskCacheIsDisabledForTesting = parameters.shouldUseTestingNetworkSession;
     setCacheModel(static_cast<uint32_t>(parameters.cacheModel));
 
     if (!parameters.languages.isEmpty())

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (185250 => 185251)


--- trunk/Source/WebKit2/WebProcess/WebProcess.h	2015-06-05 17:17:30 UTC (rev 185250)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h	2015-06-05 17:19:37 UTC (rev 185251)
@@ -338,12 +338,10 @@
 
     bool m_hasSetCacheModel;
     CacheModel m_cacheModel;
-    bool m_diskCacheIsDisabledForTesting;
 
 #if PLATFORM(COCOA)
     WebCore::MachSendRight m_compositingRenderServerPort;
     pid_t m_presenterApplicationPid;
-    dispatch_group_t m_clearResourceCachesDispatchGroup;
 #endif
 
     bool m_fullKeyboardAccessEnabled;

Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm (185250 => 185251)


--- trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm	2015-06-05 17:17:30 UTC (rev 185250)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm	2015-06-05 17:19:37 UTC (rev 185251)
@@ -98,29 +98,11 @@
     memoryCache.setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
     memoryCache.setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
     PageCache::singleton().setMaxSize(pageCacheSize);
-
-    NSURLCache *nsurlCache = [NSURLCache sharedURLCache];
-
-    [nsurlCache setMemoryCapacity:urlCacheMemoryCapacity];
-    if (!m_diskCacheIsDisabledForTesting)
-        [nsurlCache setDiskCapacity:std::max<unsigned long>(urlCacheDiskCapacity, [nsurlCache diskCapacity])]; // Don't shrink a big disk cache, since that would cause churn.
 }
 
 void WebProcess::platformClearResourceCaches(ResourceCachesToClear cachesToClear)
 {
-    if (cachesToClear == InMemoryResourceCachesOnly)
-        return;
-
-    // If we're using the network process then it is the only one that needs to clear the disk cache.
-    if (usesNetworkProcess())
-        return;
-
-    if (!m_clearResourceCachesDispatchGroup)
-        m_clearResourceCachesDispatchGroup = dispatch_group_create();
-
-    dispatch_group_async(m_clearResourceCachesDispatchGroup, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        [[NSURLCache sharedURLCache] removeAllCachedResponses];
-    });
+    // FIXME: Remove this.
 }
 
 #if USE(APPKIT)
@@ -140,7 +122,6 @@
     SandboxExtension::consumePermanently(parameters.uiProcessBundleResourcePathExtensionHandle);
     SandboxExtension::consumePermanently(parameters.webSQLDatabaseDirectoryExtensionHandle);
     SandboxExtension::consumePermanently(parameters.applicationCacheDirectoryExtensionHandle);
-    SandboxExtension::consumePermanently(parameters.diskCacheDirectoryExtensionHandle);
     SandboxExtension::consumePermanently(parameters.mediaKeyStorageDirectoryExtensionHandle);
 #if PLATFORM(IOS)
     SandboxExtension::consumePermanently(parameters.cookieStorageDirectoryExtensionHandle);
@@ -153,29 +134,9 @@
     setSharedHTTPCookieStorage(parameters.uiProcessCookieStorageIdentifier);
 #endif
 
-    // FIXME: Most of what this function does for cache size gets immediately overridden by setCacheModel().
-    // - memory cache size passed from UI process is always ignored;
-    // - disk cache size passed from UI process is effectively a minimum size.
-    // 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.
+    auto urlCache = adoptNS([[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil]);
+    [NSURLCache setSharedURLCache:urlCache.get()];
 
-    ASSERT(!m_diskCacheIsDisabledForTesting || !parameters.nsURLCacheDiskCapacity);
-
-#if PLATFORM(IOS)
-    if (!parameters.uiProcessBundleIdentifier.isNull()) {
-        [NSURLCache setSharedURLCache:adoptNS([[NSURLCache alloc]
-            _initWithMemoryCapacity:parameters.nsURLCacheMemoryCapacity
-            diskCapacity:parameters.nsURLCacheDiskCapacity
-            relativePath:parameters.uiProcessBundleIdentifier]).get()];
-    }
-#else
-    if (!parameters.diskCacheDirectory.isNull()) {
-        [NSURLCache setSharedURLCache:adoptNS([[NSURLCache alloc]
-            initWithMemoryCapacity:parameters.nsURLCacheMemoryCapacity
-            diskCapacity:parameters.nsURLCacheDiskCapacity
-            diskPath:parameters.diskCacheDirectory]).get()];
-    }
-#endif
-
 #if PLATFORM(MAC)
     WebCore::FontCache::setFontWhitelist(parameters.fontWhitelist);
 #endif
@@ -231,11 +192,6 @@
 
 void WebProcess::platformTerminate()
 {
-    if (m_clearResourceCachesDispatchGroup) {
-        dispatch_group_wait(m_clearResourceCachesDispatchGroup, DISPATCH_TIME_FOREVER);
-        dispatch_release(m_clearResourceCachesDispatchGroup);
-        m_clearResourceCachesDispatchGroup = 0;
-    }
 }
 
 void WebProcess::initializeSandbox(const ChildProcessInitializationParameters& parameters, SandboxInitializationParameters& sandboxParameters)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to