Chromium Code Reviews| Index: base/debug/trace_event_impl.h |
| diff --git a/base/debug/trace_event_impl.h b/base/debug/trace_event_impl.h |
| index 61794807a41323a2f7e29d2addbc101973a072c1..7dd4a00fd251a70ff0d8c24679f8d955252b44c1 100644 |
| --- a/base/debug/trace_event_impl.h |
| +++ b/base/debug/trace_event_impl.h |
| @@ -354,6 +354,12 @@ class TraceSamplingThread; |
| class BASE_EXPORT TraceLog { |
| public: |
| + enum Mode { |
| + DISABLED = 0, |
| + RECORDING_MODE, |
| + MONITORING_MODE, |
| + }; |
| + |
| // Options determines how the trace buffer stores data. |
| enum Options { |
| // Record until the trace buffer is full. |
| @@ -366,21 +372,21 @@ class BASE_EXPORT TraceLog { |
| // Enable the sampling profiler in the recording mode. |
| ENABLE_SAMPLING = 1 << 2, |
| - // Enable the sampling profiler in the monitoring mode. |
| - MONITOR_SAMPLING = 1 << 3, |
| - |
| // Echo to console. Events are discarded. |
| - ECHO_TO_CONSOLE = 1 << 4, |
| + ECHO_TO_CONSOLE = 1 << 3, |
| }; |
| // The pointer returned from GetCategoryGroupEnabledInternal() points to a |
| // value with zero or more of the following bits. Used in this class only. |
| // The TRACE_EVENT macros should only use the value as a bool. |
| + // These values must be in sync with macro values in TraceEvent.h in Blink. |
|
dsinclair
2013/12/20 14:42:29
Has this change happened in blink already?
haraken
2013/12/25 07:52:31
Not yet. I'll do it after landing this CL. Since n
|
| enum CategoryGroupEnabledFlags { |
| - // Normal enabled flag for category groups enabled by SetEnabled(). |
| + // Category group enabled for the recording mode. |
| ENABLED_FOR_RECORDING = 1 << 0, |
| + // Category group enabled for the monitoring mode. |
| + ENABLED_FOR_MONITORING = 1 << 1, |
| // Category group enabled by SetEventCallbackEnabled(). |
| - ENABLED_FOR_EVENT_CALLBACK = 1 << 1, |
| + ENABLED_FOR_EVENT_CALLBACK = 1 << 2, |
| }; |
| static TraceLog* GetInstance(); |
| @@ -400,12 +406,13 @@ class BASE_EXPORT TraceLog { |
| // See CategoryFilter comments for details on how to control what categories |
| // will be traced. If tracing has already been enabled, |category_filter| will |
| // be merged into the current category filter. |
| - void SetEnabled(const CategoryFilter& category_filter, Options options); |
| + void SetEnabled(const CategoryFilter& category_filter, |
| + Mode mode, Options options); |
| // Disables normal tracing for all categories. |
| void SetDisabled(); |
| - bool IsEnabled() { return enabled_; } |
| + bool IsEnabled() { return mode_ != DISABLED; } |
| // The number of times we have begun recording traces. If tracing is off, |
| // returns -1. If tracing is on, then it returns the number of times we have |
| @@ -426,7 +433,7 @@ class BASE_EXPORT TraceLog { |
| class EnabledStateObserver { |
| public: |
| // Called just after the tracing system becomes enabled, outside of the |
| - // |lock_|. TraceLog::IsEnabled() is true at this point. |
| + // |lock_|. TraceLog::IsEnabled() is true at this point. |
| virtual void OnTraceLogEnabled() = 0; |
| // Called just after the tracing system disables, outside of the |lock_|. |
| @@ -591,9 +598,9 @@ class BASE_EXPORT TraceLog { |
| // by the Singleton class. |
| friend struct DefaultSingletonTraits<TraceLog>; |
| - // Enable/disable each category group based on the current enabled_, |
| + // Enable/disable each category group based on the current mode_, |
| // category_filter_, event_callback_ and event_callback_category_filter_. |
| - // Enable the category group if enabled_ is true and category_filter_ matches |
| + // Enable the category group in the enabled mode if category_filter_ matches |
| // the category group, or event_callback_ is not null and |
| // event_callback_category_filter_ matches the category group. |
| void UpdateCategoryGroupEnabledFlags(); |
| @@ -652,7 +659,7 @@ class BASE_EXPORT TraceLog { |
| // and thread_colors_. |
| Lock thread_info_lock_; |
| int locked_line_; |
| - bool enabled_; |
| + Mode mode_; |
| int num_traces_recorded_; |
| scoped_ptr<TraceBuffer> logged_events_; |
| subtle::AtomicWord /* EventCallback */ event_callback_; |