Changeset 219249 in webkit
- Timestamp:
- Jul 7, 2017 12:22:12 AM (7 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r219242 r219249 1 2017-07-07 Antti Koivisto <antti@apple.com> 2 3 WKWebSiteDataStore.removeDataOfTypes should wait until disk cache files are actually removed before invoking completion handler 4 https://bugs.webkit.org/show_bug.cgi?id=174224 5 <rdar://problem/33067545> 6 7 Reviewed by Sam Weinig. 8 9 Currently we dispatch file deletion operations to a background queue and call the completion 10 handler without waiting for the I/O to complete. 11 12 * NetworkProcess/NetworkProcess.cpp: 13 (WebKit::clearDiskCacheEntries): 14 15 Call a new version of NetworkCache::remove() for bulk deletion. 16 Note that it is fine to call this with an empty vector. 17 18 * NetworkProcess/cache/NetworkCache.cpp: 19 (WebKit::NetworkCache::Cache::remove): 20 21 Bulk deletion with a completion handler. 22 23 (WebKit::NetworkCache::Cache::deleteFiles): Added. 24 25 Factor to a helper function. 26 27 * NetworkProcess/cache/NetworkCache.h: 28 * NetworkProcess/cache/NetworkCacheStorage.cpp: 29 (WebKit::NetworkCache::Storage::remove): 30 31 Remove files for all the provided keys in a queue and invoke the completion handler in the main thread when done. 32 33 * NetworkProcess/cache/NetworkCacheStorage.h: 34 1 35 2017-07-06 Chris Dumez <cdumez@apple.com> 2 36 -
trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp
r219161 r219249 450 450 } 451 451 452 for (auto& key : cacheKeysToDelete) 453 NetworkCache::singleton().remove(key); 454 455 RunLoop::main().dispatch(WTFMove(completionHandler)); 452 NetworkCache::singleton().remove(cacheKeysToDelete, WTFMove(completionHandler)); 456 453 return; 457 454 }); -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp
r218763 r219249 504 504 { 505 505 remove(makeCacheKey(request)); 506 } 507 508 void Cache::remove(const Vector<Key>& keys, Function<void ()>&& completionHandler) 509 { 510 ASSERT(isEnabled()); 511 512 m_storage->remove(keys, WTFMove(completionHandler)); 506 513 } 507 514 -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.h
r215060 r219249 122 122 void remove(const Key&); 123 123 void remove(const WebCore::ResourceRequest&); 124 void remove(const Vector<Key>&, Function<void ()>&&); 124 125 125 126 void clear(); -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp
r217724 r219249 556 556 557 557 serialBackgroundIOQueue().dispatch([this, key] { 558 WebCore::deleteFile(recordPathForKey(key)); 559 m_blobStorage.remove(blobPathForKey(key)); 560 }); 558 deleteFiles(key); 559 }); 560 } 561 562 void Storage::remove(const Vector<Key>& keys, Function<void ()>&& completionHandler) 563 { 564 ASSERT(RunLoop::isMain()); 565 566 Vector<Key> keysToRemove; 567 keysToRemove.reserveInitialCapacity(keys.size()); 568 569 for (auto& key : keys) { 570 if (!mayContain(key)) 571 continue; 572 removeFromPendingWriteOperations(key); 573 keysToRemove.uncheckedAppend(key); 574 } 575 576 serialBackgroundIOQueue().dispatch([this, keysToRemove = WTFMove(keysToRemove), completionHandler = WTFMove(completionHandler)] () mutable { 577 for (auto& key : keysToRemove) 578 deleteFiles(key); 579 580 if (completionHandler) 581 RunLoop::main().dispatch(WTFMove(completionHandler)); 582 }); 583 } 584 585 void Storage::deleteFiles(const Key& key) 586 { 587 ASSERT(!RunLoop::isMain()); 588 589 WebCore::deleteFile(recordPathForKey(key)); 590 m_blobStorage.remove(blobPathForKey(key)); 561 591 } 562 592 -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h
r215044 r219249 69 69 70 70 void remove(const Key&); 71 void remove(const Vector<Key>&, Function<void ()>&&); 71 72 void clear(const String& type, std::chrono::system_clock::time_point modifiedSinceTime, Function<void ()>&& completionHandler); 72 73 … … 144 145 145 146 void addToRecordFilter(const Key&); 147 void deleteFiles(const Key&); 146 148 147 149 const String m_basePath;
Note: See TracChangeset
for help on using the changeset viewer.