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

Unified Diff: net/disk_cache/simple/simple_backend_impl.cc

Issue 2922973003: RFC: use some in-memory state in SimpleCache to quickly cache-miss some CantConditionalize cases
Patch Set: - Implement support for oracle bytes in MockHttpCache, so the code actually gets exercised in tests… Created 3 years, 6 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
Index: net/disk_cache/simple/simple_backend_impl.cc
diff --git a/net/disk_cache/simple/simple_backend_impl.cc b/net/disk_cache/simple/simple_backend_impl.cc
index 88d2741e9797f8452efeea09fa1bbd376ed9354b..f9e5ffbd4bfbd9272c1550015011315808de1e3e 100644
--- a/net/disk_cache/simple/simple_backend_impl.cc
+++ b/net/disk_cache/simple/simple_backend_impl.cc
@@ -384,6 +384,14 @@ int32_t SimpleBackendImpl::GetEntryCount() const {
int SimpleBackendImpl::OpenEntry(const std::string& key,
Entry** entry,
const CompletionCallback& callback) {
+ return OpenEntryWithOracleByte(key, entry, OracleCallback(), callback);
+}
+
+int SimpleBackendImpl::OpenEntryWithOracleByte(
+ const std::string& key,
+ Entry** entry,
+ const OracleCallback& oracle,
+ const CompletionCallback& callback) {
const uint64_t entry_hash = simple_util::GetEntryHashKey(key);
// TODO(gavinp): Factor out this (not quite completely) repetitive code
@@ -400,7 +408,7 @@ int SimpleBackendImpl::OpenEntry(const std::string& key,
}
scoped_refptr<SimpleEntryImpl> simple_entry =
CreateOrFindActiveEntry(entry_hash, key);
- return simple_entry->OpenEntry(entry, callback);
+ return simple_entry->OpenEntry(entry, oracle, callback);
}
int SimpleBackendImpl::CreateEntry(const std::string& key,
@@ -700,7 +708,7 @@ int SimpleBackendImpl::OpenEntryFromHash(uint64_t entry_hash,
CompletionCallback backend_callback =
base::Bind(&SimpleBackendImpl::OnEntryOpenedFromHash,
AsWeakPtr(), entry_hash, entry, simple_entry, callback);
- return simple_entry->OpenEntry(entry, backend_callback);
+ return simple_entry->OpenEntry(entry, OracleCallback(), backend_callback);
}
int SimpleBackendImpl::DoomEntryFromHash(uint64_t entry_hash,
@@ -757,7 +765,7 @@ void SimpleBackendImpl::OnEntryOpenedFromHash(
// finish. The entry created from hash needs to be closed, and the one
// in |active_entries_| can be returned to the caller.
simple_entry->Close();
- it->second->OpenEntry(entry, callback);
+ it->second->OpenEntry(entry, OracleCallback(), callback);
}
}

Powered by Google App Engine
This is Rietveld 408576698