OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/webui/tracing_ui.h" | 5 #include "chrome/browser/ui/webui/tracing_ui.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 } | 395 } |
396 | 396 |
397 void TracingMessageHandler::OnBeginTracing(const ListValue* args) { | 397 void TracingMessageHandler::OnBeginTracing(const ListValue* args) { |
398 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 398 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
399 DCHECK_EQ(args->GetSize(), (size_t) 2); | 399 DCHECK_EQ(args->GetSize(), (size_t) 2); |
400 | 400 |
401 bool system_tracing_requested = false; | 401 bool system_tracing_requested = false; |
402 bool ok = args->GetBoolean(0, &system_tracing_requested); | 402 bool ok = args->GetBoolean(0, &system_tracing_requested); |
403 DCHECK(ok); | 403 DCHECK(ok); |
404 | 404 |
405 std::string chrome_categories; | 405 std::string tag_patterns; |
406 ok = args->GetString(1, &chrome_categories); | 406 ok = args->GetString(1, &tag_patterns); |
407 DCHECK(ok); | 407 DCHECK(ok); |
408 | 408 |
409 trace_enabled_ = true; | 409 trace_enabled_ = true; |
410 // TODO(jbates) This may fail, but that's OK for current use cases. | 410 // TODO(jbates) This may fail, but that's OK for current use cases. |
411 // Ex: Multiple about:gpu traces can not trace simultaneously. | 411 // Ex: Multiple about:gpu traces can not trace simultaneously. |
412 // TODO(nduca) send feedback to javascript about whether or not BeginTracing | 412 // TODO(nduca) send feedback to javascript about whether or not BeginTracing |
413 // was successful. | 413 // was successful. |
414 TraceController::GetInstance()->BeginTracing(this, chrome_categories); | 414 TraceController::GetInstance()->BeginTracing(this, tag_patterns); |
415 | 415 |
416 if (system_tracing_requested) { | 416 if (system_tracing_requested) { |
417 #if defined(OS_CHROMEOS) | 417 #if defined(OS_CHROMEOS) |
418 DCHECK(!system_trace_in_progress_); | 418 DCHECK(!system_trace_in_progress_); |
419 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()-> | 419 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()-> |
420 StartSystemTracing(); | 420 StartSystemTracing(); |
421 // TODO(sleffler) async, could wait for completion | 421 // TODO(sleffler) async, could wait for completion |
422 system_trace_in_progress_ = true; | 422 system_trace_in_progress_ = true; |
423 #endif | 423 #endif |
424 } | 424 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 // | 505 // |
506 //////////////////////////////////////////////////////////////////////////////// | 506 //////////////////////////////////////////////////////////////////////////////// |
507 | 507 |
508 TracingUI::TracingUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 508 TracingUI::TracingUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
509 web_ui->AddMessageHandler(new TracingMessageHandler()); | 509 web_ui->AddMessageHandler(new TracingMessageHandler()); |
510 | 510 |
511 // Set up the chrome://tracing/ source. | 511 // Set up the chrome://tracing/ source. |
512 Profile* profile = Profile::FromWebUI(web_ui); | 512 Profile* profile = Profile::FromWebUI(web_ui); |
513 ChromeURLDataManager::AddDataSource(profile, CreateTracingHTMLSource()); | 513 ChromeURLDataManager::AddDataSource(profile, CreateTracingHTMLSource()); |
514 } | 514 } |
OLD | NEW |