Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: content/browser/tracing/tracing_controller_impl.cc

Issue 67683003: Remove TraceController (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "content/browser/tracing/tracing_controller_impl.h" 5 #include "content/browser/tracing/tracing_controller_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h"
8 #include "base/file_util.h" 9 #include "base/file_util.h"
9 #include "base/json/string_escape.h" 10 #include "base/json/string_escape.h"
10 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
11 #include "content/browser/tracing/trace_message_filter.h" 12 #include "content/browser/tracing/trace_message_filter.h"
12 #include "content/common/child_process_messages.h" 13 #include "content/common/child_process_messages.h"
13 #include "content/public/browser/browser_message_filter.h" 14 #include "content/public/browser/browser_message_filter.h"
14 #include "content/public/common/content_switches.h" 15 #include "content/public/common/content_switches.h"
15 16
16 using base::debug::TraceLog; 17 using base::debug::TraceLog;
17 18
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 112
112 113
113 TracingControllerImpl::TracingControllerImpl() : 114 TracingControllerImpl::TracingControllerImpl() :
114 pending_disable_recording_ack_count_(0), 115 pending_disable_recording_ack_count_(0),
115 pending_capture_monitoring_snapshot_ack_count_(0), 116 pending_capture_monitoring_snapshot_ack_count_(0),
116 pending_trace_buffer_percent_full_ack_count_(0), 117 pending_trace_buffer_percent_full_ack_count_(0),
117 maximum_trace_buffer_percent_full_(0), 118 maximum_trace_buffer_percent_full_(0),
118 // Tracing may have been enabled by ContentMainRunner if kTraceStartup 119 // Tracing may have been enabled by ContentMainRunner if kTraceStartup
119 // is specified in command line. 120 // is specified in command line.
120 is_recording_(TraceLog::GetInstance()->IsEnabled()), 121 is_recording_(TraceLog::GetInstance()->IsEnabled()),
121 is_monitoring_(false), 122 is_monitoring_(false) {
122 category_filter_(
123 base::debug::CategoryFilter::kDefaultCategoryFilterString) {
124 } 123 }
125 124
126 TracingControllerImpl::~TracingControllerImpl() { 125 TracingControllerImpl::~TracingControllerImpl() {
127 // This is a Leaky instance. 126 // This is a Leaky instance.
128 NOTREACHED(); 127 NOTREACHED();
129 } 128 }
130 129
131 TracingControllerImpl* TracingControllerImpl::GetInstance() { 130 TracingControllerImpl* TracingControllerImpl::GetInstance() {
132 return g_controller.Pointer(); 131 return g_controller.Pointer();
133 } 132 }
134 133
135 void TracingControllerImpl::GetCategories( 134 bool TracingControllerImpl::GetCategories(
136 const GetCategoriesDoneCallback& callback) { 135 const GetCategoriesDoneCallback& callback) {
137 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 136 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
138 137
139 // Known categories come back from child processes with the EndTracingAck 138 // Known categories come back from child processes with the EndTracingAck
140 // message. So to get known categories, just begin and end tracing immediately 139 // message. So to get known categories, just begin and end tracing immediately
141 // afterwards. This will ping all the child processes for categories. 140 // afterwards. This will ping all the child processes for categories.
142 pending_get_categories_done_callback_ = callback; 141 pending_get_categories_done_callback_ = callback;
143 EnableRecording(base::debug::CategoryFilter("*"), 142 if (!EnableRecording("*", TracingController::Options(),
144 TracingController::Options(), 143 EnableRecordingDoneCallback())) {
145 EnableRecordingDoneCallback()); 144 pending_get_categories_done_callback_.Reset();
146 DisableRecording(base::FilePath(), TracingFileResultCallback()); 145 return false;
146 }
147
148 bool ok = DisableRecording(base::FilePath(), TracingFileResultCallback());
149 DCHECK(ok);
150 return true;
147 } 151 }
148 152
149 bool TracingControllerImpl::EnableRecording( 153 bool TracingControllerImpl::EnableRecording(
150 const base::debug::CategoryFilter& filter, 154 const std::string& category_filter,
151 TracingController::Options options, 155 TracingController::Options options,
152 const EnableRecordingDoneCallback& callback) { 156 const EnableRecordingDoneCallback& callback) {
153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 157 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
154 158
155 if (!can_enable_recording()) 159 if (!can_enable_recording())
156 return false; 160 return false;
157 161
158 #if defined(OS_ANDROID) 162 #if defined(OS_ANDROID)
159 if (pending_get_categories_done_callback_.is_null()) 163 if (pending_get_categories_done_callback_.is_null())
160 TraceLog::GetInstance()->AddClockSyncMetadataEvent(); 164 TraceLog::GetInstance()->AddClockSyncMetadataEvent();
161 #endif 165 #endif
162 166
163 TraceLog::Options trace_options = (options & RECORD_CONTINUOUSLY) ? 167 TraceLog::Options trace_options = (options & RECORD_CONTINUOUSLY) ?
164 TraceLog::RECORD_CONTINUOUSLY : TraceLog::RECORD_UNTIL_FULL; 168 TraceLog::RECORD_CONTINUOUSLY : TraceLog::RECORD_UNTIL_FULL;
165 if (options & ENABLE_SAMPLING) { 169 if (options & ENABLE_SAMPLING) {
166 trace_options = static_cast<TraceLog::Options>( 170 trace_options = static_cast<TraceLog::Options>(
167 trace_options | TraceLog::ENABLE_SAMPLING); 171 trace_options | TraceLog::ENABLE_SAMPLING);
168 } 172 }
169 // TODO(haraken): How to handle ENABLE_SYSTRACE? 173 // TODO(haraken): How to handle ENABLE_SYSTRACE?
170 174
171 TraceLog::GetInstance()->SetEnabled(filter, trace_options); 175 TraceLog::GetInstance()->SetEnabled(
176 base::debug::CategoryFilter(category_filter), trace_options);
172 is_recording_ = true; 177 is_recording_ = true;
173 category_filter_ = TraceLog::GetInstance()->GetCurrentCategoryFilter();
174 178
175 // Notify all child processes. 179 // Notify all child processes.
176 for (FilterMap::iterator it = filters_.begin(); it != filters_.end(); ++it) { 180 for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin();
177 it->get()->SendBeginTracing(category_filter_.ToString(), trace_options); 181 it != trace_message_filters_.end(); ++it) {
182 it->get()->SendBeginTracing(category_filter, trace_options);
178 } 183 }
179 184
180 if (!callback.is_null()) 185 if (!callback.is_null())
181 callback.Run(); 186 callback.Run();
182 return true; 187 return true;
183 } 188 }
184 189
185 bool TracingControllerImpl::DisableRecording( 190 bool TracingControllerImpl::DisableRecording(
186 const base::FilePath& result_file_path, 191 const base::FilePath& result_file_path,
187 const TracingFileResultCallback& callback) { 192 const TracingFileResultCallback& callback) {
188 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 193 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
189 194
190 if (!can_disable_recording()) 195 if (!can_disable_recording())
191 return false; 196 return false;
192 197
193 pending_disable_recording_done_callback_ = callback; 198 pending_disable_recording_done_callback_ = callback;
194 199
195 // Disable local trace early to avoid traces during end-tracing process from 200 // Disable local trace early to avoid traces during end-tracing process from
196 // interfering with the process. 201 // interfering with the process.
197 TraceLog::GetInstance()->SetDisabled(); 202 TraceLog::GetInstance()->SetDisabled();
198 203
199 #if defined(OS_ANDROID) 204 #if defined(OS_ANDROID)
200 if (pending_get_categories_done_callback_.is_null()) 205 if (pending_get_categories_done_callback_.is_null())
201 TraceLog::GetInstance()->AddClockSyncMetadataEvent(); 206 TraceLog::GetInstance()->AddClockSyncMetadataEvent();
202 #endif 207 #endif
203 208
204 if (!callback.is_null() || !result_file_path.empty()) 209 if (!callback.is_null() || !result_file_path.empty())
205 result_file_.reset(new ResultFile(result_file_path)); 210 result_file_.reset(new ResultFile(result_file_path));
206 211
207 // There could be a case where there are no child processes and filters_
208 // is empty. In that case we can immediately tell the subscriber that tracing
209 // has ended. To avoid recursive calls back to the subscriber, we will just
210 // use the existing asynchronous OnDisableRecordingAcked code.
211 // Count myself (local trace) in pending_disable_recording_ack_count_, 212 // Count myself (local trace) in pending_disable_recording_ack_count_,
212 // acked below. 213 // acked below.
213 pending_disable_recording_ack_count_ = filters_.size() + 1; 214 pending_disable_recording_ack_count_ = trace_message_filters_.size() + 1;
214 215
215 // Handle special case of zero child processes. 216 // Handle special case of zero child processes by immediately telling the
217 // caller that tracing has ended. Use asynchronous OnDisableRecordingAcked
218 // to avoid recursive call back to the caller.
216 if (pending_disable_recording_ack_count_ == 1) { 219 if (pending_disable_recording_ack_count_ == 1) {
217 // Ack asynchronously now, because we don't have any children to wait for. 220 // Ack asynchronously now, because we don't have any children to wait for.
218 std::vector<std::string> category_groups; 221 std::vector<std::string> category_groups;
219 TraceLog::GetInstance()->GetKnownCategoryGroups(&category_groups); 222 TraceLog::GetInstance()->GetKnownCategoryGroups(&category_groups);
220 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 223 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
221 base::Bind(&TracingControllerImpl::OnDisableRecordingAcked, 224 base::Bind(&TracingControllerImpl::OnDisableRecordingAcked,
222 base::Unretained(this), category_groups)); 225 base::Unretained(this), category_groups));
223 } 226 }
224 227
225 // Notify all child processes. 228 // Notify all child processes.
226 for (FilterMap::iterator it = filters_.begin(); it != filters_.end(); ++it) { 229 for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin();
230 it != trace_message_filters_.end(); ++it) {
227 it->get()->SendEndTracing(); 231 it->get()->SendEndTracing();
228 } 232 }
229 return true; 233 return true;
230 } 234 }
231 235
232 bool TracingControllerImpl::EnableMonitoring( 236 bool TracingControllerImpl::EnableMonitoring(
233 const base::debug::CategoryFilter& filter, 237 const std::string& category_filter,
234 TracingController::Options options, 238 TracingController::Options options,
235 const EnableMonitoringDoneCallback& callback) { 239 const EnableMonitoringDoneCallback& callback) {
236 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 240 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
237 241
238 if (!can_enable_monitoring()) 242 if (!can_enable_monitoring())
239 return false; 243 return false;
240 is_monitoring_ = true; 244 is_monitoring_ = true;
241 245
242 #if defined(OS_ANDROID) 246 #if defined(OS_ANDROID)
243 TraceLog::GetInstance()->AddClockSyncMetadataEvent(); 247 TraceLog::GetInstance()->AddClockSyncMetadataEvent();
244 #endif 248 #endif
245 249
246 int monitoring_tracing_options = 0; 250 int monitoring_tracing_options = 0;
247 if (options & ENABLE_SAMPLING) 251 if (options & ENABLE_SAMPLING)
248 monitoring_tracing_options |= base::debug::TraceLog::MONITOR_SAMPLING; 252 monitoring_tracing_options |= base::debug::TraceLog::MONITOR_SAMPLING;
249 253
250 TraceLog::GetInstance()->SetEnabled( 254 TraceLog::GetInstance()->SetEnabled(
251 filter, base::debug::TraceLog::Options(monitoring_tracing_options)); 255 base::debug::CategoryFilter(category_filter),
256 static_cast<TraceLog::Options>(monitoring_tracing_options));
252 257
253 // Notify all child processes. 258 // Notify all child processes.
254 for (FilterMap::iterator it = filters_.begin(); it != filters_.end(); ++it) { 259 for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin();
255 it->get()->SendEnableMonitoring(filter.ToString(), 260 it != trace_message_filters_.end(); ++it) {
256 base::debug::TraceLog::Options(monitoring_tracing_options)); 261 it->get()->SendEnableMonitoring(category_filter,
262 static_cast<TraceLog::Options>(monitoring_tracing_options));
257 } 263 }
258 264
259 if (!callback.is_null()) 265 if (!callback.is_null())
260 callback.Run(); 266 callback.Run();
261 return true; 267 return true;
262 } 268 }
263 269
264 bool TracingControllerImpl::DisableMonitoring( 270 bool TracingControllerImpl::DisableMonitoring(
265 const DisableMonitoringDoneCallback& callback) { 271 const DisableMonitoringDoneCallback& callback) {
266 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 272 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
267 273
268 if (!can_disable_monitoring()) 274 if (!can_disable_monitoring())
269 return false; 275 return false;
270 is_monitoring_ = false; 276 is_monitoring_ = false;
271 277
272 TraceLog::GetInstance()->SetDisabled(); 278 TraceLog::GetInstance()->SetDisabled();
273 279
274 // Notify all child processes. 280 // Notify all child processes.
275 for (FilterMap::iterator it = filters_.begin(); it != filters_.end(); ++it) { 281 for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin();
282 it != trace_message_filters_.end(); ++it) {
276 it->get()->SendDisableMonitoring(); 283 it->get()->SendDisableMonitoring();
277 } 284 }
278 285
279 if (!callback.is_null()) 286 if (!callback.is_null())
280 callback.Run(); 287 callback.Run();
281 return true; 288 return true;
282 } 289 }
283 290
284 void TracingControllerImpl::GetMonitoringStatus( 291 void TracingControllerImpl::GetMonitoringStatus(
285 bool* out_enabled, 292 bool* out_enabled,
286 base::debug::CategoryFilter* out_filter, 293 std::string* out_category_filter,
287 TracingController::Options* out_options) { 294 TracingController::Options* out_options) {
288 NOTIMPLEMENTED(); 295 NOTIMPLEMENTED();
289 } 296 }
290 297
291 void TracingControllerImpl::CaptureMonitoringSnapshot( 298 bool TracingControllerImpl::CaptureMonitoringSnapshot(
292 const base::FilePath& result_file_path, 299 const base::FilePath& result_file_path,
293 const TracingFileResultCallback& callback) { 300 const TracingFileResultCallback& callback) {
294 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 301 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
295 302
296 if (!can_disable_monitoring()) 303 if (!can_disable_monitoring())
297 return; 304 return false;
298 305
299 if (callback.is_null() && result_file_path.empty()) 306 if (callback.is_null() && result_file_path.empty())
300 return; 307 return false;
301 308
302 pending_capture_monitoring_snapshot_done_callback_ = callback; 309 pending_capture_monitoring_snapshot_done_callback_ = callback;
303 monitoring_snapshot_file_.reset(new ResultFile(result_file_path)); 310 monitoring_snapshot_file_.reset(new ResultFile(result_file_path));
304 311
305 // There could be a case where there are no child processes and filters_
306 // is empty. In that case we can immediately tell the subscriber that tracing
307 // has ended. To avoid recursive calls back to the subscriber, we will just
308 // use the existing asynchronous OnCaptureMonitoringSnapshotAcked code.
309 // Count myself in pending_capture_monitoring_snapshot_ack_count_, 312 // Count myself in pending_capture_monitoring_snapshot_ack_count_,
310 // acked below. 313 // acked below.
311 pending_capture_monitoring_snapshot_ack_count_ = filters_.size() + 1; 314 pending_capture_monitoring_snapshot_ack_count_ =
315 trace_message_filters_.size() + 1;
312 316
313 // Handle special case of zero child processes. 317 // Handle special case of zero child processes by immediately telling the
318 // caller that capturing snapshot has ended. Use asynchronous
319 // OnCaptureMonitoringSnapshotAcked to avoid recursive call back to the
320 // caller.
314 if (pending_capture_monitoring_snapshot_ack_count_ == 1) { 321 if (pending_capture_monitoring_snapshot_ack_count_ == 1) {
315 // Ack asynchronously now, because we don't have any children to wait for. 322 // Ack asynchronously now, because we don't have any children to wait for.
316 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 323 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
317 base::Bind(&TracingControllerImpl::OnCaptureMonitoringSnapshotAcked, 324 base::Bind(&TracingControllerImpl::OnCaptureMonitoringSnapshotAcked,
318 base::Unretained(this))); 325 base::Unretained(this)));
319 } 326 }
320 327
321 // Notify all child processes. 328 // Notify all child processes.
322 for (FilterMap::iterator it = filters_.begin(); it != filters_.end(); ++it) { 329 for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin();
330 it != trace_message_filters_.end(); ++it) {
323 it->get()->SendCaptureMonitoringSnapshot(); 331 it->get()->SendCaptureMonitoringSnapshot();
324 } 332 }
325 333
326 #if defined(OS_ANDROID) 334 #if defined(OS_ANDROID)
327 TraceLog::GetInstance()->AddClockSyncMetadataEvent(); 335 TraceLog::GetInstance()->AddClockSyncMetadataEvent();
328 #endif 336 #endif
337
338 return true;
329 } 339 }
330 340
331 bool TracingControllerImpl::GetTraceBufferPercentFull( 341 bool TracingControllerImpl::GetTraceBufferPercentFull(
332 const GetTraceBufferPercentFullCallback& callback) { 342 const GetTraceBufferPercentFullCallback& callback) {
333 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 343 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
334 344
335 if (!can_get_trace_buffer_percent_full() || callback.is_null()) 345 if (!can_get_trace_buffer_percent_full() || callback.is_null())
336 return false; 346 return false;
337 347
338 pending_trace_buffer_percent_full_callback_ = callback; 348 pending_trace_buffer_percent_full_callback_ = callback;
339 349
340 // Count myself in pending_trace_buffer_percent_full_ack_count_, acked below. 350 // Count myself in pending_trace_buffer_percent_full_ack_count_, acked below.
341 pending_trace_buffer_percent_full_ack_count_ = filters_.size() + 1; 351 pending_trace_buffer_percent_full_ack_count_ =
352 trace_message_filters_.size() + 1;
342 maximum_trace_buffer_percent_full_ = 0; 353 maximum_trace_buffer_percent_full_ = 0;
343 354
344 // Handle special case of zero child processes. 355 // Handle special case of zero child processes.
345 if (pending_trace_buffer_percent_full_ack_count_ == 1) { 356 if (pending_trace_buffer_percent_full_ack_count_ == 1) {
346 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 357 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
347 base::Bind(&TracingControllerImpl::OnTraceBufferPercentFullReply, 358 base::Bind(&TracingControllerImpl::OnTraceBufferPercentFullReply,
348 base::Unretained(this), 359 base::Unretained(this),
349 TraceLog::GetInstance()->GetBufferPercentFull())); 360 TraceLog::GetInstance()->GetBufferPercentFull()));
350 } 361 }
351 362
352 // Notify all child processes. 363 // Notify all child processes.
353 for (FilterMap::iterator it = filters_.begin(); it != filters_.end(); ++it) { 364 for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin();
365 it != trace_message_filters_.end(); ++it) {
354 it->get()->SendGetTraceBufferPercentFull(); 366 it->get()->SendGetTraceBufferPercentFull();
355 } 367 }
356 return true; 368 return true;
357 } 369 }
358 370
359 void TracingControllerImpl::AddFilter(TraceMessageFilter* filter) { 371 bool TracingControllerImpl::SetWatchEvent(
372 const std::string& category_name,
373 const std::string& event_name,
374 const WatchEventCallback& callback) {
375 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
376
377 if (callback.is_null())
378 return false;
379
380 watch_category_name_ = category_name;
381 watch_event_name_ = event_name;
382 watch_event_callback_ = callback;
383
384 TraceLog::GetInstance()->SetWatchEvent(
385 category_name, event_name,
386 base::Bind(&TracingControllerImpl::OnWatchEventMatched,
387 base::Unretained(this)));
388
389 for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin();
390 it != trace_message_filters_.end(); ++it) {
391 it->get()->SendSetWatchEvent(category_name, event_name);
392 }
393 return true;
394 }
395
396 bool TracingControllerImpl::CancelWatchEvent() {
397 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
398
399 if (!can_cancel_watch_event())
400 return false;
401
402 for (TraceMessageFilterMap::iterator it = trace_message_filters_.begin();
403 it != trace_message_filters_.end(); ++it) {
404 it->get()->SendCancelWatchEvent();
405 }
406
407 watch_event_callback_.Reset();
408 return true;
409 }
410
411 void TracingControllerImpl::AddTraceMessageFilter(
412 TraceMessageFilter* trace_message_filter) {
360 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 413 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
361 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 414 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
362 base::Bind(&TracingControllerImpl::AddFilter, base::Unretained(this), 415 base::Bind(&TracingControllerImpl::AddTraceMessageFilter,
363 make_scoped_refptr(filter))); 416 base::Unretained(this),
417 make_scoped_refptr(trace_message_filter)));
364 return; 418 return;
365 } 419 }
366 420
367 filters_.insert(filter); 421 trace_message_filters_.insert(trace_message_filter);
422 if (can_cancel_watch_event()) {
423 trace_message_filter->SendSetWatchEvent(watch_category_name_,
424 watch_event_name_);
425 }
368 if (can_disable_recording()) { 426 if (can_disable_recording()) {
369 std::string cf_str = category_filter_.ToString(); 427 trace_message_filter->SendBeginTracing(
370 filter->SendBeginTracing(cf_str, TraceLog::GetInstance()->trace_options()); 428 TraceLog::GetInstance()->GetCurrentCategoryFilter().ToString(),
429 TraceLog::GetInstance()->trace_options());
371 } 430 }
372 } 431 }
373 432
374 void TracingControllerImpl::RemoveFilter(TraceMessageFilter* filter) { 433 void TracingControllerImpl::RemoveTraceMessageFilter(
434 TraceMessageFilter* trace_message_filter) {
375 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 435 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
376 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 436 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
377 base::Bind(&TracingControllerImpl::RemoveFilter, base::Unretained(this), 437 base::Bind(&TracingControllerImpl::RemoveTraceMessageFilter,
378 make_scoped_refptr(filter))); 438 base::Unretained(this),
439 make_scoped_refptr(trace_message_filter)));
379 return; 440 return;
380 } 441 }
381 442
382 filters_.erase(filter); 443 trace_message_filters_.erase(trace_message_filter);
383 } 444 }
384 445
385 void TracingControllerImpl::OnDisableRecordingAcked( 446 void TracingControllerImpl::OnDisableRecordingAcked(
386 const std::vector<std::string>& known_category_groups) { 447 const std::vector<std::string>& known_category_groups) {
387 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 448 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
388 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 449 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
389 base::Bind(&TracingControllerImpl::OnDisableRecordingAcked, 450 base::Bind(&TracingControllerImpl::OnDisableRecordingAcked,
390 base::Unretained(this), known_category_groups)); 451 base::Unretained(this), known_category_groups));
391 return; 452 return;
392 } 453 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 if (pending_trace_buffer_percent_full_ack_count_ == 1) { 623 if (pending_trace_buffer_percent_full_ack_count_ == 1) {
563 // The last ack represents local trace, so we need to ack it now. Note that 624 // The last ack represents local trace, so we need to ack it now. Note that
564 // this code only executes if there were child processes. 625 // this code only executes if there were child processes.
565 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 626 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
566 base::Bind(&TracingControllerImpl::OnTraceBufferPercentFullReply, 627 base::Bind(&TracingControllerImpl::OnTraceBufferPercentFullReply,
567 base::Unretained(this), 628 base::Unretained(this),
568 TraceLog::GetInstance()->GetBufferPercentFull())); 629 TraceLog::GetInstance()->GetBufferPercentFull()));
569 } 630 }
570 } 631 }
571 632
633 void TracingControllerImpl::OnWatchEventMatched() {
634 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
635 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
636 base::Bind(&TracingControllerImpl::OnWatchEventMatched,
637 base::Unretained(this)));
no sievers 2013/12/05 02:25:58 missing return, i'll upload a patch
638 }
639
640 if (!watch_event_callback_.is_null())
641 watch_event_callback_.Run();
642 }
643
572 } // namespace content 644 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/tracing/tracing_controller_impl.h ('k') | content/browser/tracing/tracing_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698