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

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

Issue 14295013: Simple Cache: DoomEntriesBetween() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix an actual bug in DoomEntry Created 7 years, 8 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/simple/simple_backend_impl.cc ('k') | net/disk_cache/simple/simple_index.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/simple/simple_entry_impl.cc
diff --git a/net/disk_cache/simple/simple_entry_impl.cc b/net/disk_cache/simple/simple_entry_impl.cc
index 4fa31adb26e38ed8ede677fab3afc45e69d75a7b..78434496cc8802cfc55d0049d30d02d7424f06b2 100644
--- a/net/disk_cache/simple/simple_entry_impl.cc
+++ b/net/disk_cache/simple/simple_entry_impl.cc
@@ -39,22 +39,22 @@ int SimpleEntryImpl::OpenEntry(SimpleIndex* index,
const std::string& key,
Entry** entry,
const CompletionCallback& callback) {
- // TODO(gavinp): More closely unify the last_used_ in the
- // SimpleSynchronousEntry and the SimpleIndex.
- if (!index || index->UseIfExists(key)) {
- scoped_refptr<SimpleEntryImpl> new_entry =
- new SimpleEntryImpl(index, path, key);
- SynchronousCreationCallback sync_creation_callback =
- base::Bind(&SimpleEntryImpl::CreationOperationComplete,
- new_entry, entry, callback);
- WorkerPool::PostTask(FROM_HERE,
- base::Bind(&SimpleSynchronousEntry::OpenEntry, path,
- key, MessageLoopProxy::current(),
- sync_creation_callback),
- true);
- return net::ERR_IO_PENDING;
- }
- return net::ERR_FAILED;
+ // If entry is not known to the index, initiate fast failover to the network.
+ if (index && !index->Has(key))
+ return net::ERR_FAILED;
+
+ // Go down to the disk to find the entry.
+ scoped_refptr<SimpleEntryImpl> new_entry =
+ new SimpleEntryImpl(index, path, key);
+ SynchronousCreationCallback sync_creation_callback =
+ base::Bind(&SimpleEntryImpl::CreationOperationComplete,
+ new_entry, entry, callback);
+ WorkerPool::PostTask(FROM_HERE,
+ base::Bind(&SimpleSynchronousEntry::OpenEntry, path,
+ key, MessageLoopProxy::current(),
+ sync_creation_callback),
+ true);
+ return net::ERR_IO_PENDING;
}
// static
« no previous file with comments | « net/disk_cache/simple/simple_backend_impl.cc ('k') | net/disk_cache/simple/simple_index.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698