OLD | NEW |
---|---|
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_DEBUG_TRACE_EVENT_IMPL_H_ | 6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
8 #pragma once | 8 #pragma once |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 24 matching lines...) Expand all Loading... | |
35 #define TRACE_EVENT_INSTANT_ETW(name, id, extra) \ | 35 #define TRACE_EVENT_INSTANT_ETW(name, id, extra) \ |
36 base::debug::TraceLog::AddTraceEventEtw( \ | 36 base::debug::TraceLog::AddTraceEventEtw( \ |
37 TRACE_EVENT_PHASE_INSTANT, \ | 37 TRACE_EVENT_PHASE_INSTANT, \ |
38 name, reinterpret_cast<const void*>(id), extra) | 38 name, reinterpret_cast<const void*>(id), extra) |
39 | 39 |
40 template <typename Type> | 40 template <typename Type> |
41 struct StaticMemorySingletonTraits; | 41 struct StaticMemorySingletonTraits; |
42 | 42 |
43 namespace base { | 43 namespace base { |
44 | 44 |
45 class RefCountedString; | |
46 | |
47 namespace debug { | 45 namespace debug { |
48 | 46 |
49 const int kTraceMaxNumArgs = 2; | 47 const int kTraceMaxNumArgs = 2; |
50 | 48 |
51 // Output records are "Events" and can be obtained via the | 49 // Output records are "Events" and can be obtained via the |
52 // OutputCallback whenever the tracing system decides to flush. This | 50 // OutputCallback whenever the tracing system decides to flush. This |
53 // can happen at any time, on any thread, or you can programatically | 51 // can happen at any time, on any thread, or you can programatically |
54 // force it to happen. | 52 // force it to happen. |
55 class BASE_EXPORT TraceEvent { | 53 class BASE_EXPORT TraceEvent { |
56 public: | 54 public: |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 void SetEnabled(bool enabled); | 193 void SetEnabled(bool enabled); |
196 bool IsEnabled() { return enabled_; } | 194 bool IsEnabled() { return enabled_; } |
197 | 195 |
198 float GetBufferPercentFull() const; | 196 float GetBufferPercentFull() const; |
199 | 197 |
200 // When enough events are collected, they are handed (in bulk) to | 198 // When enough events are collected, they are handed (in bulk) to |
201 // the output callback. If no callback is set, the output will be | 199 // the output callback. If no callback is set, the output will be |
202 // silently dropped. The callback must be thread safe. The string format is | 200 // silently dropped. The callback must be thread safe. The string format is |
203 // undefined. Use TraceResultBuffer to convert one or more trace strings to | 201 // undefined. Use TraceResultBuffer to convert one or more trace strings to |
204 // JSON. | 202 // JSON. |
205 typedef RefCountedData<std::string> RefCountedString; | 203 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&)> |
Iain Merrick
2012/02/08 12:07:05
Previously we were converting from RefCountedData
joth
2012/02/08 13:22:20
Should be fine. This sounds a good change.
| |
206 typedef base::Callback<void(const scoped_refptr<RefCountedString>&)> | |
207 OutputCallback; | 204 OutputCallback; |
208 void SetOutputCallback(const OutputCallback& cb); | 205 void SetOutputCallback(const OutputCallback& cb); |
209 | 206 |
210 // The trace buffer does not flush dynamically, so when it fills up, | 207 // The trace buffer does not flush dynamically, so when it fills up, |
211 // subsequent trace events will be dropped. This callback is generated when | 208 // subsequent trace events will be dropped. This callback is generated when |
212 // the trace buffer is full. The callback must be thread safe. | 209 // the trace buffer is full. The callback must be thread safe. |
213 typedef base::Callback<void(void)> BufferFullCallback; | 210 typedef base::Callback<void(void)> BufferFullCallback; |
214 void SetBufferFullCallback(const BufferFullCallback& cb); | 211 void SetBufferFullCallback(const BufferFullCallback& cb); |
215 | 212 |
216 // Flushes all logged data to the callback. | 213 // Flushes all logged data to the callback. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
295 | 292 |
296 int process_id_; | 293 int process_id_; |
297 | 294 |
298 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 295 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
299 }; | 296 }; |
300 | 297 |
301 } // namespace debug | 298 } // namespace debug |
302 } // namespace base | 299 } // namespace base |
303 | 300 |
304 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 301 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
OLD | NEW |