Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef BASE_TRACE_EVENT_TRACE_LOG_H_ | 5 #ifndef BASE_TRACE_EVENT_TRACE_LOG_H_ |
| 6 #define BASE_TRACE_EVENT_TRACE_LOG_H_ | 6 #define BASE_TRACE_EVENT_TRACE_LOG_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 TraceLogStatus(); | 40 TraceLogStatus(); |
| 41 ~TraceLogStatus(); | 41 ~TraceLogStatus(); |
| 42 size_t event_capacity; | 42 size_t event_capacity; |
| 43 size_t event_count; | 43 size_t event_count; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 class BASE_EXPORT TraceLog : public MemoryDumpProvider { | 46 class BASE_EXPORT TraceLog : public MemoryDumpProvider { |
| 47 public: | 47 public: |
| 48 enum Mode { | 48 enum Mode { |
| 49 DISABLED = 0, | 49 DISABLED = 0, |
| 50 RECORDING_MODE, | 50 RECORDING_MODE |
| 51 MONITORING_MODE, | |
| 52 }; | 51 }; |
| 53 | 52 |
| 54 // The pointer returned from GetCategoryGroupEnabledInternal() points to a | 53 // The pointer returned from GetCategoryGroupEnabledInternal() points to a |
| 55 // value with zero or more of the following bits. Used in this class only. | 54 // value with zero or more of the following bits. Used in this class only. |
| 56 // The TRACE_EVENT macros should only use the value as a bool. | 55 // The TRACE_EVENT macros should only use the value as a bool. |
| 57 // These values must be in sync with macro values in TraceEvent.h in Blink. | 56 // These values must be in sync with macro values in TraceEvent.h in Blink. |
| 58 enum CategoryGroupEnabledFlags { | 57 enum CategoryGroupEnabledFlags { |
| 59 // Category group enabled for the recording mode. | 58 // Category group enabled for the recording mode. |
| 60 ENABLED_FOR_RECORDING = 1 << 0, | 59 ENABLED_FOR_RECORDING = 1 << 0, |
| 61 // Category group enabled for the monitoring mode. | |
| 62 ENABLED_FOR_MONITORING = 1 << 1, | |
|
Primiano Tucci (use gerrit)
2016/02/08 10:45:21
Isn't this going to break skia?
IIRC they have a f
fmeawad
2016/02/09 00:11:39
There is also a copy in V8 that I plan to update.
| |
| 63 // Category group enabled by SetEventCallbackEnabled(). | 60 // Category group enabled by SetEventCallbackEnabled(). |
| 64 ENABLED_FOR_EVENT_CALLBACK = 1 << 2, | 61 ENABLED_FOR_EVENT_CALLBACK = 1 << 1, |
| 65 // Category group enabled to export events to ETW. | 62 // Category group enabled to export events to ETW. |
| 66 ENABLED_FOR_ETW_EXPORT = 1 << 3 | 63 ENABLED_FOR_ETW_EXPORT = 1 << 2 |
| 67 }; | 64 }; |
| 68 | 65 |
| 69 static TraceLog* GetInstance(); | 66 static TraceLog* GetInstance(); |
| 70 | 67 |
| 71 // Get set of known category groups. This can change as new code paths are | 68 // Get set of known category groups. This can change as new code paths are |
| 72 // reached. The known category groups are inserted into |category_groups|. | 69 // reached. The known category groups are inserted into |category_groups|. |
| 73 void GetKnownCategoryGroups(std::vector<std::string>* category_groups); | 70 void GetKnownCategoryGroups(std::vector<std::string>* category_groups); |
| 74 | 71 |
| 75 // Retrieves a copy (for thread-safety) of the current TraceConfig. | 72 // Retrieves a copy (for thread-safety) of the current TraceConfig. |
| 76 TraceConfig GetCurrentTraceConfig() const; | 73 TraceConfig GetCurrentTraceConfig() const; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 // undefined. Use TraceResultBuffer to convert one or more trace strings to | 160 // undefined. Use TraceResultBuffer to convert one or more trace strings to |
| 164 // JSON. The callback can be null if the caller doesn't want any data. | 161 // JSON. The callback can be null if the caller doesn't want any data. |
| 165 // Due to the implementation of thread-local buffers, flush can't be | 162 // Due to the implementation of thread-local buffers, flush can't be |
| 166 // done when tracing is enabled. If called when tracing is enabled, the | 163 // done when tracing is enabled. If called when tracing is enabled, the |
| 167 // callback will be called directly with (empty_string, false) to indicate | 164 // callback will be called directly with (empty_string, false) to indicate |
| 168 // the end of this unsuccessful flush. Flush does the serialization | 165 // the end of this unsuccessful flush. Flush does the serialization |
| 169 // on the same thread if the caller doesn't set use_worker_thread explicitly. | 166 // on the same thread if the caller doesn't set use_worker_thread explicitly. |
| 170 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&, | 167 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&, |
| 171 bool has_more_events)> OutputCallback; | 168 bool has_more_events)> OutputCallback; |
| 172 void Flush(const OutputCallback& cb, bool use_worker_thread = false); | 169 void Flush(const OutputCallback& cb, bool use_worker_thread = false); |
| 173 void FlushButLeaveBufferIntact(const OutputCallback& flush_output_callback); | |
| 174 | 170 |
| 175 // Cancels tracing and discards collected data. | 171 // Cancels tracing and discards collected data. |
| 176 void CancelTracing(const OutputCallback& cb); | 172 void CancelTracing(const OutputCallback& cb); |
| 177 | 173 |
| 178 // Called by TRACE_EVENT* macros, don't call this directly. | 174 // Called by TRACE_EVENT* macros, don't call this directly. |
| 179 // The name parameter is a category group for example: | 175 // The name parameter is a category group for example: |
| 180 // TRACE_EVENT0("renderer,webkit", "WebViewImpl::HandleInputEvent") | 176 // TRACE_EVENT0("renderer,webkit", "WebViewImpl::HandleInputEvent") |
| 181 static const unsigned char* GetCategoryGroupEnabled(const char* name); | 177 static const unsigned char* GetCategoryGroupEnabled(const char* name); |
| 182 static const char* GetCategoryGroupName( | 178 static const char* GetCategoryGroupName( |
| 183 const unsigned char* category_group_enabled); | 179 const unsigned char* category_group_enabled); |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 500 subtle::AtomicWord generation_; | 496 subtle::AtomicWord generation_; |
| 501 bool use_worker_thread_; | 497 bool use_worker_thread_; |
| 502 | 498 |
| 503 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 499 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
| 504 }; | 500 }; |
| 505 | 501 |
| 506 } // namespace trace_event | 502 } // namespace trace_event |
| 507 } // namespace base | 503 } // namespace base |
| 508 | 504 |
| 509 #endif // BASE_TRACE_EVENT_TRACE_LOG_H_ | 505 #endif // BASE_TRACE_EVENT_TRACE_LOG_H_ |
| OLD | NEW |