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

Unified Diff: base/trace_event/process_memory_dump.cc

Issue 1151603004: [tracing] Add support to pre-load and merge ProcessMemoryDump(s). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: petrcermak nits Created 5 years, 7 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/process_memory_dump_unittest.cc » ('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 54fcad6f2319211e7fb4fc1572cd49861571fc4f..853b3d92ea22873bfd4ea90e68db5ee40170e3be 100644
--- a/base/trace_event/process_memory_dump.cc
+++ b/base/trace_event/process_memory_dump.cc
@@ -35,6 +35,23 @@ MemoryAllocatorDump* ProcessMemoryDump::GetAllocatorDump(
return it == allocator_dumps_.end() ? nullptr : it->second;
}
+void ProcessMemoryDump::TakeAllDumpsFrom(ProcessMemoryDump* other) {
+ // We support only merging of MemoryAllocatorDumps. The special process_totals
+ // and mmaps cases are not relevant, let's just prevent clients from doing it.
+ DCHECK(!other->has_process_totals() && !other->has_process_mmaps());
+
+ // Moves the ownership of all MemoryAllocatorDump(s) contained in |other|
+ // into this ProcessMemoryDump.
+ for (MemoryAllocatorDump* mad : other->allocator_dumps_storage_) {
+ // Check that we don't merge duplicates.
+ DCHECK_EQ(0ul, allocator_dumps_.count(mad->absolute_name()));
+ allocator_dumps_storage_.push_back(mad);
+ allocator_dumps_[mad->absolute_name()] = mad;
+ }
+ other->allocator_dumps_storage_.weak_clear();
+ other->allocator_dumps_.clear();
+}
+
void ProcessMemoryDump::AsValueInto(TracedValue* value) const {
// Build up the [dumper name] -> [value] dictionary.
if (has_process_totals_) {
« no previous file with comments | « base/trace_event/process_memory_dump.h ('k') | base/trace_event/process_memory_dump_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698