Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1378)

Unified Diff: net/http/mock_http_cache.cc

Issue 181173003: Deactivate cache entry when caching is stopped. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/mock_http_cache.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/mock_http_cache.cc
diff --git a/net/http/mock_http_cache.cc b/net/http/mock_http_cache.cc
index 5dbd486df0ff551c2dd6237e004edfab8d941df0..75c0476244cf72e3dfe726431b969c0f62e339eb 100644
--- a/net/http/mock_http_cache.cc
+++ b/net/http/mock_http_cache.cc
@@ -384,6 +384,25 @@ int MockDiskCache::OpenEntry(const std::string& key, disk_cache::Entry** entry,
return net::ERR_IO_PENDING;
}
+int MockDiskCache::OpenDoomedEntry(const std::string& key,
+ disk_cache::Entry** entry,
+ const net::CompletionCallback& callback) {
+ DCHECK(!callback.is_null());
+
+ EntryMap::iterator it = entries_.find(key);
+ if (it == entries_.end())
+ return net::ERR_CACHE_OPEN_FAILURE;
+ if (!it->second->is_doomed())
+ return net::ERR_CACHE_OPEN_FAILURE;
+
+ it->second->AddRef();
+ *entry = it->second;
+
+ CallbackLater(callback, net::OK);
+
+ return net::ERR_IO_PENDING;
+}
+
int MockDiskCache::CreateEntry(const std::string& key,
disk_cache::Entry** entry,
const net::CompletionCallback& callback) {
@@ -556,6 +575,13 @@ bool MockHttpCache::OpenBackendEntry(const std::string& key,
return (cb.GetResult(rv) == net::OK);
}
+bool MockHttpCache::OpenBackendDoomedEntry(const std::string& key,
+ disk_cache::Entry** entry) {
+ net::TestCompletionCallback cb;
+ int rv = disk_cache()->OpenDoomedEntry(key, entry, cb.callback());
+ return (cb.GetResult(rv) == net::OK);
+}
+
bool MockHttpCache::CreateBackendEntry(const std::string& key,
disk_cache::Entry** entry,
net::NetLog* net_log) {
« no previous file with comments | « net/http/mock_http_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698