WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-118343-20130703173535.patch (text/plain), 13.38 KB, created by
Kwang Yul Seo
on 2013-07-03 01:38:01 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Kwang Yul Seo
Created:
2013-07-03 01:38:01 PDT
Size:
13.38 KB
patch
obsolete
>Subversion Revision: 152322 >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index e2fb94c7b4b9adeb5e29b0cd995bfa92e448a511..c819941159cc06c4f7b82a2461828b21a4a0340f 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,38 @@ >+2013-07-03 Kwang Yul Seo <skyul@company100.net> >+ >+ [WK2][Soup] Support cache model in NetworkProcess >+ https://bugs.webkit.org/show_bug.cgi?id=118343 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Copied cache model code from WebProcess. >+ >+ Moved getCacheDiskFreeSize and getMemorySize into a seperate file so >+ they can be shared between WebProcess and NetworkProcess. >+ >+ NetworkProcess is configured not to use the WebCore memory cache. >+ >+ * GNUmakefile.list.am: >+ * NetworkProcess/soup/NetworkProcessSoup.cpp: >+ (WebKit::NetworkProcess::platformInitializeNetworkProcess): >+ Initialize soup cache. >+ (WebKit::NetworkProcess::platformSetCacheModel): >+ Copied code from WebProcess::platformSetCacheModel but removed >+ WebCore memory cache initialization because NetworkProcess does not use >+ the WebCore memory cache. >+ (WebKit::NetworkProcess::clearCacheForAllOrigins): >+ Copied code from WebProcess::clearCacheForAllOrigins. >+ * NetworkProcess/unix/NetworkProcessMainUnix.cpp: >+ Copied initialization code from WebProcessMainGtk.cpp. >+ (WebKit::NetworkProcessMain): >+ * Shared/soup/CacheModelHelper.cpp: Copied from Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp. >+ (WebKit::getCacheDiskFreeSize): >+ Moved from WebProcessSoup.cpp to share it between WebProcess and NetworkProcess. >+ (WebKit::getMemorySize): >+ Moved from WebProcessSoup.cpp to share it between WebProcess and NetworkProcess. >+ * Shared/soup/CacheModelHelper.h: Copied from Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp. >+ * WebProcess/soup/WebProcessSoup.cpp: >+ > 2013-07-01 Kwang Yul Seo <skyul@company100.net> > > Build fix: use of long long in CoreIPC::ArgumentEncoder and CoreIPC::ArgumentDecoder >diff --git a/Source/WebKit2/GNUmakefile.list.am b/Source/WebKit2/GNUmakefile.list.am >index 0093ac9434f0d6f161ed8cd8fd0dfc0d81e30fa5..4b83c8fb9d955ac6d2c134c0bb6b9e16ef80ae2c 100644 >--- a/Source/WebKit2/GNUmakefile.list.am >+++ b/Source/WebKit2/GNUmakefile.list.am >@@ -515,6 +515,8 @@ webkit2_sources += \ > Source/WebKit2/Shared/SessionState.h \ > Source/WebKit2/Shared/StatisticsData.cpp \ > Source/WebKit2/Shared/StatisticsData.h \ >+ Source/WebKit2/Shared/soup/CacheModelHelper.cpp \ >+ Source/WebKit2/Shared/soup/CacheModelHelper.h \ > Source/WebKit2/Shared/soup/PlatformCertificateInfo.cpp \ > Source/WebKit2/Shared/soup/PlatformCertificateInfo.h \ > Source/WebKit2/Shared/soup/SoupCookiePersistentStorageType.h \ >diff --git a/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp b/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp >index d8ebacbd0d7f4515ced10c1734bc417cebbc9ef6..010069cf8da766c36130c0d9c6b997be4fef0542 100644 >--- a/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp >+++ b/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp >@@ -28,20 +28,49 @@ > #if ENABLE(NETWORK_PROCESS) > #include "NetworkProcess.h" > >+#include "CacheModelHelper.h" >+#include "Logging.h" > #include "NetworkProcessCreationParameters.h" >+#include "ResourceCachesToClear.h" > #include <WebCore/NotImplemented.h> >+#include <WebCore/ResourceHandle.h> >+ >+#include <libsoup/soup.h> > > using namespace WebCore; > > namespace WebKit { > >-void NetworkProcess::platformInitializeNetworkProcess(const NetworkProcessCreationParameters&) >+void NetworkProcess::platformInitializeNetworkProcess(const NetworkProcessCreationParameters& parameters) > { >+ ASSERT(!parameters.diskCacheDirectory.isEmpty()); >+ GRefPtr<SoupCache> soupCache = adoptGRef(soup_cache_new(parameters.diskCacheDirectory.utf8().data(), SOUP_CACHE_SINGLE_USER)); >+ soup_session_add_feature(WebCore::ResourceHandle::defaultSession(), SOUP_SESSION_FEATURE(soupCache.get())); >+ soup_cache_load(soupCache.get()); > } > >-void NetworkProcess::platformSetCacheModel(CacheModel) >+void NetworkProcess::platformSetCacheModel(CacheModel cacheModel) > { >- notImplemented(); >+ unsigned cacheTotalCapacity = 0; >+ unsigned cacheMinDeadCapacity = 0; >+ unsigned cacheMaxDeadCapacity = 0; >+ double deadDecodedDataDeletionInterval = 0; >+ unsigned pageCacheCapacity = 0; >+ >+ unsigned long urlCacheMemoryCapacity = 0; >+ unsigned long urlCacheDiskCapacity = 0; >+ >+ SoupSession* session = WebCore::ResourceHandle::defaultSession(); >+ SoupCache* cache = SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE)); >+ uint64_t diskFreeSize = getCacheDiskFreeSize(cache) / 1024 / 1024; >+ >+ uint64_t memSize = getMemorySize(); >+ calculateCacheSizes(cacheModel, memSize, diskFreeSize, >+ cacheTotalCapacity, cacheMinDeadCapacity, cacheMaxDeadCapacity, deadDecodedDataDeletionInterval, >+ pageCacheCapacity, urlCacheMemoryCapacity, urlCacheDiskCapacity); >+ >+ if (urlCacheDiskCapacity > soup_cache_get_max_size(cache)) >+ soup_cache_set_max_size(cache, urlCacheDiskCapacity); > } > > void NetworkProcess::allowSpecificHTTPSCertificateForHost(const PlatformCertificateInfo&, const String&) >@@ -51,7 +80,11 @@ void NetworkProcess::allowSpecificHTTPSCertificateForHost(const PlatformCertific > > void NetworkProcess::clearCacheForAllOrigins(uint32_t cachesToClear) > { >- notImplemented(); >+ if (cachesToClear == InMemoryResourceCachesOnly) >+ return; >+ >+ SoupSession* session = WebCore::ResourceHandle::defaultSession(); >+ soup_cache_clear(SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE))); > } > > void NetworkProcess::platformTerminate() >diff --git a/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp b/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp >index 049cecdd2b1b3b7feeb2f327e3b00d9f25d1b3cc..72ec59577b0a641a2416355d4e780f6e474cdc03 100644 >--- a/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp >+++ b/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp >@@ -31,9 +31,11 @@ > > #include "WKBase.h" > #include "WebKit2Initialize.h" >+#include <WebCore/ResourceHandle.h> > #include <WebCore/RunLoop.h> > #include <WebKit2/NetworkProcess.h> > #include <error.h> >+#include <libsoup/soup.h> > #include <runtime/InitializeThreading.h> > #include <stdlib.h> > #include <wtf/MainThread.h> >@@ -71,8 +73,20 @@ WK_EXPORT int NetworkProcessMain(int argc, char* argv[]) > > NetworkProcess::shared().initialize(parameters); > >+ // Despite using system CAs to validate certificates we're >+ // accepting invalid certificates by default. New API will be >+ // added later to let client accept/discard invalid certificates. >+ SoupSession* session = WebCore::ResourceHandle::defaultSession(); >+ g_object_set(session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE, >+ SOUP_SESSION_SSL_STRICT, FALSE, 0); >+ > RunLoop::run(); > >+ if (SoupSessionFeature* soupCache = soup_session_get_feature(session, SOUP_TYPE_CACHE)) { >+ soup_cache_flush(SOUP_CACHE(soupCache)); >+ soup_cache_dump(SOUP_CACHE(soupCache)); >+ } >+ > return 0; > } > >diff --git a/Source/WebKit2/Shared/soup/CacheModelHelper.cpp b/Source/WebKit2/Shared/soup/CacheModelHelper.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..a2d5b56ade60eaa1c95f8e784cb9a1c72cfa3b85 >--- /dev/null >+++ b/Source/WebKit2/Shared/soup/CacheModelHelper.cpp >@@ -0,0 +1,71 @@ >+/* >+ * Copyright (C) 2010 Apple Inc. All rights reserved. >+ * Copyright (C) 2013 Company 100 Inc. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY MOTOROLA INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MOTOROLA INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "CacheModelHelper.h" >+ >+#include <WebCore/FileSystem.h> >+#include <libsoup/soup.h> >+#include <wtf/gobject/GOwnPtr.h> >+#include <wtf/gobject/GRefPtr.h> >+ >+using namespace WebCore; >+ >+namespace WebKit { >+ >+uint64_t getCacheDiskFreeSize(SoupCache* cache) >+{ >+ ASSERT(cache); >+ >+ GOwnPtr<char> cacheDir; >+ g_object_get(G_OBJECT(cache), "cache-dir", &cacheDir.outPtr(), NULL); >+ if (!cacheDir) >+ return 0; >+ >+ return WebCore::getVolumeFreeSizeForPath(cacheDir.get()); >+} >+ >+uint64_t getMemorySize() >+{ >+ static uint64_t kDefaultMemorySize = 512; >+#if !OS(WINDOWS) >+ long pageSize = sysconf(_SC_PAGESIZE); >+ if (pageSize == -1) >+ return kDefaultMemorySize; >+ >+ long physPages = sysconf(_SC_PHYS_PAGES); >+ if (physPages == -1) >+ return kDefaultMemorySize; >+ >+ return ((pageSize / 1024) * physPages) / 1024; >+#else >+ // Fallback to default for other platforms. >+ return kDefaultMemorySize; >+#endif >+} >+ >+} // namespace WebKit >+ >diff --git a/Source/WebKit2/Shared/soup/CacheModelHelper.h b/Source/WebKit2/Shared/soup/CacheModelHelper.h >new file mode 100644 >index 0000000000000000000000000000000000000000..82e7d2572f5d295d6418e93436c5321544f100c8 >--- /dev/null >+++ b/Source/WebKit2/Shared/soup/CacheModelHelper.h >@@ -0,0 +1,40 @@ >+/* >+ * Copyright (C) 2010 Apple Inc. All rights reserved. >+ * Copyright (C) 2013 Company 100 Inc. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY MOTOROLA INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MOTOROLA INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef CacheModelHelper_h >+#define CacheModelHelper_h >+ >+#include <libsoup/soup.h> >+#include <stdint.h> >+ >+namespace WebKit { >+ >+uint64_t getCacheDiskFreeSize(SoupCache*); >+uint64_t getMemorySize(); >+ >+} // namespace WebKit >+ >+#endif // CacheModelHelper_h >diff --git a/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp b/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp >index c7bea92864f1c28a7600c653f019f865ace7e29d..59cfc333d2d88415df747fbb49cf74bd2607dffb 100644 >--- a/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp >+++ b/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp >@@ -31,6 +31,7 @@ > #include "SeccompFiltersWebProcessEfl.h" > #endif > >+#include "CacheModelHelper.h" > #include "WebCookieManager.h" > #include "WebProcessCreationParameters.h" > #include "WebSoupRequestManager.h" >@@ -40,44 +41,12 @@ > #include <WebCore/PageCache.h> > #include <WebCore/ResourceHandle.h> > #include <libsoup/soup.h> >-#include <wtf/gobject/GOwnPtr.h> > #include <wtf/gobject/GRefPtr.h> > #include <wtf/text/CString.h> > #include <wtf/text/StringBuilder.h> > > namespace WebKit { > >-static uint64_t getCacheDiskFreeSize(SoupCache* cache) >-{ >- ASSERT(cache); >- >- GOwnPtr<char> cacheDir; >- g_object_get(G_OBJECT(cache), "cache-dir", &cacheDir.outPtr(), NULL); >- if (!cacheDir) >- return 0; >- >- return WebCore::getVolumeFreeSizeForPath(cacheDir.get()); >-} >- >-static uint64_t getMemorySize() >-{ >- static uint64_t kDefaultMemorySize = 512; >-#if !OS(WINDOWS) >- long pageSize = sysconf(_SC_PAGESIZE); >- if (pageSize == -1) >- return kDefaultMemorySize; >- >- long physPages = sysconf(_SC_PHYS_PAGES); >- if (physPages == -1) >- return kDefaultMemorySize; >- >- return ((pageSize / 1024) * physPages) / 1024; >-#else >- // Fallback to default for other platforms. >- return kDefaultMemorySize; >-#endif >-} >- > void WebProcess::platformSetCacheModel(CacheModel cacheModel) > { > unsigned cacheTotalCapacity = 0;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 118343
:
205980
|
212715
|
213006
|
213980
|
214269
|
214274
|
218743