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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 attributes_->BeginDictionary(name); | 73 attributes_->BeginDictionary(name); |
74 attributes_->SetString("type", kTypeScalar); | 74 attributes_->SetString("type", kTypeScalar); |
75 attributes_->SetString("units", units); | 75 attributes_->SetString("units", units); |
76 attributes_->SetDouble("value", value); | 76 attributes_->SetDouble("value", value); |
77 attributes_->EndDictionary(); | 77 attributes_->EndDictionary(); |
78 } | 78 } |
79 | 79 |
80 void MemoryAllocatorDump::AddString(const char* name, | 80 void MemoryAllocatorDump::AddString(const char* name, |
81 const char* units, | 81 const char* units, |
82 const std::string& value) { | 82 const std::string& value) { |
| 83 // String attributes are disabled in background mode. |
| 84 if (process_memory_dump_->dump_args().level_of_detail == |
| 85 MemoryDumpLevelOfDetail::BACKGROUND) { |
| 86 NOTREACHED(); |
| 87 return; |
| 88 } |
| 89 |
83 attributes_->BeginDictionary(name); | 90 attributes_->BeginDictionary(name); |
84 attributes_->SetString("type", kTypeString); | 91 attributes_->SetString("type", kTypeString); |
85 attributes_->SetString("units", units); | 92 attributes_->SetString("units", units); |
86 attributes_->SetString("value", value); | 93 attributes_->SetString("value", value); |
87 attributes_->EndDictionary(); | 94 attributes_->EndDictionary(); |
88 } | 95 } |
89 | 96 |
90 void MemoryAllocatorDump::AsValueInto(TracedValue* value) const { | 97 void MemoryAllocatorDump::AsValueInto(TracedValue* value) const { |
91 value->BeginDictionaryWithCopiedName(absolute_name_); | 98 value->BeginDictionaryWithCopiedName(absolute_name_); |
92 value->SetString("guid", guid_.ToString()); | 99 value->SetString("guid", guid_.ToString()); |
93 value->SetValue("attrs", *attributes_); | 100 value->SetValue("attrs", *attributes_); |
94 if (flags_) | 101 if (flags_) |
95 value->SetInteger("flags", flags_); | 102 value->SetInteger("flags", flags_); |
96 value->EndDictionary(); // "allocator_name/heap_subheap": { ... } | 103 value->EndDictionary(); // "allocator_name/heap_subheap": { ... } |
97 } | 104 } |
98 | 105 |
99 } // namespace trace_event | 106 } // namespace trace_event |
100 } // namespace base | 107 } // namespace base |
OLD | NEW |