Changeset 181816 in webkit
- Timestamp:
- Mar 20, 2015, 4:09:56 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
NetworkProcess/cache/NetworkCacheStorage.cpp (modified) (4 diffs)
-
NetworkProcess/cache/NetworkCacheStorage.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r181815 r181816 1 2015-03-20 Chris Dumez <cdumez@apple.com> 2 3 [WK2] NetworkCache retrievals sometimes fail on browser startup 4 https://bugs.webkit.org/show_bug.cgi?id=142925 5 <rdar://problem/20245368> 6 7 Reviewed by Antti Koivisto. 8 9 NetworkCache retrievals sometimes fail on browser startup for resources 10 that are actually cached. The reason is that we are using a bloom filter 11 for performance reasons to avoid unnecessary disk I/O and this bloom 12 filter is populated on start up in a background thread by traversing the 13 cache files on disk. However, when restoring the tabs on start-up we 14 sometimes query this bloom filter before it is completely populated and 15 we thus fail to retrieve cached entries because we think they don't 16 exist and don't check the disk. 17 18 This patch adds an "isPopulatingContentsFilter" flag that is turned ON 19 on start up while we are populating the bloon filter. We then bypass 20 the bloom filter and send queries directly to disk on start up if this 21 flag is ON. 22 23 * NetworkProcess/cache/NetworkCacheStorage.cpp: 24 (WebKit::NetworkCache::Storage::initialize): 25 (WebKit::NetworkCache::Storage::retrieve): 26 (WebKit::NetworkCache::Storage::dispatchPendingWriteOperations): 27 (WebKit::NetworkCache::Storage::dispatchHeaderWriteOperation): 28 * NetworkProcess/cache/NetworkCacheStorage.h: 29 (WebKit::NetworkCache::Storage::cacheMayContain): 30 1 31 2015-03-20 Chris Dumez <cdumez@apple.com> 2 32 -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp
r181700 r181816 93 93 m_approximateSize += fileSize; 94 94 }); 95 m_hasPopulatedContentsFilter = true; 95 96 }); 96 97 } … … 373 374 } 374 375 375 if (! m_contentsFilter.mayContain(key.shortHash())) {376 if (!cacheMayContain(key.shortHash())) { 376 377 completionHandler(nullptr); 377 378 return; … … 461 462 m_activeWriteOperations.add(WTF::move(writeOperation)); 462 463 463 if (write.existingEntry && m_contentsFilter.mayContain(write.entry.key.shortHash())) {464 if (write.existingEntry && cacheMayContain(write.entry.key.shortHash())) { 464 465 dispatchHeaderWriteOperation(write); 465 466 continue; … … 516 517 ASSERT(write.existingEntry); 517 518 ASSERT(m_activeWriteOperations.contains(&write)); 518 ASSERT( m_contentsFilter.mayContain(write.entry.key.shortHash()));519 ASSERT(cacheMayContain(write.entry.key.shortHash())); 519 520 520 521 // Try to update the header of an existing entry. -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h
r181700 r181816 104 104 WorkQueue& serialBackgroundIOQueue() { return m_serialBackgroundIOQueue.get(); } 105 105 106 bool cacheMayContain(unsigned shortHash) { return !m_hasPopulatedContentsFilter || m_contentsFilter.mayContain(shortHash); } 107 106 108 const String m_baseDirectoryPath; 107 109 const String m_directoryPath; … … 110 112 111 113 BloomFilter<20> m_contentsFilter; 114 std::atomic<bool> m_hasPopulatedContentsFilter { false }; 115 112 116 std::atomic<size_t> m_approximateSize { 0 }; 113 117 std::atomic<bool> m_shrinkInProgress { false };
Note:
See TracChangeset
for help on using the changeset viewer.