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

Unified Diff: base/trace_event/process_memory_dump.cc

Issue 1419633004: [Tracing] Introduce HeapDumpWriter helper class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits Created 5 years, 2 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/process_memory_dump.h ('k') | base/trace_event/trace_event.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « base/trace_event/process_memory_dump.h ('k') | base/trace_event/trace_event.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698