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

Side by Side Diff: base/trace_event/trace_event_impl.h

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/trace_event/trace_event_etw_export_win.cc ('k') | base/trace_event/trace_event_impl.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 5
6 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ 6 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_
7 #define BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ 7 #define BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_
8 8
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory>
11 #include <stack> 12 #include <stack>
12 #include <string> 13 #include <string>
13 #include <vector> 14 #include <vector>
14 15
15 #include "base/atomicops.h" 16 #include "base/atomicops.h"
16 #include "base/base_export.h" 17 #include "base/base_export.h"
17 #include "base/callback.h" 18 #include "base/callback.h"
18 #include "base/containers/hash_tables.h" 19 #include "base/containers/hash_tables.h"
19 #include "base/macros.h" 20 #include "base/macros.h"
20 #include "base/memory/scoped_ptr.h"
21 #include "base/observer_list.h" 21 #include "base/observer_list.h"
22 #include "base/single_thread_task_runner.h" 22 #include "base/single_thread_task_runner.h"
23 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
24 #include "base/synchronization/condition_variable.h" 24 #include "base/synchronization/condition_variable.h"
25 #include "base/synchronization/lock.h" 25 #include "base/synchronization/lock.h"
26 #include "base/threading/thread.h" 26 #include "base/threading/thread.h"
27 #include "base/threading/thread_local.h" 27 #include "base/threading/thread_local.h"
28 #include "base/trace_event/trace_event_memory_overhead.h" 28 #include "base/trace_event/trace_event_memory_overhead.h"
29 #include "build/build_config.h" 29 #include "build/build_config.h"
30 30
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 unsigned long long as_uint; 85 unsigned long long as_uint;
86 long long as_int; 86 long long as_int;
87 double as_double; 87 double as_double;
88 const void* as_pointer; 88 const void* as_pointer;
89 const char* as_string; 89 const char* as_string;
90 }; 90 };
91 91
92 TraceEvent(); 92 TraceEvent();
93 ~TraceEvent(); 93 ~TraceEvent();
94 94
95 void MoveFrom(scoped_ptr<TraceEvent> other); 95 void MoveFrom(std::unique_ptr<TraceEvent> other);
96 96
97 void Initialize(int thread_id, 97 void Initialize(int thread_id,
98 TimeTicks timestamp, 98 TimeTicks timestamp,
99 ThreadTicks thread_timestamp, 99 ThreadTicks thread_timestamp,
100 char phase, 100 char phase,
101 const unsigned char* category_group_enabled, 101 const unsigned char* category_group_enabled,
102 const char* name, 102 const char* name,
103 const char* scope, 103 const char* scope,
104 unsigned long long id, 104 unsigned long long id,
105 unsigned long long bind_id, 105 unsigned long long bind_id,
106 int num_args, 106 int num_args,
107 const char** arg_names, 107 const char** arg_names,
108 const unsigned char* arg_types, 108 const unsigned char* arg_types,
109 const unsigned long long* arg_values, 109 const unsigned long long* arg_values,
110 scoped_ptr<ConvertableToTraceFormat>* convertable_values, 110 std::unique_ptr<ConvertableToTraceFormat>* convertable_values,
111 unsigned int flags); 111 unsigned int flags);
112 112
113 void Reset(); 113 void Reset();
114 114
115 void UpdateDuration(const TimeTicks& now, const ThreadTicks& thread_now); 115 void UpdateDuration(const TimeTicks& now, const ThreadTicks& thread_now);
116 116
117 void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead); 117 void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead);
118 118
119 // Serialize event data to JSON 119 // Serialize event data to JSON
120 void AppendAsJSON( 120 void AppendAsJSON(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Note: these are ordered by size (largest first) for optimal packing. 156 // Note: these are ordered by size (largest first) for optimal packing.
157 TimeTicks timestamp_; 157 TimeTicks timestamp_;
158 ThreadTicks thread_timestamp_; 158 ThreadTicks thread_timestamp_;
159 TimeDelta duration_; 159 TimeDelta duration_;
160 TimeDelta thread_duration_; 160 TimeDelta thread_duration_;
161 // scope_ and id_ can be used to store phase-specific data. 161 // scope_ and id_ can be used to store phase-specific data.
162 const char* scope_; 162 const char* scope_;
163 unsigned long long id_; 163 unsigned long long id_;
164 TraceValue arg_values_[kTraceMaxNumArgs]; 164 TraceValue arg_values_[kTraceMaxNumArgs];
165 const char* arg_names_[kTraceMaxNumArgs]; 165 const char* arg_names_[kTraceMaxNumArgs];
166 scoped_ptr<ConvertableToTraceFormat> convertable_values_[kTraceMaxNumArgs]; 166 std::unique_ptr<ConvertableToTraceFormat>
167 convertable_values_[kTraceMaxNumArgs];
167 const unsigned char* category_group_enabled_; 168 const unsigned char* category_group_enabled_;
168 const char* name_; 169 const char* name_;
169 scoped_ptr<std::string> parameter_copy_storage_; 170 std::unique_ptr<std::string> parameter_copy_storage_;
170 // Depending on TRACE_EVENT_FLAG_HAS_PROCESS_ID the event will have either: 171 // Depending on TRACE_EVENT_FLAG_HAS_PROCESS_ID the event will have either:
171 // tid: thread_id_, pid: current_process_id (default case). 172 // tid: thread_id_, pid: current_process_id (default case).
172 // tid: -1, pid: process_id_ (when flags_ & TRACE_EVENT_FLAG_HAS_PROCESS_ID). 173 // tid: -1, pid: process_id_ (when flags_ & TRACE_EVENT_FLAG_HAS_PROCESS_ID).
173 union { 174 union {
174 int thread_id_; 175 int thread_id_;
175 int process_id_; 176 int process_id_;
176 }; 177 };
177 unsigned int flags_; 178 unsigned int flags_;
178 unsigned long long bind_id_; 179 unsigned long long bind_id_;
179 unsigned char arg_types_[kTraceMaxNumArgs]; 180 unsigned char arg_types_[kTraceMaxNumArgs];
180 char phase_; 181 char phase_;
181 182
182 DISALLOW_COPY_AND_ASSIGN(TraceEvent); 183 DISALLOW_COPY_AND_ASSIGN(TraceEvent);
183 }; 184 };
184 185
185 } // namespace trace_event 186 } // namespace trace_event
186 } // namespace base 187 } // namespace base
187 188
188 #endif // BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ 189 #endif // BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_
OLDNEW
« no previous file with comments | « base/trace_event/trace_event_etw_export_win.cc ('k') | base/trace_event/trace_event_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698