| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 void AddEnabledStateObserver(EnabledStateChangedObserver* listener); | 212 void AddEnabledStateObserver(EnabledStateChangedObserver* listener); |
| 215 void RemoveEnabledStateObserver(EnabledStateChangedObserver* listener); | 213 void RemoveEnabledStateObserver(EnabledStateChangedObserver* listener); |
| 216 | 214 |
| 217 float GetBufferPercentFull() const; | 215 float GetBufferPercentFull() const; |
| 218 | 216 |
| 219 // When enough events are collected, they are handed (in bulk) to | 217 // When enough events are collected, they are handed (in bulk) to |
| 220 // the output callback. If no callback is set, the output will be | 218 // the output callback. If no callback is set, the output will be |
| 221 // silently dropped. The callback must be thread safe. The string format is | 219 // silently dropped. The callback must be thread safe. The string format is |
| 222 // undefined. Use TraceResultBuffer to convert one or more trace strings to | 220 // undefined. Use TraceResultBuffer to convert one or more trace strings to |
| 223 // JSON. | 221 // JSON. |
| 224 typedef RefCountedData<std::string> RefCountedString; | 222 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&)> |
| 225 typedef base::Callback<void(const scoped_refptr<RefCountedString>&)> | |
| 226 OutputCallback; | 223 OutputCallback; |
| 227 void SetOutputCallback(const OutputCallback& cb); | 224 void SetOutputCallback(const OutputCallback& cb); |
| 228 | 225 |
| 229 // The trace buffer does not flush dynamically, so when it fills up, | 226 // The trace buffer does not flush dynamically, so when it fills up, |
| 230 // subsequent trace events will be dropped. This callback is generated when | 227 // subsequent trace events will be dropped. This callback is generated when |
| 231 // the trace buffer is full. The callback must be thread safe. | 228 // the trace buffer is full. The callback must be thread safe. |
| 232 typedef base::Callback<void(void)> BufferFullCallback; | 229 typedef base::Callback<void(void)> BufferFullCallback; |
| 233 void SetBufferFullCallback(const BufferFullCallback& cb); | 230 void SetBufferFullCallback(const BufferFullCallback& cb); |
| 234 | 231 |
| 235 // Flushes all logged data to the callback. | 232 // Flushes all logged data to the callback. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 313 |
| 317 int process_id_; | 314 int process_id_; |
| 318 | 315 |
| 319 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 316 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
| 320 }; | 317 }; |
| 321 | 318 |
| 322 } // namespace debug | 319 } // namespace debug |
| 323 } // namespace base | 320 } // namespace base |
| 324 | 321 |
| 325 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 322 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
| OLD | NEW |