Changeset 221426 in webkit
- Timestamp:
- Aug 31, 2017 11:19:54 AM (7 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r221420 r221426 1 2017-08-31 Youenn Fablet <youenn@apple.com> 2 3 Do not create a salt if the CacheStorage engine should not persist 4 https://bugs.webkit.org/show_bug.cgi?id=176138 5 6 Reviewed by Alex Christensen. 7 8 * NetworkProcess/cache/CacheStorageEngine.cpp: 9 (WebKit::CacheStorage::Engine::~Engine): Ensuring that Caches will not try using the engine if it goes away. 10 (WebKit::CacheStorage::Engine::initialize): Removing making a salt if engine data is not persistent. 11 * NetworkProcess/cache/CacheStorageEngine.h: Check persistency according the root path. If it is null, caches should not try to do persistency. 12 * NetworkProcess/cache/CacheStorageEngineCaches.cpp: 13 (WebKit::CacheStorage::cachesRootPath): 14 (WebKit::CacheStorage::Caches::initialize): 15 (WebKit::CacheStorage::Caches::detach): 16 (WebKit::CacheStorage::Caches::readCachesFromDisk): 17 (WebKit::CacheStorage::Caches::writeCachesToDisk): 18 * NetworkProcess/cache/CacheStorageEngineCaches.h: 19 (WebKit::CacheStorage::Caches::shouldPersist const): 20 * NetworkProcess/cache/NetworkCacheData.cpp: Making makeSalt private again. 21 (WebKit::NetworkCache::makeSalt): 22 * NetworkProcess/cache/NetworkCacheData.h: 23 24 1 25 2017-08-31 Carlos Garcia Campos <cgarcia@igalia.com> 2 26 -
trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp
r221410 r221426 49 49 } 50 50 51 Engine::~Engine() 52 { 53 for (auto& caches : m_caches.values()) 54 caches->detach(); 55 } 56 51 57 Engine& Engine::from(PAL::SessionID sessionID) 52 58 { … … 239 245 240 246 if (!shouldPersist()) { 241 m_salt = makeSalt();242 247 callback(std::nullopt); 243 248 return; -
trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h
r221410 r221426 46 46 class Engine : public ThreadSafeRefCounted<Engine> { 47 47 public: 48 ~Engine(); 49 48 50 static Engine& from(PAL::SessionID); 49 51 static void destroyEngine(PAL::SessionID); -
trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp
r221403 r221426 39 39 static inline String cachesRootPath(Engine& engine, const String& origin) 40 40 { 41 if (!engine.shouldPersist()) 42 return { }; 43 41 44 Key key(engine.rootPath(), { }, { }, origin, engine.salt()); 42 45 return WebCore::pathByAppendingComponent(engine.rootPath(), key.partitionHashAsString()); … … 56 59 void Caches::initialize(WebCore::DOMCache::CompletionCallback&& callback) 57 60 { 58 if (m_isInitialized || !m_engine || !m_engine->shouldPersist()) {61 if (m_isInitialized || m_rootPath.isNull()) { 59 62 callback(std::nullopt); 60 63 return; … … 89 92 callback(std::nullopt); 90 93 }); 94 } 95 96 void Caches::detach() 97 { 98 m_engine = nullptr; 99 m_rootPath = { }; 91 100 } 92 101 … … 177 186 ASSERT(m_caches.isEmpty()); 178 187 179 if (! m_engine->shouldPersist()) {188 if (!shouldPersist()) { 180 189 callback(Vector<Cache> { }); 181 190 return; … … 210 219 void Caches::writeCachesToDisk(CompletionCallback&& callback) 211 220 { 212 if (! m_engine->shouldPersist()) {221 if (!shouldPersist()) { 213 222 callback(std::nullopt); 214 223 return; -
trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.h
r221403 r221426 52 52 53 53 void clearMemoryRepresentation(); 54 void detach() { m_engine = nullptr; }54 void detach(); 55 55 56 56 private: … … 59 59 void readCachesFromDisk(WTF::Function<void(Expected<Vector<Cache>, WebCore::DOMCache::Error>&&)>&&); 60 60 void writeCachesToDisk(WebCore::DOMCache::CompletionCallback&&); 61 62 bool shouldPersist() const { return !m_rootPath.isNull(); } 61 63 62 64 bool m_isInitialized { false }; -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheData.cpp
r221403 r221426 129 129 } 130 130 131 Salt makeSalt()131 static Salt makeSalt() 132 132 { 133 133 Salt salt; -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheData.h
r221403 r221426 106 106 using Salt = std::array<uint8_t, 8>; 107 107 108 Salt makeSalt();109 108 std::optional<Salt> readOrMakeSalt(const String& path); 110 109 SHA1::Digest computeSHA1(const Data&, const Salt&);
Note: See TracChangeset
for help on using the changeset viewer.