Changeset 183387 in webkit
- Timestamp:
- Apr 26, 2015 11:17:05 PM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 4 added
- 1 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r183385 r183387 1 2015-04-17 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [SOUP] Add initial implementation of NetworkProcess disk cache 4 https://bugs.webkit.org/show_bug.cgi?id=143872 5 6 Reviewed by Martin Robinson. 7 8 Allow to create a GRefPtr for SoupBuffer. Even though SoupBuffer 9 is not a GObject and has copy/free functions instead of ref/unref, 10 it's internally refcounted, so we could use copy/free as 11 ref/unref. 12 13 * PlatformGTK.cmake: 14 * platform/network/soup/GRefPtrSoup.cpp: Added. 15 (WTF::refGPtr): 16 (WTF::derefGPtr): 17 * platform/network/soup/GRefPtrSoup.h: Added. 18 1 19 2015-04-26 Manuel Rego Casasnovas <rego@igalia.com> 2 20 -
trunk/Source/WebCore/PlatformGTK.cmake
r183265 r183387 160 160 platform/network/soup/CredentialStorageSoup.cpp 161 161 platform/network/soup/DNSSoup.cpp 162 platform/network/soup/GRefPtrSoup.cpp 162 163 platform/network/soup/NetworkStorageSessionSoup.cpp 163 164 platform/network/soup/ProxyServerSoup.cpp -
trunk/Source/WebKit2/CMakeLists.txt
r182865 r183387 165 165 166 166 NetworkProcess/cache/NetworkCache.cpp 167 NetworkProcess/cache/NetworkCacheBlobStorage.cpp 167 168 NetworkProcess/cache/NetworkCacheCoders.cpp 169 NetworkProcess/cache/NetworkCacheDecoder.cpp 168 170 NetworkProcess/cache/NetworkCacheEncoder.cpp 169 NetworkProcess/cache/NetworkCache Decoder.cpp171 NetworkProcess/cache/NetworkCacheEntry.cpp 170 172 NetworkProcess/cache/NetworkCacheKey.cpp 173 NetworkProcess/cache/NetworkCacheStatistics.cpp 174 NetworkProcess/cache/NetworkCacheStorage.cpp 171 175 ) 172 176 -
trunk/Source/WebKit2/ChangeLog
r183373 r183387 1 2015-04-17 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [SOUP] Add initial implementation of NetworkProcess disk cache 4 https://bugs.webkit.org/show_bug.cgi?id=143872 5 6 Reviewed by Martin Robinson. 7 8 Implement the platform specific parts of the disk cache 9 implementation for Soup. It's mainly NetworkCache::Data and 10 NetworkCache::IOChannel. 11 12 * CMakeLists.txt: 13 * NetworkProcess/cache/NetworkCache.cpp: 14 (WebKit::NetworkCache::dumpFileChanged): 15 (WebKit::NetworkCache::Cache::initialize): 16 * NetworkProcess/cache/NetworkCacheBlobStorage.cpp: 17 * NetworkProcess/cache/NetworkCacheData.h: 18 (WebKit::NetworkCache::Data::soupBuffer): 19 * NetworkProcess/cache/NetworkCacheDataSoup.cpp: Added. 20 (WebKit::NetworkCache::Data::Data): 21 (WebKit::NetworkCache::Data::empty): 22 (WebKit::NetworkCache::Data::data): 23 (WebKit::NetworkCache::Data::isNull): 24 (WebKit::NetworkCache::Data::apply): 25 (WebKit::NetworkCache::Data::subrange): 26 (WebKit::NetworkCache::concatenate): 27 (WebKit::NetworkCache::MapWrapper::~MapWrapper): 28 (WebKit::NetworkCache::deleteMapWrapper): 29 (WebKit::NetworkCache::mapFile): 30 (WebKit::NetworkCache::Data::adoptMap): 31 (WebKit::NetworkCache::computeSHA1): 32 (WebKit::NetworkCache::bytesEqual): 33 * NetworkProcess/cache/NetworkCacheIOChannel.h: 34 * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp: Added. 35 (WebKit::NetworkCache::IOChannel::IOChannel): 36 (WebKit::NetworkCache::IOChannel::open): 37 (WebKit::NetworkCache::fillDataFromReadBuffer): 38 (WebKit::NetworkCache::inputStreamReadReadyCallback): 39 (WebKit::NetworkCache::IOChannel::read): 40 (WebKit::NetworkCache::IOChannel::readSync): 41 (WebKit::NetworkCache::outputStreamWriteReadyCallback): 42 (WebKit::NetworkCache::IOChannel::write): 43 * NetworkProcess/cache/NetworkCacheStorageSoup.cpp: Removed. 44 * NetworkProcess/gtk/NetworkProcessMainGtk.cpp: 45 * NetworkProcess/soup/NetworkProcessSoup.cpp: 46 (WebKit::NetworkProcess::platformInitializeNetworkProcess): 47 (WebKit::NetworkProcess::platformSetCacheModel): 48 (WebKit::NetworkProcess::clearDiskCache): 49 * PlatformGTK.cmake: 50 1 51 2015-04-26 Yusuke Suzuki <utatane.tea@gmail.com> 2 52 -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp
r183081 r183387 56 56 } 57 57 58 #if PLATFORM(GTK) 59 static void dumpFileChanged(Cache* cache) 60 { 61 cache->dumpContentsToFile(); 62 } 63 #endif 64 58 65 bool Cache::initialize(const String& cachePath, bool enableEfficacyLogging) 59 66 { … … 70 77 dumpContentsToFile(); 71 78 }); 79 } 80 #endif 81 #if PLATFORM(GTK) 82 // Triggers with "touch $cachePath/dump". 83 if (m_storage) { 84 CString dumpFilePath = WebCore::fileSystemRepresentation(WebCore::pathByAppendingComponent(m_storage->basePath(), "dump")); 85 GRefPtr<GFile> dumpFile = adoptGRef(g_file_new_for_path(dumpFilePath.data())); 86 GFileMonitor* monitor = g_file_monitor_file(dumpFile.get(), G_FILE_MONITOR_NONE, nullptr, nullptr); 87 g_signal_connect_swapped(monitor, "changed", G_CALLBACK(dumpFileChanged), this); 72 88 } 73 89 #endif -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheBlobStorage.cpp
r182803 r183387 32 32 #include "NetworkCacheFileSystemPosix.h" 33 33 #include <WebCore/FileSystem.h> 34 #include <fcntl.h> 34 35 #include <sys/mman.h> 35 36 #include <wtf/RunLoop.h> -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheData.h
r182803 r183387 34 34 #include <wtf/ThreadSafeRefCounted.h> 35 35 #include <wtf/text/WTFString.h> 36 37 #if USE(SOUP) 38 #include <WebCore/GRefPtrSoup.h> 39 #endif 36 40 37 41 namespace WebKit { … … 107 111 Data(DispatchPtr<dispatch_data_t>, Backing = Backing::Buffer); 108 112 #endif 113 #if USE(SOUP) 114 Data(GRefPtr<SoupBuffer>&&, Backing = Backing::Buffer); 115 #endif 109 116 bool isNull() const; 110 117 bool isEmpty() const { return !m_size; } … … 121 128 dispatch_data_t dispatchData() const { return m_dispatchData.get(); } 122 129 #endif 130 131 #if USE(SOUP) 132 SoupBuffer* soupBuffer() const { return m_buffer.get(); } 133 #endif 123 134 private: 124 135 #if PLATFORM(COCOA) 125 136 mutable DispatchPtr<dispatch_data_t> m_dispatchData; 137 #endif 138 #if USE(SOUP) 139 mutable GRefPtr<SoupBuffer> m_buffer; 126 140 #endif 127 141 mutable const uint8_t* m_data { nullptr }; -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannel.h
r182856 r183387 35 35 #include <wtf/text/WTFString.h> 36 36 37 #if USE(SOUP) 38 #include <wtf/gobject/GRefPtr.h> 39 #endif 40 37 41 namespace WebKit { 38 42 namespace NetworkCache { … … 64 68 DispatchPtr<dispatch_io_t> m_dispatchIO; 65 69 #endif 70 #if USE(SOUP) 71 GRefPtr<GInputStream> m_inputStream; 72 GRefPtr<GOutputStream> m_outputStream; 73 GRefPtr<GFileIOStream> m_ioStream; 74 #endif 66 75 }; 67 76 -
trunk/Source/WebKit2/NetworkProcess/gtk/NetworkProcessMainGtk.cpp
r176724 r183387 49 49 void platformFinalize() override 50 50 { 51 #if !ENABLE(NETWORK_CACHE) 51 52 if (SoupCache* soupCache = SoupNetworkSession::defaultSession().cache()) { 52 53 soup_cache_flush(soupCache); 53 54 soup_cache_dump(soupCache); 54 55 } 56 #endif 55 57 } 56 58 }; -
trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp
r183255 r183387 29 29 #include "NetworkProcess.h" 30 30 31 #include "NetworkCache.h" 31 32 #include "NetworkProcessCreationParameters.h" 32 33 #include "ResourceCachesToClear.h" … … 45 46 namespace WebKit { 46 47 48 #if !ENABLE(NETWORK_CACHE) 47 49 static uint64_t getCacheDiskFreeSize(SoupCache* cache) 48 50 { … … 56 58 return WebCore::getVolumeFreeSizeForPath(cacheDir.get()); 57 59 } 60 #endif 58 61 59 62 static uint64_t getMemorySize() … … 84 87 { 85 88 ASSERT(!parameters.diskCacheDirectory.isEmpty()); 89 m_diskCacheDirectory = parameters.diskCacheDirectory; 86 90 91 #if ENABLE(NETWORK_CACHE) 92 // Clear the old soup cache if it exists. 93 SoupNetworkSession::defaultSession().clearCache(m_diskCacheDirectory); 94 95 NetworkCache::singleton().initialize(m_diskCacheDirectory, parameters.shouldEnableNetworkCacheEfficacyLogging); 96 #else 87 97 // We used to use the given cache directory for the soup cache, but now we use a subdirectory to avoid 88 98 // conflicts with other cache files in the same directory. Remove the old cache files if they still exist. … … 98 108 soup_cache_load(soupCache.get()); 99 109 soup_cache_set_max_size(soupCache.get(), initialMaxSize); 110 #endif 100 111 101 112 if (!parameters.cookiePersistentStoragePath.isEmpty()) { … … 122 133 unsigned long urlCacheDiskCapacity = 0; 123 134 135 #if ENABLE(NETWORK_CACHE) 136 uint64_t diskFreeSize = WebCore::getVolumeFreeSizeForPath(m_diskCacheDirectory.utf8().data()) / 1024 / 1024; 137 #else 124 138 SoupCache* cache = SoupNetworkSession::defaultSession().cache(); 125 139 uint64_t diskFreeSize = getCacheDiskFreeSize(cache) / 1024 / 1024; 140 #endif 126 141 127 142 uint64_t memSize = getMemorySize(); … … 130 145 pageCacheCapacity, urlCacheMemoryCapacity, urlCacheDiskCapacity); 131 146 147 #if ENABLE(NETWORK_CACHE) 148 auto& networkCache = NetworkCache::singleton(); 149 if (networkCache.isEnabled()) 150 networkCache.setCapacity(urlCacheDiskCapacity); 151 #else 132 152 if (urlCacheDiskCapacity > soup_cache_get_max_size(cache)) 133 153 soup_cache_set_max_size(cache, urlCacheDiskCapacity); 154 #endif 134 155 } 135 156 … … 155 176 { 156 177 // FIXME: Find a way to only clear a part of the cache based on the date. 178 #if ENABLE(NETWORK_CACHE) 179 NetworkCache::singleton().clear(); 180 #else 157 181 soup_cache_clear(SoupNetworkSession::defaultSession().cache()); 182 #endif 158 183 } 159 184 -
trunk/Source/WebKit2/PlatformGTK.cmake
r182882 r183387 19 19 DatabaseProcess/gtk/DatabaseProcessMainGtk.cpp 20 20 21 NetworkProcess/cache/NetworkCacheStorageSoup.cpp 21 NetworkProcess/cache/NetworkCacheDataSoup.cpp 22 NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp 22 23 23 24 NetworkProcess/gtk/NetworkProcessMainGtk.cpp
Note: See TracChangeset
for help on using the changeset viewer.