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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 public base::trace_event::MemoryDumpManagerDelegate, | 34 public base::trace_event::MemoryDumpManagerDelegate, |
35 public base::trace_event::TracingAgent { | 35 public base::trace_event::TracingAgent { |
36 public: | 36 public: |
37 static TracingControllerImpl* GetInstance(); | 37 static TracingControllerImpl* GetInstance(); |
38 | 38 |
39 // TracingController implementation. | 39 // TracingController implementation. |
40 bool GetCategories(const GetCategoriesDoneCallback& callback) override; | 40 bool GetCategories(const GetCategoriesDoneCallback& callback) override; |
41 bool StartTracing(const base::trace_event::TraceConfig& trace_config, | 41 bool StartTracing(const base::trace_event::TraceConfig& trace_config, |
42 const StartTracingDoneCallback& callback) override; | 42 const StartTracingDoneCallback& callback) override; |
43 bool StopTracing(const scoped_refptr<TraceDataSink>& sink) override; | 43 bool StopTracing(const scoped_refptr<TraceDataSink>& sink) override; |
44 bool StartMonitoring( | |
45 const base::trace_event::TraceConfig& trace_config, | |
46 const StartMonitoringDoneCallback& callback) override; | |
47 bool StopMonitoring( | |
48 const StopMonitoringDoneCallback& callback) override; | |
49 void GetMonitoringStatus( | |
50 bool* out_enabled, | |
51 base::trace_event::TraceConfig* out_trace_config) override; | |
52 bool CaptureMonitoringSnapshot( | |
53 const scoped_refptr<TraceDataSink>& sink) override; | |
54 bool GetTraceBufferUsage( | 44 bool GetTraceBufferUsage( |
55 const GetTraceBufferUsageCallback& callback) override; | 45 const GetTraceBufferUsageCallback& callback) override; |
56 bool SetWatchEvent(const std::string& category_name, | 46 bool SetWatchEvent(const std::string& category_name, |
57 const std::string& event_name, | 47 const std::string& event_name, |
58 const WatchEventCallback& callback) override; | 48 const WatchEventCallback& callback) override; |
59 bool CancelWatchEvent() override; | 49 bool CancelWatchEvent() override; |
60 bool IsTracing() const override; | 50 bool IsTracing() const override; |
61 | 51 |
62 void RegisterTracingUI(TracingUI* tracing_ui); | 52 void RegisterTracingUI(TracingUI* tracing_ui); |
63 void UnregisterTracingUI(TracingUI* tracing_ui); | 53 void UnregisterTracingUI(TracingUI* tracing_ui); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 bool can_cancel_watch_event() const { | 107 bool can_cancel_watch_event() const { |
118 return !watch_event_callback_.is_null(); | 108 return !watch_event_callback_.is_null(); |
119 } | 109 } |
120 | 110 |
121 // Methods for use by TraceMessageFilter. | 111 // Methods for use by TraceMessageFilter. |
122 void AddTraceMessageFilter(TraceMessageFilter* trace_message_filter); | 112 void AddTraceMessageFilter(TraceMessageFilter* trace_message_filter); |
123 void RemoveTraceMessageFilter(TraceMessageFilter* trace_message_filter); | 113 void RemoveTraceMessageFilter(TraceMessageFilter* trace_message_filter); |
124 | 114 |
125 void OnTraceDataCollected( | 115 void OnTraceDataCollected( |
126 const scoped_refptr<base::RefCountedString>& events_str_ptr); | 116 const scoped_refptr<base::RefCountedString>& events_str_ptr); |
127 void OnMonitoringTraceDataCollected( | |
128 const scoped_refptr<base::RefCountedString>& events_str_ptr); | |
129 | 117 |
130 // Callback of TraceLog::Flush() for the local trace. | 118 // Callback of TraceLog::Flush() for the local trace. |
131 void OnLocalTraceDataCollected( | 119 void OnLocalTraceDataCollected( |
132 const scoped_refptr<base::RefCountedString>& events_str_ptr, | 120 const scoped_refptr<base::RefCountedString>& events_str_ptr, |
133 bool has_more_events); | 121 bool has_more_events); |
134 // Callback of TraceLog::FlushMonitoring() for the local trace. | |
135 void OnLocalMonitoringTraceDataCollected( | |
136 const scoped_refptr<base::RefCountedString>& events_str_ptr, | |
137 bool has_more_events); | |
138 | 122 |
139 // Adds the tracing agent with the specified agent name to the list of | 123 // Adds the tracing agent with the specified agent name to the list of |
140 // additional tracing agents. | 124 // additional tracing agents. |
141 void AddTracingAgent(const std::string& agent_name); | 125 void AddTracingAgent(const std::string& agent_name); |
142 | 126 |
143 void OnStartAgentTracingAcked(const std::string& agent_name, bool success); | 127 void OnStartAgentTracingAcked(const std::string& agent_name, bool success); |
144 | 128 |
145 void OnStopTracingAcked( | 129 void OnStopTracingAcked( |
146 TraceMessageFilter* trace_message_filter, | 130 TraceMessageFilter* trace_message_filter, |
147 const std::vector<std::string>& known_category_groups); | 131 const std::vector<std::string>& known_category_groups); |
148 | 132 |
149 void OnEndAgentTracingAcked( | 133 void OnEndAgentTracingAcked( |
150 const std::string& agent_name, | 134 const std::string& agent_name, |
151 const std::string& events_label, | 135 const std::string& events_label, |
152 const scoped_refptr<base::RefCountedString>& events_str_ptr); | 136 const scoped_refptr<base::RefCountedString>& events_str_ptr); |
153 | 137 |
154 void OnCaptureMonitoringSnapshotAcked( | |
155 TraceMessageFilter* trace_message_filter); | |
156 | |
157 void OnTraceLogStatusReply(TraceMessageFilter* trace_message_filter, | 138 void OnTraceLogStatusReply(TraceMessageFilter* trace_message_filter, |
158 const base::trace_event::TraceLogStatus& status); | 139 const base::trace_event::TraceLogStatus& status); |
159 void OnProcessMemoryDumpResponse(TraceMessageFilter* trace_message_filter, | 140 void OnProcessMemoryDumpResponse(TraceMessageFilter* trace_message_filter, |
160 uint64_t dump_guid, | 141 uint64_t dump_guid, |
161 bool success); | 142 bool success); |
162 | 143 |
163 // Callback of MemoryDumpManager::CreateProcessDump(). | 144 // Callback of MemoryDumpManager::CreateProcessDump(). |
164 void OnBrowserProcessMemoryDumpDone(uint64_t dump_guid, bool success); | 145 void OnBrowserProcessMemoryDumpDone(uint64_t dump_guid, bool success); |
165 | 146 |
166 void FinalizeGlobalMemoryDumpIfAllProcessesReplied(); | 147 void FinalizeGlobalMemoryDumpIfAllProcessesReplied(); |
167 | 148 |
168 void OnWatchEventMatched(); | 149 void OnWatchEventMatched(); |
169 | 150 |
170 void SetEnabledOnFileThread( | 151 void SetEnabledOnFileThread( |
171 const base::trace_event::TraceConfig& trace_config, | 152 const base::trace_event::TraceConfig& trace_config, |
172 int mode, | 153 int mode, |
173 const base::Closure& callback); | 154 const base::Closure& callback); |
174 void SetDisabledOnFileThread(const base::Closure& callback); | 155 void SetDisabledOnFileThread(const base::Closure& callback); |
175 void OnAllTracingAgentsStarted(); | 156 void OnAllTracingAgentsStarted(); |
176 void StopTracingAfterClockSync(); | 157 void StopTracingAfterClockSync(); |
177 void OnStopTracingDone(); | 158 void OnStopTracingDone(); |
178 void OnStartMonitoringDone( | |
179 const base::trace_event::TraceConfig& trace_config, | |
180 const StartMonitoringDoneCallback& callback); | |
181 void OnStopMonitoringDone(const StopMonitoringDoneCallback& callback); | |
182 | |
183 void OnMonitoringStateChanged(bool is_monitoring); | |
184 | 159 |
185 // Issue clock sync markers to the tracing agents. | 160 // Issue clock sync markers to the tracing agents. |
186 void IssueClockSyncMarker(); | 161 void IssueClockSyncMarker(); |
187 void OnClockSyncMarkerRecordedByAgent( | 162 void OnClockSyncMarkerRecordedByAgent( |
188 const std::string& sync_id, | 163 const std::string& sync_id, |
189 const base::TimeTicks& issue_ts, | 164 const base::TimeTicks& issue_ts, |
190 const base::TimeTicks& issue_end_ts); | 165 const base::TimeTicks& issue_end_ts); |
191 | 166 |
192 typedef std::set<scoped_refptr<TraceMessageFilter>> TraceMessageFilterSet; | 167 typedef std::set<scoped_refptr<TraceMessageFilter>> TraceMessageFilterSet; |
193 TraceMessageFilterSet trace_message_filters_; | 168 TraceMessageFilterSet trace_message_filters_; |
194 | 169 |
195 // Pending acks for StartTracing. | 170 // Pending acks for StartTracing. |
196 int pending_start_tracing_ack_count_; | 171 int pending_start_tracing_ack_count_; |
197 base::OneShotTimer start_tracing_timer_; | 172 base::OneShotTimer start_tracing_timer_; |
198 StartTracingDoneCallback start_tracing_done_callback_; | 173 StartTracingDoneCallback start_tracing_done_callback_; |
199 scoped_ptr<base::trace_event::TraceConfig> start_tracing_trace_config_; | 174 scoped_ptr<base::trace_event::TraceConfig> start_tracing_trace_config_; |
200 | 175 |
201 // Pending acks for StopTracing. | 176 // Pending acks for StopTracing. |
202 int pending_stop_tracing_ack_count_; | 177 int pending_stop_tracing_ack_count_; |
203 TraceMessageFilterSet pending_stop_tracing_filters_; | 178 TraceMessageFilterSet pending_stop_tracing_filters_; |
204 | 179 |
205 // Pending acks for CaptureMonitoringSnapshot. | |
206 int pending_capture_monitoring_snapshot_ack_count_; | |
207 TraceMessageFilterSet pending_capture_monitoring_filters_; | |
208 | |
209 // Pending acks for GetTraceLogStatus. | 180 // Pending acks for GetTraceLogStatus. |
210 int pending_trace_log_status_ack_count_; | 181 int pending_trace_log_status_ack_count_; |
211 TraceMessageFilterSet pending_trace_log_status_filters_; | 182 TraceMessageFilterSet pending_trace_log_status_filters_; |
212 float maximum_trace_buffer_usage_; | 183 float maximum_trace_buffer_usage_; |
213 size_t approximate_event_count_; | 184 size_t approximate_event_count_; |
214 | 185 |
215 // Pending acks for memory RequestGlobalDumpPoint. | 186 // Pending acks for memory RequestGlobalDumpPoint. |
216 int pending_memory_dump_ack_count_; | 187 int pending_memory_dump_ack_count_; |
217 int failed_memory_dump_count_; | 188 int failed_memory_dump_count_; |
218 TraceMessageFilterSet pending_memory_dump_filters_; | 189 TraceMessageFilterSet pending_memory_dump_filters_; |
(...skipping 22 matching lines...) Expand all Loading... |
241 std::set<TracingUI*> tracing_uis_; | 212 std::set<TracingUI*> tracing_uis_; |
242 scoped_refptr<TraceDataSink> trace_data_sink_; | 213 scoped_refptr<TraceDataSink> trace_data_sink_; |
243 scoped_refptr<TraceDataSink> monitoring_data_sink_; | 214 scoped_refptr<TraceDataSink> monitoring_data_sink_; |
244 | 215 |
245 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl); | 216 DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl); |
246 }; | 217 }; |
247 | 218 |
248 } // namespace content | 219 } // namespace content |
249 | 220 |
250 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ | 221 #endif // CONTENT_BROWSER_TRACING_TRACING_CONTROLLER_IMPL_H_ |
OLD | NEW |