Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: base/trace_event/trace_event_memory_overhead.cc

Issue 2839753005: Remove base::Value::GetAsBinary (Closed)
Patch Set: ASSERT_TRUE Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/values.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 break; 77 break;
78 78
79 case Value::Type::STRING: { 79 case Value::Type::STRING: {
80 const Value* string_value = nullptr; 80 const Value* string_value = nullptr;
81 value.GetAsString(&string_value); 81 value.GetAsString(&string_value);
82 Add("StringValue", sizeof(Value)); 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 Value* binary_value = nullptr; 87 Add("BinaryValue", sizeof(Value) + value.GetBlob().size());
88 value.GetAsBinary(&binary_value);
89 Add("BinaryValue", sizeof(Value) + binary_value->GetBlob().size());
90 } break; 88 } break;
91 89
92 case Value::Type::DICTIONARY: { 90 case Value::Type::DICTIONARY: {
93 const DictionaryValue* dictionary_value = nullptr; 91 const DictionaryValue* dictionary_value = nullptr;
94 value.GetAsDictionary(&dictionary_value); 92 value.GetAsDictionary(&dictionary_value);
95 Add("DictionaryValue", sizeof(DictionaryValue)); 93 Add("DictionaryValue", sizeof(DictionaryValue));
96 for (DictionaryValue::Iterator it(*dictionary_value); !it.IsAtEnd(); 94 for (DictionaryValue::Iterator it(*dictionary_value); !it.IsAtEnd();
97 it.Advance()) { 95 it.Advance()) {
98 AddString(it.key()); 96 AddString(it.key());
99 AddValue(it.value()); 97 AddValue(it.value());
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 it.second.allocated_size_in_bytes); 145 it.second.allocated_size_in_bytes);
148 mad->AddScalar("resident_size", MemoryAllocatorDump::kUnitsBytes, 146 mad->AddScalar("resident_size", MemoryAllocatorDump::kUnitsBytes,
149 it.second.resident_size_in_bytes); 147 it.second.resident_size_in_bytes);
150 mad->AddScalar(MemoryAllocatorDump::kNameObjectCount, 148 mad->AddScalar(MemoryAllocatorDump::kNameObjectCount,
151 MemoryAllocatorDump::kUnitsObjects, it.second.count); 149 MemoryAllocatorDump::kUnitsObjects, it.second.count);
152 } 150 }
153 } 151 }
154 152
155 } // namespace trace_event 153 } // namespace trace_event
156 } // namespace base 154 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/values.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698