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

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

Issue 1479473002: base: Use std::move() instead of Pass() for real movable types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: basepass: missing-include Created 5 years 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 | « base/trace_event/trace_config.cc ('k') | 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 <utility>
8
7 #include "base/bits.h" 9 #include "base/bits.h"
8 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
9 #include "base/trace_event/trace_event_memory_overhead.h" 11 #include "base/trace_event/trace_event_memory_overhead.h"
10 #include "base/values.h" 12 #include "base/values.h"
11 13
12 namespace base { 14 namespace base {
13 namespace trace_event { 15 namespace trace_event {
14 16
15 namespace { 17 namespace {
16 const char kTypeStartDict = '{'; 18 const char kTypeStartDict = '{';
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 } else { 434 } else {
433 cur_list->AppendString(value); 435 cur_list->AppendString(value);
434 } 436 }
435 } break; 437 } break;
436 438
437 default: 439 default:
438 NOTREACHED(); 440 NOTREACHED();
439 } 441 }
440 } 442 }
441 DCHECK(stack.empty()); 443 DCHECK(stack.empty());
442 return root.Pass(); 444 return std::move(root);
443 } 445 }
444 446
445 void TracedValue::AppendAsTraceFormat(std::string* out) const { 447 void TracedValue::AppendAsTraceFormat(std::string* out) const {
446 DCHECK_CURRENT_CONTAINER_IS(kStackTypeDict); 448 DCHECK_CURRENT_CONTAINER_IS(kStackTypeDict);
447 DCHECK_CONTAINER_STACK_DEPTH_EQ(1u); 449 DCHECK_CONTAINER_STACK_DEPTH_EQ(1u);
448 450
449 // TODO(primiano): this could be smarter, skip the ToBaseValue encoding and 451 // TODO(primiano): this could be smarter, skip the ToBaseValue encoding and
450 // produce the JSON on its own. This will require refactoring JSONWriter 452 // produce the JSON on its own. This will require refactoring JSONWriter
451 // to decouple the base::Value traversal from the JSON writing bits 453 // to decouple the base::Value traversal from the JSON writing bits
452 std::string tmp; 454 std::string tmp;
453 JSONWriter::Write(*ToBaseValue(), &tmp); 455 JSONWriter::Write(*ToBaseValue(), &tmp);
454 *out += tmp; 456 *out += tmp;
455 } 457 }
456 458
457 void TracedValue::EstimateTraceMemoryOverhead( 459 void TracedValue::EstimateTraceMemoryOverhead(
458 TraceEventMemoryOverhead* overhead) { 460 TraceEventMemoryOverhead* overhead) {
459 const size_t kPickleHeapAlign = 4096; // Must be == Pickle::kPickleHeapAlign. 461 const size_t kPickleHeapAlign = 4096; // Must be == Pickle::kPickleHeapAlign.
460 overhead->Add("TracedValue", 462 overhead->Add("TracedValue",
461 463
462 /* allocated size */ 464 /* allocated size */
463 bits::Align(pickle_.GetTotalAllocatedSize(), kPickleHeapAlign), 465 bits::Align(pickle_.GetTotalAllocatedSize(), kPickleHeapAlign),
464 466
465 /* resident size */ 467 /* resident size */
466 bits::Align(pickle_.size(), kPickleHeapAlign)); 468 bits::Align(pickle_.size(), kPickleHeapAlign));
467 } 469 }
468 470
469 } // namespace trace_event 471 } // namespace trace_event
470 } // namespace base 472 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/trace_config.cc ('k') | base/trace_event/trace_event_argument_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698