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

Unified Diff: base/trace_event/process_memory_dump.cc

Issue 1028333002: Chromium -> Mojo roll. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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_maps.h » ('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 5363db559c32151712dc128e74d44f1933bbec00..bbca36c36528ae8b75397058c01b8269e2bc322c 100644
--- a/base/trace_event/process_memory_dump.cc
+++ b/base/trace_event/process_memory_dump.cc
@@ -17,6 +17,27 @@ ProcessMemoryDump::ProcessMemoryDump()
ProcessMemoryDump::~ProcessMemoryDump() {
}
+MemoryAllocatorDump* ProcessMemoryDump::CreateAllocatorDump(
+ const std::string& name) {
+ return CreateAllocatorDump(name, nullptr);
+}
+
+MemoryAllocatorDump* ProcessMemoryDump::CreateAllocatorDump(
+ const std::string& name,
+ MemoryAllocatorDump* parent) {
+ DCHECK_EQ(0ul, allocator_dumps_.count(name));
+ MemoryAllocatorDump* mad = new MemoryAllocatorDump(name, parent);
+ allocator_dumps_storage_.push_back(mad);
+ allocator_dumps_[name] = mad;
+ return mad;
+}
+
+MemoryAllocatorDump* ProcessMemoryDump::GetAllocatorDump(
+ const std::string& name) const {
+ auto it = allocator_dumps_.find(name);
+ return it == allocator_dumps_.end() ? nullptr : it->second;
+}
+
void ProcessMemoryDump::AsValueInto(TracedValue* value) const {
// Build up the [dumper name] -> [value] dictionary.
if (has_process_totals_) {
@@ -29,6 +50,12 @@ void ProcessMemoryDump::AsValueInto(TracedValue* value) const {
process_mmaps_.AsValueInto(value);
value->EndDictionary();
}
+ if (allocator_dumps_storage_.size() > 0) {
+ value->BeginDictionary("allocators");
+ for (const MemoryAllocatorDump* allocator_dump : allocator_dumps_storage_)
+ allocator_dump->AsValueInto(value);
+ value->EndDictionary();
+ }
}
} // namespace trace_event
« no previous file with comments | « base/trace_event/process_memory_dump.h ('k') | base/trace_event/process_memory_maps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698