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

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

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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') | base/values.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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_argument.h" 5 #include "base/trace_event/trace_event_argument.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 it.Advance()) { 281 it.Advance()) {
282 SetBaseValueWithCopiedName(it.key(), it.value()); 282 SetBaseValueWithCopiedName(it.key(), it.value());
283 } 283 }
284 EndDictionary(); 284 EndDictionary();
285 } break; 285 } break;
286 286
287 case base::Value::TYPE_LIST: { 287 case base::Value::TYPE_LIST: {
288 const ListValue* list_value; 288 const ListValue* list_value;
289 value.GetAsList(&list_value); 289 value.GetAsList(&list_value);
290 BeginArrayWithCopiedName(name); 290 BeginArrayWithCopiedName(name);
291 for (base::Value* base_value : *list_value) 291 for (const base::Value* base_value : *list_value)
dcheng 2016/05/20 19:49:47 Because I changed const_iterator to return a const
292 AppendBaseValue(*base_value); 292 AppendBaseValue(*base_value);
293 EndArray(); 293 EndArray();
294 } break; 294 } break;
295 } 295 }
296 } 296 }
297 297
298 void TracedValue::AppendBaseValue(const base::Value& value) { 298 void TracedValue::AppendBaseValue(const base::Value& value) {
299 DCHECK_CURRENT_CONTAINER_IS(kStackTypeArray); 299 DCHECK_CURRENT_CONTAINER_IS(kStackTypeArray);
300 switch (value.GetType()) { 300 switch (value.GetType()) {
301 case base::Value::TYPE_NULL: 301 case base::Value::TYPE_NULL:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 it.Advance()) { 335 it.Advance()) {
336 SetBaseValueWithCopiedName(it.key(), it.value()); 336 SetBaseValueWithCopiedName(it.key(), it.value());
337 } 337 }
338 EndDictionary(); 338 EndDictionary();
339 } break; 339 } break;
340 340
341 case base::Value::TYPE_LIST: { 341 case base::Value::TYPE_LIST: {
342 const ListValue* list_value; 342 const ListValue* list_value;
343 value.GetAsList(&list_value); 343 value.GetAsList(&list_value);
344 BeginArray(); 344 BeginArray();
345 for (base::Value* base_value : *list_value) 345 for (const base::Value* base_value : *list_value)
346 AppendBaseValue(*base_value); 346 AppendBaseValue(*base_value);
347 EndArray(); 347 EndArray();
348 } break; 348 } break;
349 } 349 }
350 } 350 }
351 351
352 std::unique_ptr<base::Value> TracedValue::ToBaseValue() const { 352 std::unique_ptr<base::Value> TracedValue::ToBaseValue() const {
353 std::unique_ptr<DictionaryValue> root(new DictionaryValue); 353 std::unique_ptr<DictionaryValue> root(new DictionaryValue);
354 DictionaryValue* cur_dict = root.get(); 354 DictionaryValue* cur_dict = root.get();
355 ListValue* cur_list = nullptr; 355 ListValue* cur_list = nullptr;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 TraceEventMemoryOverhead* overhead) { 464 TraceEventMemoryOverhead* overhead) {
465 overhead->Add("TracedValue", 465 overhead->Add("TracedValue",
466 /* allocated size */ 466 /* allocated size */
467 pickle_.GetTotalAllocatedSize(), 467 pickle_.GetTotalAllocatedSize(),
468 /* resident size */ 468 /* resident size */
469 pickle_.size()); 469 pickle_.size());
470 } 470 }
471 471
472 } // namespace trace_event 472 } // namespace trace_event
473 } // namespace base 473 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/values.h » ('j') | base/values.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698