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 8b8bef4ca48e8a918fea0d6d0e2eda28b3eee16a..50fed3e908edb95eeb270ee60f2c604f5c22ebfa 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; |
@@ -71,8 +72,7 @@ net::CacheType SimpleBackendImpl::GetCacheType() const { |
} |
int32 SimpleBackendImpl::GetEntryCount() const { |
- NOTIMPLEMENTED(); |
- return 0; |
+ return index_->GetEntryCount(); |
gavinp
2013/04/17 07:41:18
Nice. Can we perhaps do better still though: isn't
felipeg
2013/04/17 16:35:04
In another CL, not this one, please.
Also, I coul
pasko-google - do not use
2013/04/17 19:47:52
This should work pretty fast:
DirReaderPosix reade
|
} |
int SimpleBackendImpl::OpenEntry(const std::string& key, |
@@ -95,23 +95,42 @@ 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(const Time initial_time, |
+ const Time end_time, |
+ const CompletionCallback& callback, |
+ int result) { |
+ if (result != net::OK) { |
+ callback.Run(result); |
+ return; |
+ } |
+ scoped_ptr<std::set<uint64> > key_hashes( |
+ index_->PullEntriesBetween(initial_time, end_time)); |
+ // TODO(pasko): Doom all entries that are known to be open at the moment. |
+ 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); |
gavinp
2013/04/17 07:41:18
Nice!
|
} |
void SimpleBackendImpl::InitializeIndex( |