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

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

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 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 | « base/timer/timer_unittest.cc ('k') | base/trace_event/blame_context_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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/blame_context.h" 5 #include "base/trace_event/blame_context.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "base/trace_event/trace_event_argument.h" 9 #include "base/trace_event/trace_event_argument.h"
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 TRACE_EVENT_API_ADD_TRACE_EVENT(TRACE_EVENT_PHASE_LEAVE_CONTEXT, 50 TRACE_EVENT_API_ADD_TRACE_EVENT(TRACE_EVENT_PHASE_LEAVE_CONTEXT,
51 category_group_enabled_, name_, scope_, id_, 51 category_group_enabled_, name_, scope_, id_,
52 0 /* num_args */, nullptr, nullptr, nullptr, 52 0 /* num_args */, nullptr, nullptr, nullptr,
53 nullptr, TRACE_EVENT_FLAG_HAS_ID); 53 nullptr, TRACE_EVENT_FLAG_HAS_ID);
54 } 54 }
55 55
56 void BlameContext::TakeSnapshot() { 56 void BlameContext::TakeSnapshot() {
57 DCHECK(WasInitialized()); 57 DCHECK(WasInitialized());
58 if (!*category_group_enabled_) 58 if (!*category_group_enabled_)
59 return; 59 return;
60 scoped_ptr<trace_event::TracedValue> snapshot(new trace_event::TracedValue); 60 std::unique_ptr<trace_event::TracedValue> snapshot(
61 new trace_event::TracedValue);
61 AsValueInto(snapshot.get()); 62 AsValueInto(snapshot.get());
62 static const char* kArgName = "snapshot"; 63 static const char* kArgName = "snapshot";
63 const int kNumArgs = 1; 64 const int kNumArgs = 1;
64 unsigned char arg_types[1] = {TRACE_VALUE_TYPE_CONVERTABLE}; 65 unsigned char arg_types[1] = {TRACE_VALUE_TYPE_CONVERTABLE};
65 scoped_ptr<trace_event::ConvertableToTraceFormat> arg_values[1] = { 66 std::unique_ptr<trace_event::ConvertableToTraceFormat> arg_values[1] = {
66 std::move(snapshot)}; 67 std::move(snapshot)};
67 TRACE_EVENT_API_ADD_TRACE_EVENT(TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, 68 TRACE_EVENT_API_ADD_TRACE_EVENT(TRACE_EVENT_PHASE_SNAPSHOT_OBJECT,
68 category_group_enabled_, type_, scope_, id_, 69 category_group_enabled_, type_, scope_, id_,
69 kNumArgs, &kArgName, arg_types, nullptr, 70 kNumArgs, &kArgName, arg_types, nullptr,
70 arg_values, TRACE_EVENT_FLAG_HAS_ID); 71 arg_values, TRACE_EVENT_FLAG_HAS_ID);
71 } 72 }
72 73
73 void BlameContext::OnTraceLogEnabled() { 74 void BlameContext::OnTraceLogEnabled() {
74 DCHECK(WasInitialized()); 75 DCHECK(WasInitialized());
75 TakeSnapshot(); 76 TakeSnapshot();
(...skipping 20 matching lines...) Expand all
96 trace_event::TraceLog::GetInstance()->AddEnabledStateObserver(this); 97 trace_event::TraceLog::GetInstance()->AddEnabledStateObserver(this);
97 TakeSnapshot(); 98 TakeSnapshot();
98 } 99 }
99 100
100 bool BlameContext::WasInitialized() const { 101 bool BlameContext::WasInitialized() const {
101 return category_group_enabled_ != nullptr; 102 return category_group_enabled_ != nullptr;
102 } 103 }
103 104
104 } // namespace trace_event 105 } // namespace trace_event
105 } // namespace base 106 } // namespace base
OLDNEW
« no previous file with comments | « base/timer/timer_unittest.cc ('k') | base/trace_event/blame_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698