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

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

Issue 12302036: Add a mode flag to the tracing framework. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months 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 (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 "content/browser/tracing/tracing_ui.h" 5 #include "content/browser/tracing/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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), NULL); 365 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), NULL);
366 } 366 }
367 367
368 void TracingMessageHandler::SaveTraceFileComplete() { 368 void TracingMessageHandler::SaveTraceFileComplete() {
369 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 369 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
370 web_ui()->CallJavascriptFunction("tracingController.onSaveTraceFileComplete"); 370 web_ui()->CallJavascriptFunction("tracingController.onSaveTraceFileComplete");
371 } 371 }
372 372
373 void TracingMessageHandler::OnBeginTracing(const base::ListValue* args) { 373 void TracingMessageHandler::OnBeginTracing(const base::ListValue* args) {
374 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 374 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
375 DCHECK_EQ(args->GetSize(), (size_t) 2); 375 DCHECK_GE(args->GetSize(), (size_t) 2);
376 DCHECK_LE(args->GetSize(), (size_t) 3);
376 377
377 bool system_tracing_requested = false; 378 bool system_tracing_requested = false;
378 bool ok = args->GetBoolean(0, &system_tracing_requested); 379 bool ok = args->GetBoolean(0, &system_tracing_requested);
379 DCHECK(ok); 380 DCHECK(ok);
380 381
381 std::string chrome_categories; 382 std::string chrome_categories;
382 ok = args->GetString(1, &chrome_categories); 383 ok = args->GetString(1, &chrome_categories);
383 DCHECK(ok); 384 DCHECK(ok);
384 385
386 int options = base::debug::TraceLog::RECORD_UNTIL_FULL;
387 if (args->GetSize() >= 3) {
388 std::string options_;
389 ok = args->GetString(2, &options_);
390 DCHECK(ok);
391 options = base::debug::TraceLog::TraceOptionsFromString(options_);
392 }
393
385 trace_enabled_ = true; 394 trace_enabled_ = true;
386 // TODO(jbates) This may fail, but that's OK for current use cases. 395 // TODO(jbates) This may fail, but that's OK for current use cases.
387 // Ex: Multiple about:gpu traces can not trace simultaneously. 396 // Ex: Multiple about:gpu traces can not trace simultaneously.
388 // TODO(nduca) send feedback to javascript about whether or not BeginTracing 397 // TODO(nduca) send feedback to javascript about whether or not BeginTracing
389 // was successful. 398 // was successful.
390 TraceController::GetInstance()->BeginTracing(this, chrome_categories); 399 TraceController::GetInstance()->BeginTracing(this, chrome_categories,
400 options);
391 401
392 if (system_tracing_requested) { 402 if (system_tracing_requested) {
393 #if defined(OS_CHROMEOS) 403 #if defined(OS_CHROMEOS)
394 DCHECK(!system_trace_in_progress_); 404 DCHECK(!system_trace_in_progress_);
395 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()-> 405 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()->
396 StartSystemTracing(); 406 StartSystemTracing();
397 // TODO(sleffler) async, could wait for completion 407 // TODO(sleffler) async, could wait for completion
398 system_trace_in_progress_ = true; 408 system_trace_in_progress_ = true;
399 #endif 409 #endif
400 } 410 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 TracingUI::TracingUI(WebUI* web_ui) : WebUIController(web_ui) { 494 TracingUI::TracingUI(WebUI* web_ui) : WebUIController(web_ui) {
485 web_ui->AddMessageHandler(new TracingMessageHandler()); 495 web_ui->AddMessageHandler(new TracingMessageHandler());
486 496
487 // Set up the chrome://tracing/ source. 497 // Set up the chrome://tracing/ source.
488 BrowserContext* browser_context = 498 BrowserContext* browser_context =
489 web_ui->GetWebContents()->GetBrowserContext(); 499 web_ui->GetWebContents()->GetBrowserContext();
490 WebUIDataSource::Add(browser_context, CreateTracingHTMLSource()); 500 WebUIDataSource::Add(browser_context, CreateTracingHTMLSource());
491 } 501 }
492 502
493 } // namespace content 503 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698