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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), NULL); | 424 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), NULL); |
425 } | 425 } |
426 | 426 |
427 void TracingMessageHandler::SaveTraceFileComplete() { | 427 void TracingMessageHandler::SaveTraceFileComplete() { |
428 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 428 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
429 web_ui()->CallJavascriptFunction("tracingController.onSaveTraceFileComplete"); | 429 web_ui()->CallJavascriptFunction("tracingController.onSaveTraceFileComplete"); |
430 } | 430 } |
431 | 431 |
432 void TracingMessageHandler::OnBeginTracing(const ListValue* args) { | 432 void TracingMessageHandler::OnBeginTracing(const ListValue* args) { |
433 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 433 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
434 DCHECK(args->GetSize() == 1); | 434 DCHECK_EQ(args->GetSize(), (size_t) 2); |
435 | 435 |
436 bool system_tracing_requested = false; | 436 bool system_tracing_requested = false; |
437 bool ok = args->GetBoolean(0, &system_tracing_requested); | 437 bool ok = args->GetBoolean(0, &system_tracing_requested); |
438 DCHECK(ok); | 438 DCHECK(ok); |
439 | 439 |
| 440 std::string chrome_categories; |
| 441 ok = args->GetString(1, &chrome_categories); |
| 442 DCHECK(ok); |
| 443 |
440 trace_enabled_ = true; | 444 trace_enabled_ = true; |
441 // TODO(jbates) This may fail, but that's OK for current use cases. | 445 // TODO(jbates) This may fail, but that's OK for current use cases. |
442 // Ex: Multiple about:gpu traces can not trace simultaneously. | 446 // Ex: Multiple about:gpu traces can not trace simultaneously. |
443 // TODO(nduca) send feedback to javascript about whether or not BeginTracing | 447 // TODO(nduca) send feedback to javascript about whether or not BeginTracing |
444 // was successful. | 448 // was successful. |
445 TraceController::GetInstance()->BeginTracing(this); | 449 TraceController::GetInstance()->BeginTracing(this, chrome_categories); |
446 | 450 |
447 if (system_tracing_requested) { | 451 if (system_tracing_requested) { |
448 #if defined(OS_CHROMEOS) | 452 #if defined(OS_CHROMEOS) |
449 DCHECK(!system_trace_in_progress_); | 453 DCHECK(!system_trace_in_progress_); |
450 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()-> | 454 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()-> |
451 StartSystemTracing(); | 455 StartSystemTracing(); |
452 // TODO(sleffler) async, could wait for completion | 456 // TODO(sleffler) async, could wait for completion |
453 system_trace_in_progress_ = true; | 457 system_trace_in_progress_ = true; |
454 #endif | 458 #endif |
455 } | 459 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 // | 540 // |
537 //////////////////////////////////////////////////////////////////////////////// | 541 //////////////////////////////////////////////////////////////////////////////// |
538 | 542 |
539 TracingUI::TracingUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 543 TracingUI::TracingUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
540 web_ui->AddMessageHandler(new TracingMessageHandler()); | 544 web_ui->AddMessageHandler(new TracingMessageHandler()); |
541 | 545 |
542 // Set up the chrome://tracing/ source. | 546 // Set up the chrome://tracing/ source. |
543 Profile* profile = Profile::FromWebUI(web_ui); | 547 Profile* profile = Profile::FromWebUI(web_ui); |
544 ChromeURLDataManager::AddDataSource(profile, CreateTracingHTMLSource()); | 548 ChromeURLDataManager::AddDataSource(profile, CreateTracingHTMLSource()); |
545 } | 549 } |
OLD | NEW |