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

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

Issue 2779733002: [HttpCache] Store some memcache info to memory dumps for debugging (Closed)
Patch Set: Rebase xunjieli's change Created 3 years, 9 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/simple/simple_backend_impl.h ('k') | net/http/http_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e81877c9017bef6324ef7883b2daa1357ca74456..88d2741e9797f8452efeea09fa1bbd376ed9354b 100644
--- a/net/disk_cache/simple/simple_backend_impl.cc
+++ b/net/disk_cache/simple/simple_backend_impl.cc
@@ -31,6 +31,7 @@
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "base/trace_event/memory_usage_estimator.h"
+#include "base/trace_event/process_memory_dump.h"
#include "net/base/net_errors.h"
#include "net/disk_cache/cache_util.h"
#include "net/disk_cache/simple/simple_entry_format.h"
@@ -560,11 +561,19 @@ void SimpleBackendImpl::OnExternalCacheHit(const std::string& key) {
index_->UseIfExists(simple_util::GetEntryHashKey(key));
}
-size_t SimpleBackendImpl::EstimateMemoryUsage() const {
+size_t SimpleBackendImpl::DumpMemoryStats(
+ base::trace_event::ProcessMemoryDump* pmd,
+ const std::string& parent_absolute_name) const {
+ base::trace_event::MemoryAllocatorDump* dump =
+ pmd->CreateAllocatorDump(parent_absolute_name + "/simple_backend");
+
+ size_t size = base::trace_event::EstimateMemoryUsage(index_) +
+ base::trace_event::EstimateMemoryUsage(active_entries_);
// TODO(xunjieli): crbug.com/669108. Track |entries_pending_doom_| once
// base::Closure is suppported in memory_usage_estimator.h.
- return base::trace_event::EstimateMemoryUsage(index_) +
- base::trace_event::EstimateMemoryUsage(active_entries_);
+ dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes, size);
+ return size;
}
void SimpleBackendImpl::InitializeIndex(const CompletionCallback& callback,
« no previous file with comments | « net/disk_cache/simple/simple_backend_impl.h ('k') | net/http/http_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698