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

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

Issue 1398053002: Implement cache counting for the simple and memory backends. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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..382cf4c158582595a391f6c156aeb2662acc3e88 100644
--- a/net/disk_cache/simple/simple_backend_impl.cc
+++ b/net/disk_cache/simple/simple_backend_impl.cc
@@ -470,10 +470,20 @@ int SimpleBackendImpl::DoomEntriesSince(
return DoomEntriesBetween(initial_time, Time(), callback);
}
+void SimpleBackendImpl::IndexReadyForCalculation(
+ const CompletionCallback& callback,
+ int result) {
+ if (result == net::OK)
+ result = static_cast<int>(index_->GetCacheSize());
msramek 2015/10/09 09:32:24 cache_size_, and thus also GetCacheSize(), are uin
pasko 2015/10/09 15:52:03 We do not want to introduce more constraints in th
msramek 2015/10/13 09:45:06 Ah ok, good to know. Still, I'd like to keep the s
+ callback.Run(result);
+}
+
int SimpleBackendImpl::CalculateSizeOfAllEntries(
const CompletionCallback& callback) {
- // TODO(msramek): Implement.
- return net::ERR_NOT_IMPLEMENTED;
+ return index_->ExecuteWhenReady(
+ base::Bind(&SimpleBackendImpl::IndexReadyForCalculation,
+ AsWeakPtr(),
+ callback));
}
class SimpleBackendImpl::SimpleIterator final : public Iterator {

Powered by Google App Engine
This is Rietveld 408576698