WKWebSiteDataStore.removeDataOfTypes should wait until disk cache files are actually...
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Jul 2017 07:22:12 +0000 (07:22 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Jul 2017 07:22:12 +0000 (07:22 +0000)
commitb4c4d46143766ee67ed15c615ece3a761b132666
tree0d0327c0f6a36007a6ef07410ceeed02e55271e2
parenta670a3578a8a4c3eaf17ae2c56c0874f469750f0
WKWebSiteDataStore.removeDataOfTypes should wait until disk cache files are actually removed before invoking completion handler
https://bugs.webkit.org/show_bug.cgi?id=174224
<rdar://problem/33067545>

Reviewed by Sam Weinig.

Currently we dispatch file deletion operations to a background queue and call the completion
handler without waiting for the I/O to complete.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::clearDiskCacheEntries):

    Call a new version of NetworkCache::remove() for bulk deletion.
    Note that it is fine to call this with an empty vector.

* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::Cache::remove):

    Bulk deletion with a completion handler.

(WebKit::NetworkCache::Cache::deleteFiles): Added.

    Factor to a helper function.

* NetworkProcess/cache/NetworkCache.h:
* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::Storage::remove):

    Remove files for all the provided keys in a queue and invoke the completion handler in the main thread when done.

* NetworkProcess/cache/NetworkCacheStorage.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219249 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/NetworkProcess.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCache.h
Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.h