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

Side by Side Diff: chrome/browser/ui/webui/tracing_ui.cc

Issue 9443020: Use SequencedWorkerPool for disk operations in TraceSubscriberStdio. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
« no previous file with comments | « chrome/browser/automation/automation_provider.cc ('k') | chrome/test/base/tracing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 // WebUIMessageHandler implementation. 67 // WebUIMessageHandler implementation.
68 virtual void RegisterMessages(); 68 virtual void RegisterMessages();
69 69
70 // SelectFileDialog::Listener implementation 70 // SelectFileDialog::Listener implementation
71 virtual void FileSelected(const FilePath& path, int index, void* params); 71 virtual void FileSelected(const FilePath& path, int index, void* params);
72 virtual void FileSelectionCanceled(void* params); 72 virtual void FileSelectionCanceled(void* params);
73 73
74 // TraceSubscriber implementation. 74 // TraceSubscriber implementation.
75 virtual void OnEndTracingComplete(); 75 virtual void OnEndTracingComplete();
76 virtual void OnTraceDataCollected(const std::string& trace_fragment); 76 virtual void OnTraceDataCollected(
77 const scoped_refptr<base::RefCountedString>& trace_fragment);
77 virtual void OnTraceBufferPercentFullReply(float percent_full); 78 virtual void OnTraceBufferPercentFullReply(float percent_full);
78 79
79 // GpuDataManagerObserver implementation. 80 // GpuDataManagerObserver implementation.
80 virtual void OnGpuInfoUpdate() OVERRIDE; 81 virtual void OnGpuInfoUpdate() OVERRIDE;
81 82
82 // Messages. 83 // Messages.
83 void OnTracingControllerInitialized(const ListValue* list); 84 void OnTracingControllerInitialized(const ListValue* list);
84 void OnBeginTracing(const ListValue* list); 85 void OnBeginTracing(const ListValue* list);
85 void OnEndTracingAsync(const ListValue* list); 86 void OnEndTracingAsync(const ListValue* list);
86 void OnBeginRequestBufferPercentFull(const ListValue* list); 87 void OnBeginRequestBufferPercentFull(const ListValue* list);
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 373 }
373 } 374 }
374 375
375 void TracingMessageHandler::OnEndTracingComplete() { 376 void TracingMessageHandler::OnEndTracingComplete() {
376 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 377 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
377 trace_enabled_ = false; 378 trace_enabled_ = false;
378 web_ui()->CallJavascriptFunction("tracingController.onEndTracingComplete"); 379 web_ui()->CallJavascriptFunction("tracingController.onEndTracingComplete");
379 } 380 }
380 381
381 void TracingMessageHandler::OnTraceDataCollected( 382 void TracingMessageHandler::OnTraceDataCollected(
382 const std::string& trace_fragment) { 383 const scoped_refptr<base::RefCountedString>& trace_fragment) {
383 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 384 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
384 385
385 base::debug::TraceResultBuffer::SimpleOutput output; 386 base::debug::TraceResultBuffer::SimpleOutput output;
386 base::debug::TraceResultBuffer trace_buffer; 387 base::debug::TraceResultBuffer trace_buffer;
387 trace_buffer.SetOutputCallback(output.GetCallback()); 388 trace_buffer.SetOutputCallback(output.GetCallback());
388 output.Append("tracingController.onTraceDataCollected("); 389 output.Append("tracingController.onTraceDataCollected(");
389 trace_buffer.Start(); 390 trace_buffer.Start();
390 trace_buffer.AddFragment(trace_fragment); 391 trace_buffer.AddFragment(trace_fragment->data());
391 trace_buffer.Finish(); 392 trace_buffer.Finish();
392 output.Append(");"); 393 output.Append(");");
393 394
394 web_ui()->GetWebContents()->GetRenderViewHost()-> 395 web_ui()->GetWebContents()->GetRenderViewHost()->
395 ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(output.json_output)); 396 ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(output.json_output));
396 } 397 }
397 398
398 void TracingMessageHandler::OnTraceBufferPercentFullReply(float percent_full) { 399 void TracingMessageHandler::OnTraceBufferPercentFullReply(float percent_full) {
399 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 400 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
400 web_ui()->CallJavascriptFunction( 401 web_ui()->CallJavascriptFunction(
(...skipping 10 matching lines...) Expand all
411 // 412 //
412 //////////////////////////////////////////////////////////////////////////////// 413 ////////////////////////////////////////////////////////////////////////////////
413 414
414 TracingUI::TracingUI(content::WebUI* web_ui) : WebUIController(web_ui) { 415 TracingUI::TracingUI(content::WebUI* web_ui) : WebUIController(web_ui) {
415 web_ui->AddMessageHandler(new TracingMessageHandler()); 416 web_ui->AddMessageHandler(new TracingMessageHandler());
416 417
417 // Set up the chrome://tracing/ source. 418 // Set up the chrome://tracing/ source.
418 Profile::FromWebUI(web_ui)-> 419 Profile::FromWebUI(web_ui)->
419 GetChromeURLDataManager()->AddDataSource(CreateTracingHTMLSource()); 420 GetChromeURLDataManager()->AddDataSource(CreateTracingHTMLSource());
420 } 421 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider.cc ('k') | chrome/test/base/tracing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698