[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
weinig at apple.com
weinig at apple.com
Wed Dec 22 15:18:35 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 71df02b30b92935833fbf7919afd1fd5fdef3cb7
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Oct 30 01:28:44 2010 +0000
Implement WebProcess::platformSetCacheModel for windows
<rdar://problem/8605796>
https://bugs.webkit.org/show_bug.cgi?id=48703
Reviewed by Simon Fraser.
* WebProcess/win/WebProcessWin.cpp:
(WebKit::memorySize):
(WebKit::volumeFreeSize):
(WebKit::WebProcess::platformSetCacheModel):
Add implemenation based on the version in WebKit/win/WebView.cpp.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70966 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 06a7255..2074d6f 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,17 @@
+2010-10-29 Sam Weinig <weinig at apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Implement WebProcess::platformSetCacheModel for windows
+ <rdar://problem/8605796>
+ https://bugs.webkit.org/show_bug.cgi?id=48703
+
+ * WebProcess/win/WebProcessWin.cpp:
+ (WebKit::memorySize):
+ (WebKit::volumeFreeSize):
+ (WebKit::WebProcess::platformSetCacheModel):
+ Add implemenation based on the version in WebKit/win/WebView.cpp.
+
2010-10-29 Andreas Kling <kling at webkit.org>
Reviewed by Anders Carlsson.
diff --git a/WebKit2/WebProcess/win/WebProcessWin.cpp b/WebKit2/WebProcess/win/WebProcessWin.cpp
index faec27b..e0ba2b3 100644
--- a/WebKit2/WebProcess/win/WebProcessWin.cpp
+++ b/WebKit2/WebProcess/win/WebProcessWin.cpp
@@ -25,11 +25,215 @@
#include "WebProcess.h"
+#include <WebCore/Cache.h>
+#include <WebCore/FileSystem.h>
+#include <WebCore/PageCache.h>
+#include <wtf/text/WTFString.h>
+
+#if USE(CFNETWORK)
+#include <CFNetwork/CFURLCachePriv.h>
+#include <CFNetwork/CFURLProtocolPriv.h>
+#include <WebCore/CookieStorageCFNet.h>
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#include <wtf/RetainPtr.h>
+#endif
+
+using namespace std;
+using namespace WebCore;
+
namespace WebKit {
+static unsigned long long memorySize()
+{
+ MEMORYSTATUSEX statex;
+ statex.dwLength = sizeof(statex);
+ GlobalMemoryStatusEx(&statex);
+ return statex.ullTotalPhys;
+}
+
+static unsigned long long volumeFreeSize(CFStringRef cfstringPath)
+{
+ WTF::String path(cfstringPath);
+ ULARGE_INTEGER freeBytesToCaller;
+ BOOL result = GetDiskFreeSpaceExW((LPCWSTR)path.charactersWithNullTermination(), &freeBytesToCaller, 0, 0);
+ if (!result)
+ return 0;
+
+ return freeBytesToCaller.QuadPart;
+}
+
void WebProcess::platformSetCacheModel(CacheModel cacheModel)
{
- // FIXME: Implement.
+#if USE(CFNETWORK)
+ RetainPtr<CFURLCacheRef> cfurlCache(AdoptCF, CFURLCacheCopySharedURLCache());
+ RetainPtr<CFStringRef> cfurlCacheDirectory(AdoptCF, wkCopyFoundationCacheDirectory());
+ if (!cfurlCacheDirectory)
+ cfurlCacheDirectory.adoptCF(WebCore::localUserSpecificStorageDirectory().createCFString());
+
+ // As a fudge factor, use 1000 instead of 1024, in case the reported byte
+ // count doesn't align exactly to a megabyte boundary.
+ unsigned long long memSize = memorySize() / 1024 / 1000;
+ unsigned long long diskFreeSize = volumeFreeSize(cfurlCacheDirectory.get()) / 1024 / 1000;
+
+ unsigned cacheTotalCapacity = 0;
+ unsigned cacheMinDeadCapacity = 0;
+ unsigned cacheMaxDeadCapacity = 0;
+ double deadDecodedDataDeletionInterval = 0;
+
+ unsigned pageCacheCapacity = 0;
+
+ CFIndex cfurlCacheMemoryCapacity = 0;
+ CFIndex cfurlCacheDiskCapacity = 0;
+
+ switch (cacheModel) {
+ case CacheModelDocumentViewer: {
+ // Page cache capacity (in pages)
+ pageCacheCapacity = 0;
+
+ // Object cache capacities (in bytes)
+ if (memSize >= 2048)
+ cacheTotalCapacity = 96 * 1024 * 1024;
+ else if (memSize >= 1536)
+ cacheTotalCapacity = 64 * 1024 * 1024;
+ else if (memSize >= 1024)
+ cacheTotalCapacity = 32 * 1024 * 1024;
+ else if (memSize >= 512)
+ cacheTotalCapacity = 16 * 1024 * 1024;
+
+ cacheMinDeadCapacity = 0;
+ cacheMaxDeadCapacity = 0;
+
+ // Foundation memory cache capacity (in bytes)
+ cfurlCacheMemoryCapacity = 0;
+
+ // Foundation disk cache capacity (in bytes)
+ cfurlCacheDiskCapacity = CFURLCacheDiskCapacity(cfurlCache.get());
+
+ break;
+ }
+ case CacheModelDocumentBrowser: {
+ // Page cache capacity (in pages)
+ if (memSize >= 1024)
+ pageCacheCapacity = 3;
+ else if (memSize >= 512)
+ pageCacheCapacity = 2;
+ else if (memSize >= 256)
+ pageCacheCapacity = 1;
+ else
+ pageCacheCapacity = 0;
+
+ // Object cache capacities (in bytes)
+ if (memSize >= 2048)
+ cacheTotalCapacity = 96 * 1024 * 1024;
+ else if (memSize >= 1536)
+ cacheTotalCapacity = 64 * 1024 * 1024;
+ else if (memSize >= 1024)
+ cacheTotalCapacity = 32 * 1024 * 1024;
+ else if (memSize >= 512)
+ cacheTotalCapacity = 16 * 1024 * 1024;
+
+ cacheMinDeadCapacity = cacheTotalCapacity / 8;
+ cacheMaxDeadCapacity = cacheTotalCapacity / 4;
+
+ // Foundation memory cache capacity (in bytes)
+ if (memSize >= 2048)
+ cfurlCacheMemoryCapacity = 4 * 1024 * 1024;
+ else if (memSize >= 1024)
+ cfurlCacheMemoryCapacity = 2 * 1024 * 1024;
+ else if (memSize >= 512)
+ cfurlCacheMemoryCapacity = 1 * 1024 * 1024;
+ else
+ cfurlCacheMemoryCapacity = 512 * 1024;
+
+ // Foundation disk cache capacity (in bytes)
+ if (diskFreeSize >= 16384)
+ cfurlCacheDiskCapacity = 50 * 1024 * 1024;
+ else if (diskFreeSize >= 8192)
+ cfurlCacheDiskCapacity = 40 * 1024 * 1024;
+ else if (diskFreeSize >= 4096)
+ cfurlCacheDiskCapacity = 30 * 1024 * 1024;
+ else
+ cfurlCacheDiskCapacity = 20 * 1024 * 1024;
+
+ break;
+ }
+ case CacheModelPrimaryWebBrowser: {
+ // Page cache capacity (in pages)
+ // (Research indicates that value / page drops substantially after 3 pages.)
+ if (memSize >= 2048)
+ pageCacheCapacity = 5;
+ else if (memSize >= 1024)
+ pageCacheCapacity = 4;
+ else if (memSize >= 512)
+ pageCacheCapacity = 3;
+ else if (memSize >= 256)
+ pageCacheCapacity = 2;
+ else
+ pageCacheCapacity = 1;
+
+ // Object cache capacities (in bytes)
+ // (Testing indicates that value / MB depends heavily on content and
+ // browsing pattern. Even growth above 128MB can have substantial
+ // value / MB for some content / browsing patterns.)
+ if (memSize >= 2048)
+ cacheTotalCapacity = 128 * 1024 * 1024;
+ else if (memSize >= 1536)
+ cacheTotalCapacity = 96 * 1024 * 1024;
+ else if (memSize >= 1024)
+ cacheTotalCapacity = 64 * 1024 * 1024;
+ else if (memSize >= 512)
+ cacheTotalCapacity = 32 * 1024 * 1024;
+
+ cacheMinDeadCapacity = cacheTotalCapacity / 4;
+ cacheMaxDeadCapacity = cacheTotalCapacity / 2;
+
+ // This code is here to avoid a PLT regression. We can remove it if we
+ // can prove that the overall system gain would justify the regression.
+ cacheMaxDeadCapacity = max(24u, cacheMaxDeadCapacity);
+
+ deadDecodedDataDeletionInterval = 60;
+
+ // Foundation memory cache capacity (in bytes)
+ // (These values are small because WebCore does most caching itself.)
+ if (memSize >= 1024)
+ cfurlCacheMemoryCapacity = 4 * 1024 * 1024;
+ else if (memSize >= 512)
+ cfurlCacheMemoryCapacity = 2 * 1024 * 1024;
+ else if (memSize >= 256)
+ cfurlCacheMemoryCapacity = 1 * 1024 * 1024;
+ else
+ cfurlCacheMemoryCapacity = 512 * 1024;
+
+ // Foundation disk cache capacity (in bytes)
+ if (diskFreeSize >= 16384)
+ cfurlCacheDiskCapacity = 175 * 1024 * 1024;
+ else if (diskFreeSize >= 8192)
+ cfurlCacheDiskCapacity = 150 * 1024 * 1024;
+ else if (diskFreeSize >= 4096)
+ cfurlCacheDiskCapacity = 125 * 1024 * 1024;
+ else if (diskFreeSize >= 2048)
+ cfurlCacheDiskCapacity = 100 * 1024 * 1024;
+ else if (diskFreeSize >= 1024)
+ cfurlCacheDiskCapacity = 75 * 1024 * 1024;
+ else
+ cfurlCacheDiskCapacity = 50 * 1024 * 1024;
+
+ break;
+ }
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ // Don't shrink a big disk cache, since that would cause churn.
+ cfurlCacheDiskCapacity = max(cfurlCacheDiskCapacity, CFURLCacheDiskCapacity(cfurlCache.get()));
+
+ cache()->setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
+ cache()->setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
+ pageCache()->setCapacity(pageCacheCapacity);
+
+ CFURLCacheSetMemoryCapacity(cfurlCache.get(), cfurlCacheMemoryCapacity);
+ CFURLCacheSetDiskCapacity(cfurlCache.get(), cfurlCacheDiskCapacity);
+#endif
}
} // namespace WebKit
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list