Title: [137823] trunk/Source/WebKit2
Revision
137823
Author
[email protected]
Date
2012-12-15 17:15:52 -0800 (Sat, 15 Dec 2012)

Log Message

NSURLCache should be disabled in the WebProcess when using the NetworkProcess
<rdar://problem/12872266>
https://bugs.webkit.org/show_bug.cgi?id=105119

Reviewed by Alexey Proskuryakov.

Set the size of the NSURLCache to 0 (both disk and memory) in the WebProcess when using
the NetworkProcess.

* WebProcess/mac/WebProcessMac.mm:
(WebKit::WebProcess::platformSetCacheModel):
(WebKit::WebProcess::platformInitializeWebProcess):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (137822 => 137823)


--- trunk/Source/WebKit2/ChangeLog	2012-12-16 00:42:11 UTC (rev 137822)
+++ trunk/Source/WebKit2/ChangeLog	2012-12-16 01:15:52 UTC (rev 137823)
@@ -1,3 +1,67 @@
+2012-12-15  Sam Weinig  <[email protected]>
+
+        NSURLCache should be disabled in the WebProcess when using the NetworkProcess
+        <rdar://problem/12872266>
+        https://bugs.webkit.org/show_bug.cgi?id=105119
+
+        Reviewed by Alexey Proskuryakov.
+
+        Set the size of the NSURLCache to 0 (both disk and memory) in the WebProcess when using
+        the NetworkProcess.
+
+        * WebProcess/mac/WebProcessMac.mm:
+        (WebKit::WebProcess::platformSetCacheModel):
+        (WebKit::WebProcess::platformInitializeWebProcess):
+
+2012-12-15  Sam Weinig  <[email protected]>
+
+        The network process should use the correct NSURLCache location and set its size correctly for the CacheModel
+        <rdar://problem/12848505>
+        https://bugs.webkit.org/show_bug.cgi?id=105115
+
+        Reviewed by Anders Carlsson.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::NetworkProcess):
+        (WebKit::NetworkProcess::initializeNetworkProcess):
+        (WebKit::NetworkProcess::setCacheModel):
+        * NetworkProcess/NetworkProcess.h:
+        (NetworkProcess):
+        * NetworkProcess/mac/NetworkProcessMac.mm:
+        (WebKit::NetworkProcess::platformInitialize):
+        (WebKit::memorySize):
+        (WebKit::volumeFreeSize):
+        (WebKit::NetworkProcess::platformSetCacheModel):
+        Copy code from the WebProcess to set up the NSURLCache correctly (location and size).
+        We should eventually move the calculation of this to the WebContext so it can be done
+        once.
+
+        * Shared/Network/NetworkProcessCreationParameters.cpp:
+        (WebKit::NetworkProcessCreationParameters::encode):
+        (WebKit::NetworkProcessCreationParameters::decode):
+        * Shared/Network/NetworkProcessCreationParameters.h:
+        (NetworkProcessCreationParameters):
+        Add the necessary creation parameters to set up the cache.
+
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::didFinishLaunching):
+        * UIProcess/Network/NetworkProcessProxy.h:
+        (NetworkProcessProxy):
+        * UIProcess/Network/mac/NetworkProcessProxyMac.mm:
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::ensureNetworkProcess):
+        (WebKit::WebContext::setCacheModel):
+        * UIProcess/WebContext.h:
+        (WebKit):
+        (WebContext):
+        * UIProcess/mac/WebContextMac.mm:
+        (WebKit):
+        (WebKit::WebContext::platformInitializeNetworkProcess):
+        Move initializing the NetworkProcess to just after creating (matching the WebProcess),
+        rather than waiting for it finish loading before sending the creation parameters.
+        Additionally, this moves the setting up of the creation parameters to the WebContext,
+        as that is where all the interesting state resides (and also matches the WebProcess).
+
 2012-12-15  Andy Estes  <[email protected]>
 
         [WebKit2] Register the custom protocol handler in the network process if it exists

Modified: trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm (137822 => 137823)


--- trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm	2012-12-16 00:42:11 UTC (rev 137822)
+++ trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm	2012-12-16 01:15:52 UTC (rev 137823)
@@ -123,6 +123,17 @@
     pageCache()->setCapacity(pageCacheCapacity);
 
     NSURLCache *nsurlCache = [NSURLCache sharedURLCache];
+
+#if ENABLE(NETWORK_PROCESS)
+    // FIXME: Once there is no loading being done in the WebProcess, we should remove this,
+    // as calling [NSURLCache sharedURLCache] initializes the cache, which we would rather not do.
+    if (m_usesNetworkProcess) {
+        [nsurlCache setMemoryCapacity:0];
+        [nsurlCache setDiskCapacity:0];
+        return;
+    }
+#endif
+
     [nsurlCache setMemoryCapacity:urlCacheMemoryCapacity];
     [nsurlCache setDiskCapacity:max<unsigned long>(urlCacheDiskCapacity, [nsurlCache diskCapacity])]; // Don't shrink a big disk cache, since that would cause churn.
 }
@@ -259,13 +270,19 @@
     SandboxExtension::consumePermanently(parameters.applicationCacheDirectoryExtensionHandle);
     SandboxExtension::consumePermanently(parameters.diskCacheDirectoryExtensionHandle);
 
-    if (!parameters.diskCacheDirectory.isNull()) {
-        NSUInteger cacheMemoryCapacity = parameters.nsURLCacheMemoryCapacity;
-        NSUInteger cacheDiskCapacity = parameters.nsURLCacheDiskCapacity;
+#if ENABLE(NETWORK_PROCESS)
+    if (!parameters.usesNetworkProcess) {
+#endif
+        if (!parameters.diskCacheDirectory.isNull()) {
+            NSUInteger cacheMemoryCapacity = parameters.nsURLCacheMemoryCapacity;
+            NSUInteger cacheDiskCapacity = parameters.nsURLCacheDiskCapacity;
 
-        RetainPtr<NSURLCache> parentProcessURLCache(AdoptNS, [[NSURLCache alloc] initWithMemoryCapacity:cacheMemoryCapacity diskCapacity:cacheDiskCapacity diskPath:parameters.diskCacheDirectory]);
-        [NSURLCache setSharedURLCache:parentProcessURLCache.get()];
+            RetainPtr<NSURLCache> parentProcessURLCache(AdoptNS, [[NSURLCache alloc] initWithMemoryCapacity:cacheMemoryCapacity diskCapacity:cacheDiskCapacity diskPath:parameters.diskCacheDirectory]);
+            [NSURLCache setSharedURLCache:parentProcessURLCache.get()];
+        }
+#if ENABLE(NETWORK_PROCESS)
     }
+#endif
 
     m_shouldForceScreenFontSubstitution = parameters.shouldForceScreenFontSubstitution;
     Font::setDefaultTypesettingFeatures(parameters.shouldEnableKerningAndLigaturesByDefault ? Kerning | Ligatures : 0);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to