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

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: Fix test 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
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..7888a8f70238222dfb1c493b051f860ccd63d546 100644
--- a/base/trace_event/process_memory_dump.cc
+++ b/base/trace_event/process_memory_dump.cc
@@ -35,6 +35,24 @@ 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 case are not relevant, let's just prevent clients to accidentally
petrcermak 2015/05/21 08:17:37 s/case/cases/, s/to/from/
Primiano Tucci (use gerrit) 2015/05/21 08:33:46 Done.
+ // try doing that.
petrcermak 2015/05/21 08:17:38 "try" doesn't belong here (it would have to be "tr
Primiano Tucci (use gerrit) 2015/05/21 08:33:46 Reworded as "trying from doing it" (and I saved on
+ DCHECK(!other->has_process_totals() && !other->has_process_mmaps());
+
+ // Moves the ownership of all the MemoryAllocatorDump(s) contained in |other|
petrcermak 2015/05/21 08:17:37 nit: I don't think you need "the" in front of "Mem
Primiano Tucci (use gerrit) 2015/05/21 08:33:46 Done.
+ // 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_) {

Powered by Google App Engine
This is Rietveld 408576698