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 OnTraceLogStatusReply(TraceMessageFilter* trace_message_filter, |
120 TraceMessageFilter* trace_message_filter, | 120 const base::debug::TraceLogStatus& status); |
121 float percent_full); | |
122 | 121 |
123 void OnWatchEventMatched(); | 122 void OnWatchEventMatched(); |
124 | 123 |
125 void SetEnabledOnFileThread( | 124 void SetEnabledOnFileThread( |
126 const base::debug::CategoryFilter& category_filter, | 125 const base::debug::CategoryFilter& category_filter, |
127 int mode, | 126 int mode, |
128 const base::debug::TraceOptions& trace_options, | 127 const base::debug::TraceOptions& trace_options, |
129 const base::Closure& callback); | 128 const base::Closure& callback); |
130 void SetDisabledOnFileThread(const base::Closure& callback); | 129 void SetDisabledOnFileThread(const base::Closure& callback); |
131 void OnEnableRecordingDone(const base::debug::CategoryFilter& category_filter, | 130 void OnEnableRecordingDone(const base::debug::CategoryFilter& category_filter, |
132 const base::debug::TraceOptions& trace_options, | 131 const base::debug::TraceOptions& trace_options, |
133 const EnableRecordingDoneCallback& callback); | 132 const EnableRecordingDoneCallback& callback); |
134 void OnDisableRecordingDone(); | 133 void OnDisableRecordingDone(); |
135 void OnEnableMonitoringDone( | 134 void OnEnableMonitoringDone( |
136 const base::debug::CategoryFilter& category_filter, | 135 const base::debug::CategoryFilter& category_filter, |
137 const base::debug::TraceOptions& trace_options, | 136 const base::debug::TraceOptions& trace_options, |
138 const EnableMonitoringDoneCallback& callback); | 137 const EnableMonitoringDoneCallback& callback); |
139 void OnDisableMonitoringDone(const DisableMonitoringDoneCallback& callback); | 138 void OnDisableMonitoringDone(const DisableMonitoringDoneCallback& callback); |
140 | 139 |
141 void OnMonitoringStateChanged(bool is_monitoring); | 140 void OnMonitoringStateChanged(bool is_monitoring); |
142 | 141 |
143 TraceMessageFilterSet trace_message_filters_; | 142 TraceMessageFilterSet trace_message_filters_; |
144 | 143 |
145 // Pending acks for DisableRecording. | 144 // Pending acks for DisableRecording. |
146 int pending_disable_recording_ack_count_; | 145 int pending_disable_recording_ack_count_; |
147 TraceMessageFilterSet pending_disable_recording_filters_; | 146 TraceMessageFilterSet pending_disable_recording_filters_; |
148 // Pending acks for CaptureMonitoringSnapshot. | 147 // Pending acks for CaptureMonitoringSnapshot. |
149 int pending_capture_monitoring_snapshot_ack_count_; | 148 int pending_capture_monitoring_snapshot_ack_count_; |
150 TraceMessageFilterSet pending_capture_monitoring_filters_; | 149 TraceMessageFilterSet pending_capture_monitoring_filters_; |
151 // Pending acks for GetTraceBufferPercentFull. | 150 // Pending acks for GetTraceLogStatus. |
152 int pending_trace_buffer_percent_full_ack_count_; | 151 int pending_trace_log_status_ack_count_; |
153 TraceMessageFilterSet pending_trace_buffer_percent_full_filters_; | 152 TraceMessageFilterSet pending_trace_log_status_filters_; |
154 float maximum_trace_buffer_percent_full_; | 153 float maximum_trace_buffer_usage_; |
| 154 size_t approximate_event_count_; |
155 | 155 |
156 #if defined(OS_CHROMEOS) || defined(OS_WIN) | 156 #if defined(OS_CHROMEOS) || defined(OS_WIN) |
157 bool is_system_tracing_; | 157 bool is_system_tracing_; |
158 #endif | 158 #endif |
159 bool is_recording_; | 159 bool is_recording_; |
160 bool is_monitoring_; | 160 bool is_monitoring_; |
161 base::debug::TraceOptions trace_options_; | 161 base::debug::TraceOptions trace_options_; |
162 | 162 |
163 GetCategoriesDoneCallback pending_get_categories_done_callback_; | 163 GetCategoriesDoneCallback pending_get_categories_done_callback_; |
164 GetTraceBufferPercentFullCallback pending_trace_buffer_percent_full_callback_; | 164 GetTraceBufferUsageCallback pending_trace_buffer_usage_callback_; |
165 | 165 |
166 std::string watch_category_name_; | 166 std::string watch_category_name_; |
167 std::string watch_event_name_; | 167 std::string watch_event_name_; |
168 WatchEventCallback watch_event_callback_; | 168 WatchEventCallback watch_event_callback_; |
169 | 169 |
170 std::set<std::string> known_category_groups_; | 170 std::set<std::string> known_category_groups_; |
171 std::set<TracingUI*> tracing_uis_; | 171 std::set<TracingUI*> tracing_uis_; |
172 scoped_refptr<TraceDataSink> trace_data_sink_; | 172 scoped_refptr<TraceDataSink> trace_data_sink_; |
173 scoped_refptr<TraceDataSink> monitoring_data_sink_; | 173 scoped_refptr<TraceDataSink> monitoring_data_sink_; |
174 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl); | 174 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl); |
175 }; | 175 }; |
176 | 176 |
177 } // namespace content | 177 } // namespace content |
178 | 178 |
179 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ | 179 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ |
OLD | NEW |