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

Unified Diff: net/disk_cache/memory/mem_backend_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 | « base/trace_event/memory_usage_estimator.h ('k') | net/disk_cache/memory/mem_entry_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/memory/mem_backend_impl.cc
diff --git a/net/disk_cache/memory/mem_backend_impl.cc b/net/disk_cache/memory/mem_backend_impl.cc
index 3aa103b30a02edb0102eead7d15f94a0c91d504f..65e14d71686da03b3c1fd36b58a91024837f4cb1 100644
--- a/net/disk_cache/memory/mem_backend_impl.cc
+++ b/net/disk_cache/memory/mem_backend_impl.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/sys_info.h"
+#include "base/trace_event/memory_usage_estimator.h"
#include "net/base/net_errors.h"
#include "net/disk_cache/cache_util.h"
#include "net/disk_cache/memory/mem_entry_impl.h"
@@ -284,8 +285,10 @@ void MemBackendImpl::OnExternalCacheHit(const std::string& key) {
}
size_t MemBackendImpl::EstimateMemoryUsage() const {
- // TODO(xunjieli): Implement this. crbug.com/669108.
- return 0;
+ // Entries in lru_list_ will be counted by EMU but not in entries_ since
+ // they're pointers.
+ return base::trace_event::EstimateMemoryUsage(lru_list_) +
+ base::trace_event::EstimateMemoryUsage(entries_);
}
void MemBackendImpl::EvictIfNeeded() {
« no previous file with comments | « base/trace_event/memory_usage_estimator.h ('k') | net/disk_cache/memory/mem_entry_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698