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

Unified Diff: content/child/web_memory_dump_provider_adapter.cc

Issue 1494293005: [Tracing] Enable heap dumps with both type info and backtraces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sfdedup-iter
Patch Set: Address most primiano comments Created 5 years 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: content/child/web_memory_dump_provider_adapter.cc
diff --git a/content/child/web_memory_dump_provider_adapter.cc b/content/child/web_memory_dump_provider_adapter.cc
index d5fbdfbe5011fc1f3f7251bcdd99551f389252f2..865dd2741a736530bc680af5846863179de1a4aa 100644
--- a/content/child/web_memory_dump_provider_adapter.cc
+++ b/content/child/web_memory_dump_provider_adapter.cc
@@ -4,6 +4,7 @@
#include "content/child/web_memory_dump_provider_adapter.h"
+#include "base/containers/hash_tables.h"
#include "base/lazy_instance.h"
#include "base/synchronization/lock.h"
#include "base/trace_event/heap_profiler_allocation_context.h"
@@ -77,19 +78,21 @@ bool WebMemoryDumpProviderAdapter::OnMemoryDump(
if (args.level_of_detail == MemoryDumpLevelOfDetail::DETAILED &&
web_memory_dump_provider_->supportsHeapProfiling() &&
g_heap_profiling_enabled) {
- HeapDumpWriter writer(pmd->session_state()->stack_frame_deduplicator(),
- pmd->session_state()->type_name_deduplicator());
TraceEventMemoryOverhead overhead;
-
+ base::hash_map<AllocationContext, size_t> allocations;
{
AutoLock lock(g_allocation_register_lock.Get());
- for (const auto& alloc_size : *g_allocation_register)
- writer.InsertAllocation(alloc_size.context, alloc_size.size);
+
+ for (const auto& allocation : *g_allocation_register)
+ allocations[allocation.context] += allocation.size;
g_allocation_register->EstimateTraceMemoryOverhead(&overhead);
}
- pmd->AddHeapDump("partition_alloc", writer.WriteHeapDump());
+ auto heap_dump = WriteHeapDump(
+ allocations, pmd->session_state()->stack_frame_deduplicator(),
+ pmd->session_state()->type_name_deduplicator());
+ pmd->AddHeapDump("partition_alloc", heap_dump);
overhead.DumpInto("tracing/heap_profiler", pmd);
}

Powered by Google App Engine
This is Rietveld 408576698