Chromium Code Reviews| Index: net/http/http_cache.cc |
| diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc |
| index eaaffe48c1bf538768e39d46bd5505b71f7e0614..8bc0a5407e8e42cb88fb87292a070ade0b249185 100644 |
| --- a/net/http/http_cache.cc |
| +++ b/net/http/http_cache.cc |
| @@ -53,6 +53,12 @@ |
| namespace net { |
| +namespace { |
| + |
| +void DoNothing(int rv) {} |
| + |
| +} // anonymous namespace |
| + |
| HttpCache::DefaultBackend::DefaultBackend( |
| CacheType type, |
| BackendType backend_type, |
| @@ -739,7 +745,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 +754,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->CanRejectBasedOnMemoryEntryData(in_memory_info)) { |
| + disk_cache_->DoomEntry(key, base::Bind(DoNothing)); |
| + return net::ERR_FAILED; |
|
Randy Smith (Not in Mondays)
2017/06/13 17:52:21
Won't this result in failing the consuming HttpCac
Maks Orlovich
2017/06/13 18:15:08
It's the same status a miss on OpenEntry would ret
|
| + } |
| + |
| std::unique_ptr<WorkItem> item = |
| base::MakeUnique<WorkItem>(WI_OPEN_ENTRY, trans, entry); |
| PendingOp* pending_op = GetPendingOp(key); |