| OLD | NEW |
| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 DictionaryValue* cur_dict = root.get(); | 354 DictionaryValue* cur_dict = root.get(); |
| 355 ListValue* cur_list = nullptr; | 355 ListValue* cur_list = nullptr; |
| 356 std::vector<Value*> stack; | 356 std::vector<Value*> stack; |
| 357 PickleIterator it(pickle_); | 357 PickleIterator it(pickle_); |
| 358 const char* type; | 358 const char* type; |
| 359 | 359 |
| 360 while (it.ReadBytes(&type, 1)) { | 360 while (it.ReadBytes(&type, 1)) { |
| 361 DCHECK((cur_dict && !cur_list) || (cur_list && !cur_dict)); | 361 DCHECK((cur_dict && !cur_list) || (cur_list && !cur_dict)); |
| 362 switch (*type) { | 362 switch (*type) { |
| 363 case kTypeStartDict: { | 363 case kTypeStartDict: { |
| 364 auto new_dict = new DictionaryValue(); | 364 auto* new_dict = new DictionaryValue(); |
| 365 if (cur_dict) { | 365 if (cur_dict) { |
| 366 cur_dict->SetWithoutPathExpansion(ReadKeyName(it), | 366 cur_dict->SetWithoutPathExpansion(ReadKeyName(it), |
| 367 WrapUnique(new_dict)); | 367 WrapUnique(new_dict)); |
| 368 stack.push_back(cur_dict); | 368 stack.push_back(cur_dict); |
| 369 cur_dict = new_dict; | 369 cur_dict = new_dict; |
| 370 } else { | 370 } else { |
| 371 cur_list->Append(WrapUnique(new_dict)); | 371 cur_list->Append(WrapUnique(new_dict)); |
| 372 stack.push_back(cur_list); | 372 stack.push_back(cur_list); |
| 373 cur_list = nullptr; | 373 cur_list = nullptr; |
| 374 cur_dict = new_dict; | 374 cur_dict = new_dict; |
| 375 } | 375 } |
| 376 } break; | 376 } break; |
| 377 | 377 |
| 378 case kTypeEndArray: | 378 case kTypeEndArray: |
| 379 case kTypeEndDict: { | 379 case kTypeEndDict: { |
| 380 if (stack.back()->GetAsDictionary(&cur_dict)) { | 380 if (stack.back()->GetAsDictionary(&cur_dict)) { |
| 381 cur_list = nullptr; | 381 cur_list = nullptr; |
| 382 } else if (stack.back()->GetAsList(&cur_list)) { | 382 } else if (stack.back()->GetAsList(&cur_list)) { |
| 383 cur_dict = nullptr; | 383 cur_dict = nullptr; |
| 384 } | 384 } |
| 385 stack.pop_back(); | 385 stack.pop_back(); |
| 386 } break; | 386 } break; |
| 387 | 387 |
| 388 case kTypeStartArray: { | 388 case kTypeStartArray: { |
| 389 auto new_list = new ListValue(); | 389 auto* new_list = new ListValue(); |
| 390 if (cur_dict) { | 390 if (cur_dict) { |
| 391 cur_dict->SetWithoutPathExpansion(ReadKeyName(it), | 391 cur_dict->SetWithoutPathExpansion(ReadKeyName(it), |
| 392 WrapUnique(new_list)); | 392 WrapUnique(new_list)); |
| 393 stack.push_back(cur_dict); | 393 stack.push_back(cur_dict); |
| 394 cur_dict = nullptr; | 394 cur_dict = nullptr; |
| 395 cur_list = new_list; | 395 cur_list = new_list; |
| 396 } else { | 396 } else { |
| 397 cur_list->Append(WrapUnique(new_list)); | 397 cur_list->Append(WrapUnique(new_list)); |
| 398 stack.push_back(cur_list); | 398 stack.push_back(cur_list); |
| 399 cur_list = new_list; | 399 cur_list = new_list; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |