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

Unified Diff: chrome/browser/resources/gpu_internals/tracing_controller.js

Issue 6691013: Introduce gpu_trace_event for gpu performance analysis. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/gpu_internals/tracing_controller.js
diff --git a/chrome/browser/resources/gpu_internals/tracing_controller.js b/chrome/browser/resources/gpu_internals/tracing_controller.js
index f46e4179dcd055fb36471eb7d6976ab9b0a0bdca..9e1b926c1915be9c8972381e7a365ef52bc81c1f 100644
--- a/chrome/browser/resources/gpu_internals/tracing_controller.js
+++ b/chrome/browser/resources/gpu_internals/tracing_controller.js
@@ -7,20 +7,29 @@
* @fileoverview State and UI for trace data collection.
*/
cr.define('gpu', function() {
+
function TracingController() {
- this.overlay_ = $('gpu-tracing-overlay-template').cloneNode(true);
- this.overlay_.removeAttribute('id');
- cr.ui.decorate(this.overlay_, gpu.Overlay);
+ this.startButton_ = document.createElement('div');
+ this.startButton_.className = 'gpu-tracing-start-button';
+ this.startButton_.textContent = 'Start tracing';
+ this.startButton_.onclick = this.beginTracing.bind(this);
+ document.body.appendChild(this.startButton_);
- this.traceEvents_ = [];
+ this.overlay_ = document.createElement('div');
+ this.overlay_.className = 'gpu-tracing-overlay';
+
+ cr.ui.decorate(this.overlay_, gpu.Overlay);
- var startButton = $('gpu-tracing-start-button-template').cloneNode(true);
- startButton.removeAttribute('id');
- document.body.appendChild(startButton);
- startButton.onclick = this.beginTracing.bind(this);
+ var statusDiv = document.createElement('div');
+ statusDiv.textContent = 'Tracing active.';
+ this.overlay_.appendChild(statusDiv);
- var stopButton = this.overlay_.querySelector('.gpu-tracing-stop-button');
+ var stopButton = document.createElement('button');
stopButton.onclick = this.endTracing.bind(this);
+ stopButton.innerText = 'Stop tracing';
+ this.overlay_.appendChild(stopButton);
+
+ this.traceEvents_ = [];
}
TracingController.prototype = {
@@ -95,15 +104,16 @@ cr.define('gpu', function() {
if (!browserBridge.debugMode) {
chrome.send('beginToEndTracing');
} else {
- var events = getTimelineTestData1();
+ var events = window.getTimelineTestData1 ?
+ getTimelineTestData1() : [];
this.onTraceDataCollected(events);
window.setTimeout(this.onEndTracingComplete.bind(this), 250);
}
},
+
/**
- * Called by the browser when all processes ack tracing
- * having completed.
+ * Called by the browser when all processes complete tracing.
*/
onEndTracingComplete: function() {
this.overlay_.visible = false;

Powered by Google App Engine
This is Rietveld 408576698