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

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

Issue 1354493003: [tracing] Don't use dot-based path expansion in TracedValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix cc display list tracing Created 5 years, 3 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/trace_event/trace_event_argument_unittest.cc » ('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 (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 "base/bits.h" 7 #include "base/bits.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/trace_event/trace_event_memory_overhead.h" 9 #include "base/trace_event/trace_event_memory_overhead.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 std::vector<Value*> stack; 350 std::vector<Value*> stack;
351 PickleIterator it(pickle_); 351 PickleIterator it(pickle_);
352 const char* type; 352 const char* type;
353 353
354 while (it.ReadBytes(&type, 1)) { 354 while (it.ReadBytes(&type, 1)) {
355 DCHECK((cur_dict && !cur_list) || (cur_list && !cur_dict)); 355 DCHECK((cur_dict && !cur_list) || (cur_list && !cur_dict));
356 switch (*type) { 356 switch (*type) {
357 case kTypeStartDict: { 357 case kTypeStartDict: {
358 auto new_dict = new DictionaryValue(); 358 auto new_dict = new DictionaryValue();
359 if (cur_dict) { 359 if (cur_dict) {
360 cur_dict->Set(ReadKeyName(it), make_scoped_ptr(new_dict)); 360 cur_dict->SetWithoutPathExpansion(ReadKeyName(it),
361 make_scoped_ptr(new_dict));
361 stack.push_back(cur_dict); 362 stack.push_back(cur_dict);
362 cur_dict = new_dict; 363 cur_dict = new_dict;
363 } else { 364 } else {
364 cur_list->Append(make_scoped_ptr(new_dict)); 365 cur_list->Append(make_scoped_ptr(new_dict));
365 stack.push_back(cur_list); 366 stack.push_back(cur_list);
366 cur_list = nullptr; 367 cur_list = nullptr;
367 cur_dict = new_dict; 368 cur_dict = new_dict;
368 } 369 }
369 } break; 370 } break;
370 371
371 case kTypeEndArray: 372 case kTypeEndArray:
372 case kTypeEndDict: { 373 case kTypeEndDict: {
373 if (stack.back()->GetAsDictionary(&cur_dict)) { 374 if (stack.back()->GetAsDictionary(&cur_dict)) {
374 cur_list = nullptr; 375 cur_list = nullptr;
375 } else if (stack.back()->GetAsList(&cur_list)) { 376 } else if (stack.back()->GetAsList(&cur_list)) {
376 cur_dict = nullptr; 377 cur_dict = nullptr;
377 } 378 }
378 stack.pop_back(); 379 stack.pop_back();
379 } break; 380 } break;
380 381
381 case kTypeStartArray: { 382 case kTypeStartArray: {
382 auto new_list = new ListValue(); 383 auto new_list = new ListValue();
383 if (cur_dict) { 384 if (cur_dict) {
384 cur_dict->Set(ReadKeyName(it), make_scoped_ptr(new_list)); 385 cur_dict->SetWithoutPathExpansion(ReadKeyName(it),
386 make_scoped_ptr(new_list));
385 stack.push_back(cur_dict); 387 stack.push_back(cur_dict);
386 cur_dict = nullptr; 388 cur_dict = nullptr;
387 cur_list = new_list; 389 cur_list = new_list;
388 } else { 390 } else {
389 cur_list->Append(make_scoped_ptr(new_list)); 391 cur_list->Append(make_scoped_ptr(new_list));
390 stack.push_back(cur_list); 392 stack.push_back(cur_list);
391 cur_list = new_list; 393 cur_list = new_list;
392 } 394 }
393 } break; 395 } break;
394 396
395 case kTypeBool: { 397 case kTypeBool: {
396 bool value; 398 bool value;
397 CHECK(it.ReadBool(&value)); 399 CHECK(it.ReadBool(&value));
398 if (cur_dict) { 400 if (cur_dict) {
399 cur_dict->SetBoolean(ReadKeyName(it), value); 401 cur_dict->SetBooleanWithoutPathExpansion(ReadKeyName(it), value);
400 } else { 402 } else {
401 cur_list->AppendBoolean(value); 403 cur_list->AppendBoolean(value);
402 } 404 }
403 } break; 405 } break;
404 406
405 case kTypeInt: { 407 case kTypeInt: {
406 int value; 408 int value;
407 CHECK(it.ReadInt(&value)); 409 CHECK(it.ReadInt(&value));
408 if (cur_dict) { 410 if (cur_dict) {
409 cur_dict->SetInteger(ReadKeyName(it), value); 411 cur_dict->SetIntegerWithoutPathExpansion(ReadKeyName(it), value);
410 } else { 412 } else {
411 cur_list->AppendInteger(value); 413 cur_list->AppendInteger(value);
412 } 414 }
413 } break; 415 } break;
414 416
415 case kTypeDouble: { 417 case kTypeDouble: {
416 double value; 418 double value;
417 CHECK(it.ReadDouble(&value)); 419 CHECK(it.ReadDouble(&value));
418 if (cur_dict) { 420 if (cur_dict) {
419 cur_dict->SetDouble(ReadKeyName(it), value); 421 cur_dict->SetDoubleWithoutPathExpansion(ReadKeyName(it), value);
420 } else { 422 } else {
421 cur_list->AppendDouble(value); 423 cur_list->AppendDouble(value);
422 } 424 }
423 } break; 425 } break;
424 426
425 case kTypeString: { 427 case kTypeString: {
426 std::string value; 428 std::string value;
427 CHECK(it.ReadString(&value)); 429 CHECK(it.ReadString(&value));
428 if (cur_dict) { 430 if (cur_dict) {
429 cur_dict->SetString(ReadKeyName(it), value); 431 cur_dict->SetStringWithoutPathExpansion(ReadKeyName(it), value);
430 } else { 432 } else {
431 cur_list->AppendString(value); 433 cur_list->AppendString(value);
432 } 434 }
433 } break; 435 } break;
434 436
435 default: 437 default:
436 NOTREACHED(); 438 NOTREACHED();
437 } 439 }
438 } 440 }
439 DCHECK(stack.empty()); 441 DCHECK(stack.empty());
(...skipping 19 matching lines...) Expand all
459 461
460 /* allocated size */ 462 /* allocated size */
461 bits::Align(pickle_.GetTotalAllocatedSize(), kPickleHeapAlign), 463 bits::Align(pickle_.GetTotalAllocatedSize(), kPickleHeapAlign),
462 464
463 /* resident size */ 465 /* resident size */
464 bits::Align(pickle_.size(), kPickleHeapAlign)); 466 bits::Align(pickle_.size(), kPickleHeapAlign));
465 } 467 }
466 468
467 } // namespace trace_event 469 } // namespace trace_event
468 } // namespace base 470 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/trace_event_argument_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698