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

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

Issue 1401923006: Reland of Implement cache counting for the simple and memory backends - with fixed test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment about APP_CACHE. Created 5 years, 2 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_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_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) {
« no previous file with comments | « net/disk_cache/simple/simple_backend_impl.h ('k') | net/disk_cache/simple/simple_index.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698