Changeset 181775 in webkit
- Timestamp:
- Mar 19, 2015 6:37:14 PM (9 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r181770 r181775 1 2015-03-19 Anders Carlsson <andersca@apple.com> 2 3 Add support for deleting individual cache entries 4 https://bugs.webkit.org/show_bug.cgi?id=142886 5 6 Reviewed by Antti Koivisto. 7 8 * NetworkProcess/NetworkProcess.cpp: 9 (WebKit::fetchDiskCacheEntries): 10 Remove an unnecessary call to cfURLCacheOrigins(). 11 12 (WebKit::clearDiskCacheEntries): 13 Helper function for clearing disk cache entries. This handles both the old and new cache implementations. 14 15 (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): 16 Call clearDiskCacheEntries if needed. 17 1 18 2015-03-19 Jer Noble <jer.noble@apple.com> 2 19 -
trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp
r181711 r181775 298 298 299 299 #if USE(CFURLCACHE) 300 auto origins = cfURLCacheOrigins();301 300 for (auto& origin : cfURLCacheOrigins()) 302 301 entries.append(WebsiteData::Entry { WTF::move(origin), WebsiteDataTypeDiskCache }); … … 367 366 } 368 367 368 static void clearDiskCacheEntries(const Vector<SecurityOriginData>& origins, std::function<void ()> completionHandler) 369 { 370 #if ENABLE(NETWORK_CACHE) 371 if (NetworkCache::singleton().isEnabled()) { 372 auto* originsToDelete = new HashSet<RefPtr<SecurityOrigin>>(); 373 374 for (auto& origin : origins) 375 originsToDelete->add(origin.securityOrigin()); 376 377 auto* cacheKeysToDelete = new Vector<NetworkCache::Key>; 378 379 NetworkCache::singleton().traverse([completionHandler, originsToDelete, cacheKeysToDelete](const NetworkCache::Entry *entry) { 380 381 if (entry) { 382 if (originsToDelete->contains(SecurityOrigin::create(entry->response.url()))) 383 cacheKeysToDelete->append(entry->storageEntry.key); 384 return; 385 } 386 387 delete originsToDelete; 388 389 for (auto& key : *cacheKeysToDelete) 390 NetworkCache::singleton().remove(key); 391 392 delete cacheKeysToDelete; 393 394 RunLoop::main().dispatch(completionHandler); 395 return; 396 }); 397 398 return; 399 } 400 #endif 401 402 #if USE(CFURLCACHE) 403 auto hostNames = adoptCF(CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks)); 404 for (auto& origin : origins) 405 CFArrayAppendValue(hostNames.get(), origin.host.createCFString().get()); 406 407 CFShow(hostNames.get()); 408 WebResourceCacheManager::clearCFURLCacheForHostNames(hostNames.get()); 409 #endif 410 411 RunLoop::main().dispatch(WTF::move(completionHandler)); 412 } 413 369 414 void NetworkProcess::deleteWebsiteDataForOrigins(SessionID sessionID, uint64_t websiteDataTypes, const Vector<SecurityOriginData>& origins, const Vector<String>& cookieHostNames, uint64_t callbackID) 370 415 { … … 380 425 }; 381 426 427 if ((websiteDataTypes & WebsiteDataTypeDiskCache) && !sessionID.isEphemeral()) { 428 clearDiskCacheEntries(origins, WTF::move(completionHandler)); 429 return; 430 } 431 382 432 completionHandler(); 383 433 }
Note: See TracChangeset
for help on using the changeset viewer.