| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ | 6 #define CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 const base::debug::TraceOptions& trace_options, | 36 const base::debug::TraceOptions& trace_options, |
| 37 const EnableMonitoringDoneCallback& callback) override; | 37 const EnableMonitoringDoneCallback& callback) override; |
| 38 bool DisableMonitoring( | 38 bool DisableMonitoring( |
| 39 const DisableMonitoringDoneCallback& callback) override; | 39 const DisableMonitoringDoneCallback& callback) override; |
| 40 void GetMonitoringStatus( | 40 void GetMonitoringStatus( |
| 41 bool* out_enabled, | 41 bool* out_enabled, |
| 42 base::debug::CategoryFilter* out_category_filter, | 42 base::debug::CategoryFilter* out_category_filter, |
| 43 base::debug::TraceOptions* out_trace_options) override; | 43 base::debug::TraceOptions* out_trace_options) override; |
| 44 bool CaptureMonitoringSnapshot( | 44 bool CaptureMonitoringSnapshot( |
| 45 const scoped_refptr<TraceDataSink>& sink) override; | 45 const scoped_refptr<TraceDataSink>& sink) override; |
| 46 bool GetTraceBufferPercentFull( | 46 bool GetTraceBufferUsage( |
| 47 const GetTraceBufferPercentFullCallback& callback) override; | 47 const GetTraceBufferUsageCallback& callback) override; |
| 48 bool SetWatchEvent(const std::string& category_name, | 48 bool SetWatchEvent(const std::string& category_name, |
| 49 const std::string& event_name, | 49 const std::string& event_name, |
| 50 const WatchEventCallback& callback) override; | 50 const WatchEventCallback& callback) override; |
| 51 bool CancelWatchEvent() override; | 51 bool CancelWatchEvent() override; |
| 52 | 52 |
| 53 void RegisterTracingUI(TracingUI* tracing_ui); | 53 void RegisterTracingUI(TracingUI* tracing_ui); |
| 54 void UnregisterTracingUI(TracingUI* tracing_ui); | 54 void UnregisterTracingUI(TracingUI* tracing_ui); |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 typedef std::set<scoped_refptr<TraceMessageFilter> > TraceMessageFilterSet; | 57 typedef std::set<scoped_refptr<TraceMessageFilter> > TraceMessageFilterSet; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 71 } | 71 } |
| 72 | 72 |
| 73 bool can_enable_monitoring() const { | 73 bool can_enable_monitoring() const { |
| 74 return !is_monitoring_; | 74 return !is_monitoring_; |
| 75 } | 75 } |
| 76 | 76 |
| 77 bool can_disable_monitoring() const { | 77 bool can_disable_monitoring() const { |
| 78 return is_monitoring_ && !monitoring_data_sink_.get(); | 78 return is_monitoring_ && !monitoring_data_sink_.get(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool can_get_trace_buffer_percent_full() const { | 81 bool can_get_trace_buffer_usage() const { |
| 82 return pending_trace_buffer_percent_full_callback_.is_null(); | 82 return pending_trace_buffer_usage_callback_.is_null(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool can_cancel_watch_event() const { | 85 bool can_cancel_watch_event() const { |
| 86 return !watch_event_callback_.is_null(); | 86 return !watch_event_callback_.is_null(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // Methods for use by TraceMessageFilter. | 89 // Methods for use by TraceMessageFilter. |
| 90 void AddTraceMessageFilter(TraceMessageFilter* trace_message_filter); | 90 void AddTraceMessageFilter(TraceMessageFilter* trace_message_filter); |
| 91 void RemoveTraceMessageFilter(TraceMessageFilter* trace_message_filter); | 91 void RemoveTraceMessageFilter(TraceMessageFilter* trace_message_filter); |
| 92 | 92 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 109 const std::vector<std::string>& known_category_groups); | 109 const std::vector<std::string>& known_category_groups); |
| 110 | 110 |
| 111 #if defined(OS_CHROMEOS) || defined(OS_WIN) | 111 #if defined(OS_CHROMEOS) || defined(OS_WIN) |
| 112 void OnEndSystemTracingAcked( | 112 void OnEndSystemTracingAcked( |
| 113 const scoped_refptr<base::RefCountedString>& events_str_ptr); | 113 const scoped_refptr<base::RefCountedString>& events_str_ptr); |
| 114 #endif | 114 #endif |
| 115 | 115 |
| 116 void OnCaptureMonitoringSnapshotAcked( | 116 void OnCaptureMonitoringSnapshotAcked( |
| 117 TraceMessageFilter* trace_message_filter); | 117 TraceMessageFilter* trace_message_filter); |
| 118 | 118 |
| 119 void OnTraceBufferPercentFullReply( | 119 void OnTraceBufferUsageReply(TraceMessageFilter* trace_message_filter, |
| 120 TraceMessageFilter* trace_message_filter, | 120 size_t event_capacity, |
| 121 float percent_full); | 121 size_t event_count); |
| 122 | 122 |
| 123 void OnWatchEventMatched(); | 123 void OnWatchEventMatched(); |
| 124 | 124 |
| 125 void SetEnabledOnFileThread( | 125 void SetEnabledOnFileThread( |
| 126 const base::debug::CategoryFilter& category_filter, | 126 const base::debug::CategoryFilter& category_filter, |
| 127 int mode, | 127 int mode, |
| 128 const base::debug::TraceOptions& trace_options, | 128 const base::debug::TraceOptions& trace_options, |
| 129 const base::Closure& callback); | 129 const base::Closure& callback); |
| 130 void SetDisabledOnFileThread(const base::Closure& callback); | 130 void SetDisabledOnFileThread(const base::Closure& callback); |
| 131 void OnEnableRecordingDone(const base::debug::CategoryFilter& category_filter, | 131 void OnEnableRecordingDone(const base::debug::CategoryFilter& category_filter, |
| 132 const base::debug::TraceOptions& trace_options, | 132 const base::debug::TraceOptions& trace_options, |
| 133 const EnableRecordingDoneCallback& callback); | 133 const EnableRecordingDoneCallback& callback); |
| 134 void OnDisableRecordingDone(); | 134 void OnDisableRecordingDone(); |
| 135 void OnEnableMonitoringDone( | 135 void OnEnableMonitoringDone( |
| 136 const base::debug::CategoryFilter& category_filter, | 136 const base::debug::CategoryFilter& category_filter, |
| 137 const base::debug::TraceOptions& trace_options, | 137 const base::debug::TraceOptions& trace_options, |
| 138 const EnableMonitoringDoneCallback& callback); | 138 const EnableMonitoringDoneCallback& callback); |
| 139 void OnDisableMonitoringDone(const DisableMonitoringDoneCallback& callback); | 139 void OnDisableMonitoringDone(const DisableMonitoringDoneCallback& callback); |
| 140 | 140 |
| 141 void OnMonitoringStateChanged(bool is_monitoring); | 141 void OnMonitoringStateChanged(bool is_monitoring); |
| 142 | 142 |
| 143 TraceMessageFilterSet trace_message_filters_; | 143 TraceMessageFilterSet trace_message_filters_; |
| 144 | 144 |
| 145 // Pending acks for DisableRecording. | 145 // Pending acks for DisableRecording. |
| 146 int pending_disable_recording_ack_count_; | 146 int pending_disable_recording_ack_count_; |
| 147 TraceMessageFilterSet pending_disable_recording_filters_; | 147 TraceMessageFilterSet pending_disable_recording_filters_; |
| 148 // Pending acks for CaptureMonitoringSnapshot. | 148 // Pending acks for CaptureMonitoringSnapshot. |
| 149 int pending_capture_monitoring_snapshot_ack_count_; | 149 int pending_capture_monitoring_snapshot_ack_count_; |
| 150 TraceMessageFilterSet pending_capture_monitoring_filters_; | 150 TraceMessageFilterSet pending_capture_monitoring_filters_; |
| 151 // Pending acks for GetTraceBufferPercentFull. | 151 // Pending acks for GetTraceBufferUsage. |
| 152 int pending_trace_buffer_percent_full_ack_count_; | 152 int pending_trace_buffer_usage_ack_count_; |
| 153 TraceMessageFilterSet pending_trace_buffer_percent_full_filters_; | 153 TraceMessageFilterSet pending_trace_buffer_usage_filters_; |
| 154 float maximum_trace_buffer_percent_full_; | 154 float maximum_trace_buffer_usage_; |
| 155 size_t approximate_event_count_; |
| 155 | 156 |
| 156 #if defined(OS_CHROMEOS) || defined(OS_WIN) | 157 #if defined(OS_CHROMEOS) || defined(OS_WIN) |
| 157 bool is_system_tracing_; | 158 bool is_system_tracing_; |
| 158 #endif | 159 #endif |
| 159 bool is_recording_; | 160 bool is_recording_; |
| 160 bool is_monitoring_; | 161 bool is_monitoring_; |
| 161 base::debug::TraceOptions trace_options_; | 162 base::debug::TraceOptions trace_options_; |
| 162 | 163 |
| 163 GetCategoriesDoneCallback pending_get_categories_done_callback_; | 164 GetCategoriesDoneCallback pending_get_categories_done_callback_; |
| 164 GetTraceBufferPercentFullCallback pending_trace_buffer_percent_full_callback_; | 165 GetTraceBufferUsageCallback pending_trace_buffer_usage_callback_; |
| 165 | 166 |
| 166 std::string watch_category_name_; | 167 std::string watch_category_name_; |
| 167 std::string watch_event_name_; | 168 std::string watch_event_name_; |
| 168 WatchEventCallback watch_event_callback_; | 169 WatchEventCallback watch_event_callback_; |
| 169 | 170 |
| 170 std::set<std::string> known_category_groups_; | 171 std::set<std::string> known_category_groups_; |
| 171 std::set<TracingUI*> tracing_uis_; | 172 std::set<TracingUI*> tracing_uis_; |
| 172 scoped_refptr<TraceDataSink> trace_data_sink_; | 173 scoped_refptr<TraceDataSink> trace_data_sink_; |
| 173 scoped_refptr<TraceDataSink> monitoring_data_sink_; | 174 scoped_refptr<TraceDataSink> monitoring_data_sink_; |
| 174 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl); | 175 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl); |
| 175 }; | 176 }; |
| 176 | 177 |
| 177 } // namespace content | 178 } // namespace content |
| 178 | 179 |
| 179 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ | 180 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ |
| OLD | NEW |