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

Unified Diff: net/disk_cache/simple/simple_backend_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.h ('k') | net/disk_cache/simple/simple_entry_impl.cc » ('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 583d5c27bdc9843cc32c829cf23939925b53b971..fb1f08ee7d9a95ebf610caf02374372ed947abb3 100644
--- a/net/disk_cache/simple/simple_backend_impl.cc
+++ b/net/disk_cache/simple/simple_backend_impl.cc
@@ -13,6 +13,7 @@
#include "net/base/net_errors.h"
#include "net/disk_cache/simple/simple_entry_impl.h"
#include "net/disk_cache/simple/simple_index.h"
+#include "net/disk_cache/simple/simple_synchronous_entry.h"
using base::FilePath;
using base::MessageLoopProxy;
@@ -72,8 +73,8 @@ net::CacheType SimpleBackendImpl::GetCacheType() const {
}
int32 SimpleBackendImpl::GetEntryCount() const {
- NOTIMPLEMENTED();
- return 0;
+ // TODO(pasko): Use directory file count when index is not ready.
+ return index_->GetEntryCount();
}
int SimpleBackendImpl::OpenEntry(const std::string& key,
@@ -95,23 +96,41 @@ int SimpleBackendImpl::DoomEntry(const std::string& key,
}
int SimpleBackendImpl::DoomAllEntries(const CompletionCallback& callback) {
- NOTIMPLEMENTED();
- return net::ERR_FAILED;
+ return DoomEntriesBetween(Time(), Time(), callback);
+}
+
+void SimpleBackendImpl::IndexReadyForDoom(Time initial_time,
+ Time end_time,
+ const CompletionCallback& callback,
+ int result) {
+ if (result != net::OK) {
+ callback.Run(result);
+ return;
+ }
+ scoped_ptr<std::vector<uint64> > key_hashes(
+ index_->RemoveEntriesBetween(initial_time, end_time).release());
+ WorkerPool::PostTask(FROM_HERE,
+ base::Bind(&SimpleSynchronousEntry::DoomEntrySet,
+ base::Passed(&key_hashes),
+ path_,
+ MessageLoopProxy::current(),
+ callback),
+ true);
}
int SimpleBackendImpl::DoomEntriesBetween(
const Time initial_time,
const Time end_time,
const CompletionCallback& callback) {
- NOTIMPLEMENTED();
- return net::ERR_FAILED;
+ return index_->ExecuteWhenReady(
+ base::Bind(&SimpleBackendImpl::IndexReadyForDoom, AsWeakPtr(),
+ initial_time, end_time, callback));
}
int SimpleBackendImpl::DoomEntriesSince(
const Time initial_time,
const CompletionCallback& callback) {
- NOTIMPLEMENTED();
- return net::ERR_FAILED;
+ return DoomEntriesBetween(initial_time, Time(), callback);
}
int SimpleBackendImpl::OpenNextEntry(void** iter,
@@ -131,7 +150,7 @@ void SimpleBackendImpl::GetStats(
}
void SimpleBackendImpl::OnExternalCacheHit(const std::string& key) {
- NOTIMPLEMENTED();
+ index_->UseIfExists(key);
}
void SimpleBackendImpl::InitializeIndex(
« no previous file with comments | « net/disk_cache/simple/simple_backend_impl.h ('k') | net/disk_cache/simple/simple_entry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698