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

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

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

Powered by Google App Engine
This is Rietveld 408576698