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

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: Addressed comments. 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(
gavinp 2015/10/13 15:50:12 Isn't this an ordering violation? See https://goog
msramek 2015/10/13 17:25:50 Yep. I tried to follow IndexReadyForDoom, but that
+ const CompletionCallback& callback,
+ int result) {
+ if (result == net::OK)
+ result = static_cast<int>(index_->GetCacheSize());
+ 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));
gavinp 2015/10/13 15:50:12 Did git cl format not join these lines? Weird...
msramek 2015/10/13 17:25:50 Ehm, I didn't run it.
gavinp 2015/10/14 15:08:06 We're very diligent about that in net/. Generally
msramek 2015/10/14 16:11:58 Acknowledged.
}
class SimpleBackendImpl::SimpleIterator final : public Iterator {

Powered by Google App Engine
This is Rietveld 408576698