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 f985e58ae89f292cf7c46a6adce8cc296c7d5f88..d1c111eccf0372f7f35338cd6e750bd90dfd048e 100644 |
--- a/net/disk_cache/simple/simple_backend_impl.cc |
+++ b/net/disk_cache/simple/simple_backend_impl.cc |
@@ -442,19 +442,6 @@ int SimpleBackendImpl::DoomAllEntries(const CompletionCallback& callback) { |
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> > removed_key_hashes( |
- index_->GetEntriesBetween(initial_time, end_time).release()); |
- DoomEntries(removed_key_hashes.get(), callback); |
-} |
- |
int SimpleBackendImpl::DoomEntriesBetween( |
const Time initial_time, |
const Time end_time, |
@@ -472,8 +459,8 @@ int SimpleBackendImpl::DoomEntriesSince( |
int SimpleBackendImpl::CalculateSizeOfAllEntries( |
const CompletionCallback& callback) { |
- // TODO(msramek): Implement. |
- return net::ERR_NOT_IMPLEMENTED; |
+ return index_->ExecuteWhenReady(base::Bind( |
+ &SimpleBackendImpl::IndexReadyForSizeCalculation, AsWeakPtr(), callback)); |
} |
class SimpleBackendImpl::SimpleIterator final : public Iterator { |
@@ -570,6 +557,27 @@ void SimpleBackendImpl::InitializeIndex(const CompletionCallback& callback, |
callback.Run(result.net_error); |
} |
+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>> removed_key_hashes( |
+ index_->GetEntriesBetween(initial_time, end_time).release()); |
+ DoomEntries(removed_key_hashes.get(), callback); |
+} |
+ |
+void SimpleBackendImpl::IndexReadyForSizeCalculation( |
+ const CompletionCallback& callback, |
+ int result) { |
+ if (result == net::OK) |
+ result = static_cast<int>(index_->GetCacheSize()); |
+ callback.Run(result); |
+} |
+ |
SimpleBackendImpl::DiskStatResult SimpleBackendImpl::InitCacheStructureOnDisk( |
const base::FilePath& path, |
uint64 suggested_max_size) { |