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

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

Issue 2661333002: Track SimpleCache memory usage in net/ MemoryDumpProvider (Closed)
Patch Set: address comments 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
Index: net/disk_cache/simple/simple_index.cc
diff --git a/net/disk_cache/simple/simple_index.cc b/net/disk_cache/simple/simple_index.cc
index a654faf37182e5287f715c87cce96efc9bc37045..57f9603a391e44c99c99192b7e28a54f5878ba8c 100644
--- a/net/disk_cache/simple/simple_index.cc
+++ b/net/disk_cache/simple/simple_index.cc
@@ -23,6 +23,7 @@
#include "base/task_runner.h"
#include "base/threading/worker_pool.h"
#include "base/time/time.h"
+#include "base/trace_event/memory_usage_estimator.h"
#include "net/base/net_errors.h"
#include "net/disk_cache/simple/simple_entry_format.h"
#include "net/disk_cache/simple/simple_histogram_macros.h"
@@ -268,6 +269,11 @@ uint64_t SimpleIndex::GetCacheSizeBetween(base::Time initial_time,
return size;
}
+size_t SimpleIndex::EstimateMemoryUsage() const {
+ return base::trace_event::EstimateMemoryUsage(entries_set_) +
+ base::trace_event::EstimateMemoryUsage(removed_entries_);
+}
+
void SimpleIndex::Insert(uint64_t entry_hash) {
DCHECK(io_thread_checker_.CalledOnValidThread());
// Upon insert we don't know yet the size of the entry.

Powered by Google App Engine
This is Rietveld 408576698