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_->level_of_detail() == | |
85 MemoryDumpLevelOfDetail::BACKGROUND) { | |
Primiano Tucci (use gerrit)
2016/05/27 17:23:35
I wonder if we want also a NOTREACHED() here so we
ssid
2016/05/31 22:33:20
Done.
| |
86 return; | |
87 } | |
88 | |
83 attributes_->BeginDictionary(name); | 89 attributes_->BeginDictionary(name); |
84 attributes_->SetString("type", kTypeString); | 90 attributes_->SetString("type", kTypeString); |
85 attributes_->SetString("units", units); | 91 attributes_->SetString("units", units); |
86 attributes_->SetString("value", value); | 92 attributes_->SetString("value", value); |
87 attributes_->EndDictionary(); | 93 attributes_->EndDictionary(); |
88 } | 94 } |
89 | 95 |
90 void MemoryAllocatorDump::AsValueInto(TracedValue* value) const { | 96 void MemoryAllocatorDump::AsValueInto(TracedValue* value) const { |
91 value->BeginDictionaryWithCopiedName(absolute_name_); | 97 value->BeginDictionaryWithCopiedName(absolute_name_); |
92 value->SetString("guid", guid_.ToString()); | 98 value->SetString("guid", guid_.ToString()); |
93 value->SetValue("attrs", *attributes_); | 99 value->SetValue("attrs", *attributes_); |
94 if (flags_) | 100 if (flags_) |
95 value->SetInteger("flags", flags_); | 101 value->SetInteger("flags", flags_); |
96 value->EndDictionary(); // "allocator_name/heap_subheap": { ... } | 102 value->EndDictionary(); // "allocator_name/heap_subheap": { ... } |
97 } | 103 } |
98 | 104 |
99 } // namespace trace_event | 105 } // namespace trace_event |
100 } // namespace base | 106 } // namespace base |
OLD | NEW |