Changeset 122571 in webkit
- Timestamp:
- Jul 13, 2012 6:47:01 AM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r122570 r122571 1 2012-07-13 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Implement disk cache in WebKit2 4 https://bugs.webkit.org/show_bug.cgi?id=90797 5 6 Reviewed by Xan Lopez. 7 8 * WebProcess/gtk/WebProcessGtk.cpp: 9 (WebKit::getCacheDiskFreeSize): Use an ASSERT instead of an early 10 return since the cache feature is now always added to the session. 11 (WebKit::WebProcess::platformSetCacheModel): Get the cache from 12 the session and set the maximum cache size as computed by 13 calculateCacheSizes(). 14 (WebKit::WebProcess::platformClearResourceCaches): Call 15 soup_cache_clear(). 16 (WebKit::WebProcess::platformTerminate): Make sure all pending 17 data is saved to the disk before the web process finishes. 18 * WebProcess/gtk/WebProcessMainGtk.cpp: 19 (WebKit::WebProcessMainGtk): Create a SoupCache feature and add it 20 to the default SoupSession. 21 1 22 2012-07-13 Carlos Garcia Campos <cgarcia@igalia.com> 2 23 -
trunk/Source/WebKit2/WebProcess/gtk/WebProcessGtk.cpp
r122570 r122571 48 48 static uint64_t getCacheDiskFreeSize(SoupCache* cache) 49 49 { 50 if (!cache) 51 return 0; 50 ASSERT(cache); 52 51 53 52 GOwnPtr<char> cacheDir; … … 90 89 91 90 SoupSession* session = WebCore::ResourceHandle::defaultSession(); 92 SoupCache* cache = reinterpret_cast<SoupCache*>(soup_session_get_feature(session, SOUP_TYPE_CACHE));91 SoupCache* cache = SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE)); 93 92 uint64_t diskFreeSize = getCacheDiskFreeSize(cache) / 1024 / 1024; 94 93 … … 102 101 WebCore::pageCache()->setCapacity(pageCacheCapacity); 103 102 104 if (cache) { 105 if (urlCacheDiskCapacity > soup_cache_get_max_size(cache)) 106 soup_cache_set_max_size(cache, urlCacheDiskCapacity); 107 } 103 if (urlCacheDiskCapacity > soup_cache_get_max_size(cache)) 104 soup_cache_set_max_size(cache, urlCacheDiskCapacity); 108 105 } 109 106 110 void WebProcess::platformClearResourceCaches(ResourceCachesToClear )107 void WebProcess::platformClearResourceCaches(ResourceCachesToClear cachesToClear) 111 108 { 112 notImplemented(); 109 if (cachesToClear == InMemoryResourceCachesOnly) 110 return; 111 112 SoupSession* session = WebCore::ResourceHandle::defaultSession(); 113 soup_cache_clear(SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE))); 113 114 } 114 115 … … 120 121 void WebProcess::platformTerminate() 121 122 { 123 SoupSession* session = WebCore::ResourceHandle::defaultSession(); 124 SoupCache* cache = SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE)); 125 soup_cache_flush(cache); 126 soup_cache_dump(cache); 122 127 } 123 128 -
trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
r109338 r122571 28 28 #include "WebProcessMainGtk.h" 29 29 30 #define LIBSOUP_USE_UNSTABLE_REQUEST_API 31 30 32 #include "WebAuthDialog.h" 31 33 #include "WKBase.h" … … 35 37 #include <WebKit2/WebProcess.h> 36 38 #include <gtk/gtk.h> 39 #include <libsoup/soup-cache.h> 37 40 #include <runtime/InitializeThreading.h> 38 41 #include <unistd.h> 39 42 #include <wtf/MainThread.h> 43 #include <wtf/gobject/GOwnPtr.h> 44 #include <wtf/gobject/GRefPtr.h> 40 45 41 46 using namespace WebCore; … … 71 76 SOUP_SESSION_SSL_STRICT, FALSE, NULL); 72 77 78 GOwnPtr<char> soupCacheDirectory(g_build_filename(g_get_user_cache_dir(), g_get_prgname(), NULL)); 79 GRefPtr<SoupCache> soupCache = adoptGRef(soup_cache_new(soupCacheDirectory.get(), SOUP_CACHE_SINGLE_USER)); 80 soup_session_add_feature(session, SOUP_SESSION_FEATURE(soupCache.get())); 81 soup_cache_load(soupCache.get()); 82 73 83 RunLoop::run(); 74 84
Note: See TracChangeset
for help on using the changeset viewer.