| 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..131494e9856c822468e474647d16b68315363a4c 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::AddAllocatorDump(
|
| + const std::string& name) {
|
| + return AddAllocatorDump(name, nullptr);
|
| +}
|
| +
|
| +MemoryAllocatorDump* ProcessMemoryDump::AddAllocatorDump(
|
| + 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
|
|
|