[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

mitz at apple.com mitz at apple.com
Wed Dec 22 18:42:53 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit fd2aedeae1bfc49b618cf15d0c9db9060729741b
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 16 06:52:37 2010 +0000

    <rdar://problem/8731320> WebProcess's CFNetwork cache is in ~/Library/Caches/com.apple.WebProcess
    
    Reviewed by Sam Weinig.
    
    * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
    (WebKit::ProcessLauncher::launchProcess): Get the location, disk capacity and memory capacity
    of the UI process's NSURLCache and pass them to the WebProcess.
    * WebProcess/mac/WebProcessMainMac.mm:
    (WebKit::WebProcessMain): If an NSURLCache location was passed on the command line, set the
    shared NSURLCache to that path and use the specified capacities as initial values.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74175 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 476fde4..8a0eb95 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,18 @@
 2010-12-15  Dan Bernstein  <mitz at apple.com>
 
+        Reviewed by Sam Weinig.
+
+        <rdar://problem/8731320> WebProcess’s CFNetwork cache is in ~/Library/Caches/com.apple.WebProcess
+
+        * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+        (WebKit::ProcessLauncher::launchProcess): Get the location, disk capacity and memory capacity
+        of the UI process’s NSURLCache and pass them to the WebProcess.
+        * WebProcess/mac/WebProcessMainMac.mm:
+        (WebKit::WebProcessMain): If an NSURLCache location was passed on the command line, set the
+        shared NSURLCache to that path and use the specified capacities as initial values.
+
+2010-12-15  Dan Bernstein  <mitz at apple.com>
+
         Reviewed by Sam “I blame andersca” Weinig.
 
         Allow responses to be cached by the NSURLCache.
diff --git a/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm b/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
index 51906ac..e05f8e3 100644
--- a/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
+++ b/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
@@ -27,7 +27,7 @@
 
 #include "RunLoop.h"
 #include "WebProcess.h"
-#include "WebSystemInterface.h"
+#include "WebKitSystemInterface.h"
 #include <crt_externs.h>
 #include <mach-o/dyld.h>
 #include <mach/machine.h>
@@ -37,6 +37,7 @@
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <wtf/PassRefPtr.h>
+#include <wtf/RetainPtr.h>
 #include <wtf/Threading.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
@@ -224,8 +225,17 @@ void ProcessLauncher::launchProcess()
     // Make a unique, per pid, per process launcher web process service name.
     CString serviceName = String::format("com.apple.WebKit.WebProcess-%d-%p", getpid(), this).utf8();
 
+    RetainPtr<CFStringRef> cachePath(AdoptCF, WKCopyFoundationCacheDirectory());
+    if (!cachePath)
+        cachePath = reinterpret_cast<CFStringRef>(NSHomeDirectory());
+
+    NSURLCache *urlCache = [NSURLCache sharedURLCache];
+    CString cacheMemoryCapacity = String::number([urlCache memoryCapacity]).utf8();
+    CString cacheDiskCapacity = String::number([urlCache diskCapacity]).utf8();
+
     const char* path = [webProcessAppExecutablePath fileSystemRepresentation];
-    const char* args[] = { path, bundlePath, "-type", processTypeAsString(m_launchOptions.processType), "-servicename", serviceName.data(), "-parentprocessname", processName(), 0 };
+    const char* args[] = { path, bundlePath, "-type", processTypeAsString(m_launchOptions.processType), "-servicename", serviceName.data(), "-parentprocessname", processName(),
+        "-cachepath", [(NSString *)cachePath.get() UTF8String], "-cachememorycapacity", cacheMemoryCapacity.data(), "-cachediskcapacity", cacheDiskCapacity.data(), 0 };
 
     // Register ourselves.
     kern_return_t kr = bootstrap_register2(bootstrap_port, const_cast<char*>(serviceName.data()), listeningPort, 0);
diff --git a/WebKit2/WebProcess/mac/WebProcessMainMac.mm b/WebKit2/WebProcess/mac/WebProcessMainMac.mm
index 3427039..e71d364 100644
--- a/WebKit2/WebProcess/mac/WebProcessMainMac.mm
+++ b/WebKit2/WebProcess/mac/WebProcessMainMac.mm
@@ -124,10 +124,22 @@ int WebProcessMain(const CommandLine& commandLine)
         NSString *applicationName = [NSString stringWithFormat:@"%@ Web Content", (NSString *)parentProcessName];
         WKSetVisibleApplicationName((CFStringRef)applicationName);
     }
-    
+
+    String cachePath = commandLine["cachepath"];
+    if (!cachePath.isNull()) {
+        NSUInteger cacheMemoryCapacity = commandLine["cachememorycapacity"].toUInt();
+        NSUInteger cacheDiskCapacity = commandLine["cachediskcapacity"].toUInt();
+
+        CString utf8CachePath = cachePath.utf8();
+        NSString *nsCachePath = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:utf8CachePath.data() length:utf8CachePath.length()];
+
+        RetainPtr<NSURLCache> parentProcessURLCache(AdoptNS, [[NSURLCache alloc] initWithMemoryCapacity:cacheMemoryCapacity diskCapacity:cacheDiskCapacity diskPath:nsCachePath]);
+        [NSURLCache setSharedURLCache:parentProcessURLCache.get()];
+    }
+
     // Create the connection.
     WebProcess::shared().initialize(serverPort, RunLoop::main());
-    
+
     [pool drain];
 
      // Initialize AppKit.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list