OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/trace_event/memory_allocator_dump.h" | 5 #include "base/trace_event/memory_allocator_dump.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/trace_event/memory_dump_manager.h" | 9 #include "base/trace_event/memory_dump_manager.h" |
10 #include "base/trace_event/memory_dump_provider.h" | 10 #include "base/trace_event/memory_dump_provider.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 attributes_->SetDouble("value", value); | 79 attributes_->SetDouble("value", value); |
80 attributes_->EndDictionary(); | 80 attributes_->EndDictionary(); |
81 } | 81 } |
82 | 82 |
83 void MemoryAllocatorDump::AddString(const char* name, | 83 void MemoryAllocatorDump::AddString(const char* name, |
84 const char* units, | 84 const char* units, |
85 const std::string& value) { | 85 const std::string& value) { |
86 // String attributes are disabled in background mode. | 86 // String attributes are disabled in background mode. |
87 if (process_memory_dump_->dump_args().level_of_detail == | 87 if (process_memory_dump_->dump_args().level_of_detail == |
88 MemoryDumpLevelOfDetail::BACKGROUND) { | 88 MemoryDumpLevelOfDetail::BACKGROUND) { |
89 NOTREACHED(); | |
90 return; | 89 return; |
91 } | 90 } |
92 | 91 |
93 attributes_->BeginDictionary(name); | 92 attributes_->BeginDictionary(name); |
94 attributes_->SetString("type", kTypeString); | 93 attributes_->SetString("type", kTypeString); |
95 attributes_->SetString("units", units); | 94 attributes_->SetString("units", units); |
96 attributes_->SetString("value", value); | 95 attributes_->SetString("value", value); |
97 attributes_->EndDictionary(); | 96 attributes_->EndDictionary(); |
98 } | 97 } |
99 | 98 |
100 void MemoryAllocatorDump::AsValueInto(TracedValue* value) const { | 99 void MemoryAllocatorDump::AsValueInto(TracedValue* value) const { |
101 value->BeginDictionaryWithCopiedName(absolute_name_); | 100 value->BeginDictionaryWithCopiedName(absolute_name_); |
102 value->SetString("guid", guid_.ToString()); | 101 value->SetString("guid", guid_.ToString()); |
103 value->SetValue("attrs", *attributes_); | 102 value->SetValue("attrs", *attributes_); |
104 if (flags_) | 103 if (flags_) |
105 value->SetInteger("flags", flags_); | 104 value->SetInteger("flags", flags_); |
106 value->EndDictionary(); // "allocator_name/heap_subheap": { ... } | 105 value->EndDictionary(); // "allocator_name/heap_subheap": { ... } |
107 } | 106 } |
108 | 107 |
109 } // namespace trace_event | 108 } // namespace trace_event |
110 } // namespace base | 109 } // namespace base |
OLD | NEW |