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

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

Issue 2004913002: SimpleCache: open with fewer seeks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 7 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/disk_cache/entry_unittest.cc ('k') | net/disk_cache/simple/simple_entry_format.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3c14d3fbf88faec4bcbbad7c80e55cd7e58e0779..4587bf9a3f886e886acf057941bfcda4ea0dcc8e 100644
--- a/net/disk_cache/simple/simple_backend_impl.cc
+++ b/net/disk_cache/simple/simple_backend_impl.cc
@@ -390,14 +390,7 @@ int SimpleBackendImpl::OpenEntry(const std::string& key,
}
scoped_refptr<SimpleEntryImpl> simple_entry =
CreateOrFindActiveEntry(entry_hash, key);
- CompletionCallback backend_callback =
- base::Bind(&SimpleBackendImpl::OnEntryOpenedFromKey,
- AsWeakPtr(),
- key,
- entry,
- simple_entry,
- callback);
- return simple_entry->OpenEntry(entry, backend_callback);
+ return simple_entry->OpenEntry(entry, callback);
}
int SimpleBackendImpl::CreateEntry(const std::string& key,
@@ -713,29 +706,6 @@ void SimpleBackendImpl::OnEntryOpenedFromHash(
}
}
-void SimpleBackendImpl::OnEntryOpenedFromKey(
- const std::string key,
- Entry** entry,
- const scoped_refptr<SimpleEntryImpl>& simple_entry,
- const CompletionCallback& callback,
- int error_code) {
- int final_code = error_code;
- if (final_code == net::OK) {
- bool key_matches = key.compare(simple_entry->key()) == 0;
- if (!key_matches) {
- // TODO(clamy): Add a unit test to check this code path.
- DLOG(WARNING) << "Key mismatch on open.";
- simple_entry->Doom();
- simple_entry->Close();
- final_code = net::ERR_FAILED;
- } else {
- DCHECK_EQ(simple_entry->entry_hash(), simple_util::GetEntryHashKey(key));
- }
- SIMPLE_CACHE_UMA(BOOLEAN, "KeyMatchedOnOpen", cache_type_, key_matches);
- }
- callback.Run(final_code);
-}
-
void SimpleBackendImpl::DoomEntriesComplete(
std::unique_ptr<std::vector<uint64_t>> entry_hashes,
const net::CompletionCallback& callback,
« no previous file with comments | « net/disk_cache/entry_unittest.cc ('k') | net/disk_cache/simple/simple_entry_format.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698