| 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/trace_event_memory_overhead.h" | 5 #include "base/trace_event/trace_event_memory_overhead.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bits.h" | 9 #include "base/bits.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 void TraceEventMemoryOverhead::AddValue(const Value& value) { | 70 void TraceEventMemoryOverhead::AddValue(const Value& value) { |
| 71 switch (value.GetType()) { | 71 switch (value.GetType()) { |
| 72 case Value::Type::NONE: | 72 case Value::Type::NONE: |
| 73 case Value::Type::BOOLEAN: | 73 case Value::Type::BOOLEAN: |
| 74 case Value::Type::INTEGER: | 74 case Value::Type::INTEGER: |
| 75 case Value::Type::DOUBLE: | 75 case Value::Type::DOUBLE: |
| 76 Add("FundamentalValue", sizeof(Value)); | 76 Add("FundamentalValue", sizeof(Value)); |
| 77 break; | 77 break; |
| 78 | 78 |
| 79 case Value::Type::STRING: { | 79 case Value::Type::STRING: { |
| 80 const StringValue* string_value = nullptr; | 80 const Value* string_value = nullptr; |
| 81 value.GetAsString(&string_value); | 81 value.GetAsString(&string_value); |
| 82 Add("StringValue", sizeof(StringValue)); | 82 Add("StringValue", sizeof(Value)); |
| 83 AddString(string_value->GetString()); | 83 AddString(string_value->GetString()); |
| 84 } break; | 84 } break; |
| 85 | 85 |
| 86 case Value::Type::BINARY: { | 86 case Value::Type::BINARY: { |
| 87 const BinaryValue* binary_value = nullptr; | 87 const BinaryValue* binary_value = nullptr; |
| 88 value.GetAsBinary(&binary_value); | 88 value.GetAsBinary(&binary_value); |
| 89 Add("BinaryValue", sizeof(BinaryValue) + binary_value->GetSize()); | 89 Add("BinaryValue", sizeof(BinaryValue) + binary_value->GetSize()); |
| 90 } break; | 90 } break; |
| 91 | 91 |
| 92 case Value::Type::DICTIONARY: { | 92 case Value::Type::DICTIONARY: { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 it.second.allocated_size_in_bytes); | 147 it.second.allocated_size_in_bytes); |
| 148 mad->AddScalar("resident_size", MemoryAllocatorDump::kUnitsBytes, | 148 mad->AddScalar("resident_size", MemoryAllocatorDump::kUnitsBytes, |
| 149 it.second.resident_size_in_bytes); | 149 it.second.resident_size_in_bytes); |
| 150 mad->AddScalar(MemoryAllocatorDump::kNameObjectCount, | 150 mad->AddScalar(MemoryAllocatorDump::kNameObjectCount, |
| 151 MemoryAllocatorDump::kUnitsObjects, it.second.count); | 151 MemoryAllocatorDump::kUnitsObjects, it.second.count); |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace trace_event | 155 } // namespace trace_event |
| 156 } // namespace base | 156 } // namespace base |
| OLD | NEW |