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

Unified Diff: net/disk_cache/memory/mem_entry_impl.cc

Issue 2723553002: Keep track of byte usage of the memory cache backend (Closed)
Patch Set: Address comments from PS3 Created 3 years, 10 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/memory/mem_entry_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/memory/mem_entry_impl.cc
diff --git a/net/disk_cache/memory/mem_entry_impl.cc b/net/disk_cache/memory/mem_entry_impl.cc
index cfe23e75cf70066caf36a89ec77b05ded1f5af03..2910bb1afafa1396af0d0d408d8a433afbdefc4b 100644
--- a/net/disk_cache/memory/mem_entry_impl.cc
+++ b/net/disk_cache/memory/mem_entry_impl.cc
@@ -253,6 +253,14 @@ int MemEntryImpl::ReadyForSparseIO(const CompletionCallback& callback) {
return net::OK;
}
+size_t MemEntryImpl::EstimateMemoryUsage() const {
+ // Subtlety: the entries in children_ are not double counted, as the entry
+ // pointers won't be followed by EstimateMemoryUsage.
+ return base::trace_event::EstimateMemoryUsage(data_) +
+ base::trace_event::EstimateMemoryUsage(key_) +
+ base::trace_event::EstimateMemoryUsage(children_);
+}
+
// ------------------------------------------------------------------------
MemEntryImpl::MemEntryImpl(MemBackendImpl* backend,
« no previous file with comments | « net/disk_cache/memory/mem_entry_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698