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

Unified Diff: net/http/http_cache.cc

Issue 2922973003: RFC: use some in-memory state in SimpleCache to quickly cache-miss some CantConditionalize cases
Patch Set: omewhat better take at higher-level HC::T impl, a bit lessy hacky, and actually write to cache now. 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/http/http_cache.cc
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index 68aee907e43674a7f207f496fa7ac2df8f8ccce9..6b4bd9f42ffb67b6c187aa15eb4e214c1e4ee2d6 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -739,7 +739,8 @@ void HttpCache::DeletePendingOp(PendingOp* pending_op) {
delete pending_op;
}
-int HttpCache::OpenEntry(const std::string& key, ActiveEntry** entry,
+int HttpCache::OpenEntry(const std::string& key,
+ ActiveEntry** entry,
Transaction* trans) {
ActiveEntry* active_entry = FindActiveEntry(key);
if (active_entry) {
@@ -747,6 +748,13 @@ int HttpCache::OpenEntry(const std::string& key, ActiveEntry** entry,
return OK;
}
+ // See if we could potentially quick-reject the entry.
+ uint8_t in_memory_info = disk_cache_->GetMemoryEntryData(key);
+ if (trans->MaybeRejectBasedOnMemoryEntryData(in_memory_info)) {
+ disk_cache_->DoomEntry(key, base::Bind([](int) {}));
+ return net::ERR_CACHE_ENTRY_NOT_SUITABLE;
+ }
+
std::unique_ptr<WorkItem> item =
base::MakeUnique<WorkItem>(WI_OPEN_ENTRY, trans, entry);
PendingOp* pending_op = GetPendingOp(key);

Powered by Google App Engine
This is Rietveld 408576698