Changeset 184096 in webkit
- Timestamp:
- May 11, 2015, 7:00:44 AM (10 years ago)
- Location:
- releases/WebKitGTK/webkit-2.8/Source
- Files:
-
- 6 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/platform/network/soup/SoupNetworkSession.cpp (modified) (2 diffs)
-
WebCore/platform/network/soup/SoupNetworkSession.h (modified) (1 diff)
-
WebKit2/ChangeLog (modified) (1 diff)
-
WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp (modified) (1 diff)
-
WebKit2/WebProcess/soup/WebProcessSoup.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog
r184095 r184096 1 2015-04-24 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [SOUP] Use a webkit subdirectory for the disk cache 4 https://bugs.webkit.org/show_bug.cgi?id=144048 5 6 Reviewed by Martin Robinson. 7 8 Add a static method to SoupNetworkSession to clear a soup cache 9 given its directory. 10 11 * platform/network/soup/SoupNetworkSession.cpp: 12 (WebCore::strIsNumeric): 13 (WebCore::SoupNetworkSession::clearCache): 14 * platform/network/soup/SoupNetworkSession.h: 15 1 16 2015-04-23 Chris Dumez <cdumez@apple.com> 2 17 -
releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp
r180931 r184096 32 32 #include "AuthenticationChallenge.h" 33 33 #include "CookieJarSoup.h" 34 #include "FileSystem.h" 34 35 #include "GUniquePtrSoup.h" 35 36 #include "Logging.h" 36 37 #include "ResourceHandle.h" 38 #include <glib/gstdio.h> 37 39 #include <libsoup/soup.h> 38 40 #include <wtf/text/CString.h> … … 166 168 } 167 169 170 static inline bool stringIsNumeric(const char* str) 171 { 172 while (*str) { 173 if (!g_ascii_isdigit(*str)) 174 return false; 175 str++; 176 } 177 return true; 178 } 179 180 void SoupNetworkSession::clearCache(const String& cacheDirectory) 181 { 182 CString cachePath = fileSystemRepresentation(cacheDirectory); 183 GUniquePtr<char> cacheFile(g_build_filename(cachePath.data(), "soup.cache2", nullptr)); 184 if (!g_file_test(cacheFile.get(), G_FILE_TEST_IS_REGULAR)) 185 return; 186 187 GUniquePtr<GDir> dir(g_dir_open(cachePath.data(), 0, nullptr)); 188 if (!dir) 189 return; 190 191 while (const char* name = g_dir_read_name(dir.get())) { 192 if (!g_str_has_prefix(name, "soup.cache") && !stringIsNumeric(name)) 193 continue; 194 195 GUniquePtr<gchar> filename(g_build_filename(cachePath.data(), name, nullptr)); 196 if (g_file_test(filename.get(), G_FILE_TEST_IS_REGULAR)) 197 g_unlink(filename.get()); 198 } 199 } 200 168 201 void SoupNetworkSession::setSSLPolicy(SSLPolicy flags) 169 202 { -
releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/network/soup/SoupNetworkSession.h
r165676 r184096 61 61 void setCache(SoupCache*); 62 62 SoupCache* cache() const; 63 static void clearCache(const String& cacheDirectory); 63 64 64 65 void setSSLPolicy(SSLPolicy); -
releases/WebKitGTK/webkit-2.8/Source/WebKit2/ChangeLog
r184095 r184096 1 2015-04-24 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [SOUP] Use a webkit subdirectory for the disk cache 4 https://bugs.webkit.org/show_bug.cgi?id=144048 5 6 Reviewed by Martin Robinson. 7 8 Recent versions of libsoup remove any file in cache dir not 9 referenced by the index when the cache is loaded to workaround 10 leaked resources when load/dump is unbalanced for whatever reason, 11 like a crash. We currently use $XDG_CACHE_HOME/app-name as default 12 disk cache directory, but that directory could be used by apps to 13 cache other things, and the soup cache might end up deleting other 14 stuff. The soup cache assumes the given directory is only for the 15 disk cache, so we should ensure that. 16 17 * NetworkProcess/soup/NetworkProcessSoup.cpp: 18 (WebKit::NetworkProcess::platformInitializeNetworkProcess): Append 19 webkit to the given disk cache and clear the previous soup cache if it exists. 20 * WebProcess/soup/WebProcessSoup.cpp: 21 (WebKit::WebProcess::platformInitializeWebProcess): Ditto. 22 1 23 2015-04-23 Chris Dumez <cdumez@apple.com> 2 24 -
releases/WebKitGTK/webkit-2.8/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp
r177145 r184096 84 84 { 85 85 ASSERT(!parameters.diskCacheDirectory.isEmpty()); 86 GRefPtr<SoupCache> soupCache = adoptGRef(soup_cache_new(parameters.diskCacheDirectory.utf8().data(), SOUP_CACHE_SINGLE_USER)); 86 87 // We used to use the given cache directory for the soup cache, but now we use a subdirectory to avoid 88 // conflicts with other cache files in the same directory. Remove the old cache files if they still exist. 89 SoupNetworkSession::defaultSession().clearCache(parameters.diskCacheDirectory); 90 91 String diskCachePath = WebCore::pathByAppendingComponent(parameters.diskCacheDirectory, "webkit"); 92 GRefPtr<SoupCache> soupCache = adoptGRef(soup_cache_new(diskCachePath.utf8().data(), SOUP_CACHE_SINGLE_USER)); 87 93 SoupNetworkSession::defaultSession().setCache(soupCache.get()); 88 94 // Set an initial huge max_size for the SoupCache so the call to soup_cache_load() won't evict any cached -
releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp
r179489 r184096 155 155 156 156 ASSERT(!parameters.diskCacheDirectory.isEmpty()); 157 GRefPtr<SoupCache> soupCache = adoptGRef(soup_cache_new(parameters.diskCacheDirectory.utf8().data(), SOUP_CACHE_SINGLE_USER)); 157 158 // We used to use the given cache directory for the soup cache, but now we use a subdirectory to avoid 159 // conflicts with other cache files in the same directory. Remove the old cache files if they still exist. 160 WebCore::SoupNetworkSession::defaultSession().clearCache(parameters.diskCacheDirectory); 161 162 String diskCachePath = WebCore::pathByAppendingComponent(parameters.diskCacheDirectory, "webkit"); 163 GRefPtr<SoupCache> soupCache = adoptGRef(soup_cache_new(diskCachePath.utf8().data(), SOUP_CACHE_SINGLE_USER)); 158 164 WebCore::SoupNetworkSession::defaultSession().setCache(soupCache.get()); 159 165 // Set an initial huge max_size for the SoupCache so the call to soup_cache_load() won't evict any cached
Note:
See TracChangeset
for help on using the changeset viewer.