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
1.patch (text/plain), 15.01 KB, created by
Csaba Osztrogonác
on 2013-09-26 09:04:34 PDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Csaba Osztrogonác
Created:
2013-09-26 09:04:34 PDT
Size:
15.01 KB
patch
obsolete
>commit 8e9a9c789f3b59183836554b194eb02a8ad39b4f >Author: Csaba Osztrogonác <ossy@webkit.org> >Date: Thu Sep 26 18:02:37 2013 +0200 > > [WK2][Soup] Support cache model in NetworkProcess > https://bugs.webkit.org/show_bug.cgi?id=118343 > > Patch by Kwang Yul Seo <skyul@company100.net> on 2013-09-26 > 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. > > The following things were fixed by Csaba Osztrogonác: > - Remove session variable not to have conflict with https://bugs.webkit.org/show_bug.cgi?id=118388 > - Add GRefPtr.h include. > > * 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: > >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index 05297ad..ffcdcdf 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,5 +1,44 @@ > 2013-09-26 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. >+ >+ The following things were fixed by Csaba Osztrogonác: >+ - Remove session variable not to have conflict with https://bugs.webkit.org/show_bug.cgi?id=118388 >+ - Add GRefPtr.h include. >+ >+ * 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-09-26 Kwang Yul Seo <skyul@company100.net> >+ > [WK2][Soup] Add platform specific stubs for NetworkProcess > https://bugs.webkit.org/show_bug.cgi?id=110115 > >diff --git a/Source/WebKit2/GNUmakefile.list.am b/Source/WebKit2/GNUmakefile.list.am >index 9b7c269..8ef68f5 100644 >--- a/Source/WebKit2/GNUmakefile.list.am >+++ b/Source/WebKit2/GNUmakefile.list.am >@@ -479,6 +479,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 d8ebacb..a54404b 100644 >--- a/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp >+++ b/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp >@@ -28,20 +28,50 @@ > #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> >+#include <wtf/gobject/GRefPtr.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 +81,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 c82af84..f09ba33 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> >@@ -70,8 +72,19 @@ 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. >+ 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 0000000..a2d5b56 >--- /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 0000000..82e7d25 >--- /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 c7bea92..59cfc33 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