Index: base/trace_event/process_memory_dump.cc |
diff --git a/base/trace_event/process_memory_dump.cc b/base/trace_event/process_memory_dump.cc |
index 0a7ca6d6153765ef6640147cd64d1ed42985aa8a..626a17aacea594a5379f4958c8ca77eab83f8889 100644 |
--- a/base/trace_event/process_memory_dump.cc |
+++ b/base/trace_event/process_memory_dump.cc |
@@ -145,6 +145,12 @@ MemoryAllocatorDump* ProcessMemoryDump::GetSharedGlobalAllocatorDump( |
return GetAllocatorDump(GetSharedGlobalAllocatorDumpName(guid)); |
} |
+void ProcessMemoryDump::AddHeapDump(const std::string& absolute_name, |
+ scoped_refptr<TracedValue> heap_dump) { |
+ DCHECK_EQ(0ul, heap_dumps_.count(absolute_name)); |
+ heap_dumps_[absolute_name] = heap_dump; |
+} |
+ |
void ProcessMemoryDump::Clear() { |
if (has_process_totals_) { |
process_totals_.Clear(); |
@@ -159,6 +165,7 @@ void ProcessMemoryDump::Clear() { |
allocator_dumps_storage_.clear(); |
allocator_dumps_.clear(); |
allocator_dumps_edges_.clear(); |
+ heap_dumps_.clear(); |
} |
void ProcessMemoryDump::TakeAllDumpsFrom(ProcessMemoryDump* other) { |
@@ -180,6 +187,9 @@ void ProcessMemoryDump::TakeAllDumpsFrom(ProcessMemoryDump* other) { |
other->allocator_dumps_edges_.begin(), |
other->allocator_dumps_edges_.end()); |
other->allocator_dumps_edges_.clear(); |
+ |
+ heap_dumps_.insert(other->heap_dumps_.begin(), other->heap_dumps_.end()); |
+ other->heap_dumps_.clear(); |
} |
void ProcessMemoryDump::AsValueInto(TracedValue* value) const { |
@@ -202,6 +212,13 @@ void ProcessMemoryDump::AsValueInto(TracedValue* value) const { |
value->EndDictionary(); |
} |
+ if (heap_dumps_.size() > 0) { |
+ value->BeginDictionary("heaps"); |
+ for (const auto& name_and_dump : heap_dumps_) |
+ value->SetValueWithCopiedName(name_and_dump.first, *name_and_dump.second); |
+ value->EndDictionary(); // "heaps" |
+ } |
+ |
value->BeginArray("allocators_graph"); |
for (const MemoryAllocatorDumpEdge& edge : allocator_dumps_edges_) { |
value->BeginDictionary(); |