Commit e3e1391b authored by carlosgc@webkit.org's avatar carlosgc@webkit.org

[SOUP] Soup disk cache should respect the diskCacheDirectory from the process initial parameters

https://bugs.webkit.org/show_bug.cgi?id=111845

Reviewed by Anders Carlsson.

Move the cache initialization to platformInitializeWebProcess() to
create the cache using the directory received from the UI
process. This allows to add public API to set a different disk
cache directory from the UI process.

* UIProcess/efl/WebContextEfl.cpp:
(WebKit::WebContext::platformDefaultDiskCacheDirectory): Return
default disk cache directory.
* UIProcess/gtk/WebContextGtk.cpp:
(WebKit::WebContext::platformDefaultDiskCacheDirectory): Ditto.
* WebProcess/efl/WebProcessMainEfl.cpp:
(WebKit::WebProcessMainEfl): Remove soup cache initialization.
* WebProcess/gtk/WebProcessMainGtk.cpp:
(WebKit::WebProcessMainGtk): Ditto.
* WebProcess/soup/WebProcessSoup.cpp:
(WebKit::WebProcess::platformInitializeWebProcess): Initialize
soup cache.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 790745ad
2013-04-22 Carlos Garcia Campos <cgarcia@igalia.com>
[SOUP] Soup disk cache should respect the diskCacheDirectory from the process initial parameters
https://bugs.webkit.org/show_bug.cgi?id=111845
Reviewed by Anders Carlsson.
Move the cache initialization to platformInitializeWebProcess() to
create the cache using the directory received from the UI
process. This allows to add public API to set a different disk
cache directory from the UI process.
* UIProcess/efl/WebContextEfl.cpp:
(WebKit::WebContext::platformDefaultDiskCacheDirectory): Return
default disk cache directory.
* UIProcess/gtk/WebContextGtk.cpp:
(WebKit::WebContext::platformDefaultDiskCacheDirectory): Ditto.
* WebProcess/efl/WebProcessMainEfl.cpp:
(WebKit::WebProcessMainEfl): Remove soup cache initialization.
* WebProcess/gtk/WebProcessMainGtk.cpp:
(WebKit::WebProcessMainGtk): Ditto.
* WebProcess/soup/WebProcessSoup.cpp:
(WebKit::WebProcess::platformInitializeWebProcess): Initialize
soup cache.
2013-04-22 Krzysztof Wolanski <k.wolanski@samsung.com>:
[WK2] Fix build warning when GESTURE_EVENTS is ON.
......@@ -117,8 +117,7 @@ String WebContext::platformDefaultLocalStorageDirectory() const
String WebContext::platformDefaultDiskCacheDirectory() const
{
notImplemented();
return String();
return String::fromUTF8(efreet_cache_home_get()) + "/WebKitEfl";
}
String WebContext::platformDefaultCookieStorageDirectory() const
......
......@@ -119,8 +119,8 @@ String WebContext::platformDefaultLocalStorageDirectory() const
String WebContext::platformDefaultDiskCacheDirectory() const
{
notImplemented();
return String();
GOwnPtr<char> diskCacheDirectory(g_build_filename(g_get_user_cache_dir(), g_get_prgname(), NULL));
return WebCore::filenameToString(diskCacheDirectory.get());
}
String WebContext::platformDefaultCookieStorageDirectory() const
......
......@@ -123,12 +123,6 @@ WK_EXPORT int WebProcessMainEfl(int argc, char* argv[])
g_object_unref(resolverEfl);
}
// Set SOUP cache.
String soupCacheDirectory = String::fromUTF8(efreet_cache_home_get()) + "/WebKitEfl";
SoupCache* soupCache = soup_cache_new(soupCacheDirectory.utf8().data(), SOUP_CACHE_SINGLE_USER);
soup_session_add_feature(session, SOUP_SESSION_FEATURE(soupCache));
soup_cache_load(soupCache);
int socket = atoi(argv[1]);
ChildProcessInitializationParameters parameters;
......@@ -138,9 +132,10 @@ WK_EXPORT int WebProcessMainEfl(int argc, char* argv[])
RunLoop::run();
soup_cache_flush(soupCache);
soup_cache_dump(soupCache);
g_object_unref(soupCache);
if (SoupSessionFeature* soupCache = soup_session_get_feature(session, SOUP_TYPE_CACHE)) {
soup_cache_flush(SOUP_CACHE(soupCache));
soup_cache_dump(SOUP_CACHE(soupCache));
}
edje_shutdown();
ecore_evas_shutdown();
......
......@@ -75,15 +75,12 @@ WK_EXPORT int WebProcessMainGtk(int argc, char* argv[])
g_object_set(session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
SOUP_SESSION_SSL_STRICT, FALSE, NULL);
GOwnPtr<char> soupCacheDirectory(g_build_filename(g_get_user_cache_dir(), g_get_prgname(), NULL));
GRefPtr<SoupCache> soupCache = adoptGRef(soup_cache_new(soupCacheDirectory.get(), SOUP_CACHE_SINGLE_USER));
soup_session_add_feature(session, SOUP_SESSION_FEATURE(soupCache.get()));
soup_cache_load(soupCache.get());
RunLoop::run();
soup_cache_flush(soupCache.get());
soup_cache_dump(soupCache.get());
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;
}
......
......@@ -175,6 +175,11 @@ void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters
}
#endif
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());
if (!parameters.languages.isEmpty())
setSoupSessionAcceptLanguage(parameters.languages);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment