OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 5 |
6 /** | 6 /** |
7 * @fileoverview State and UI for trace data collection. | 7 * @fileoverview State and UI for trace data collection. |
8 */ | 8 */ |
9 cr.define('gpu', function() { | 9 cr.define('gpu', function() { |
10 | 10 |
11 function TracingController() { | 11 function TracingController() { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 * Called by info_view to finish tracing and update all views. | 98 * Called by info_view to finish tracing and update all views. |
99 */ | 99 */ |
100 endTracing: function() { | 100 endTracing: function() { |
101 if (!this.tracingEnabled_) throw new Error('Tracing not begun.'); | 101 if (!this.tracingEnabled_) throw new Error('Tracing not begun.'); |
102 | 102 |
103 console.log('Finishing trace'); | 103 console.log('Finishing trace'); |
104 if (!browserBridge.debugMode) { | 104 if (!browserBridge.debugMode) { |
105 chrome.send('endTracingAsync'); | 105 chrome.send('endTracingAsync'); |
106 } else { | 106 } else { |
107 var events = window.getTimelineTestData1 ? | 107 var events = window.getTimelineTestData1 ? |
108 getTimelineTestData1() : []; | 108 getTimelineTestData1() : []; |
109 this.onTraceDataCollected(events); | 109 this.onTraceDataCollected(events); |
110 window.setTimeout(this.onEndTracingComplete.bind(this), 250); | 110 window.setTimeout(this.onEndTracingComplete.bind(this), 250); |
111 } | 111 } |
112 }, | 112 }, |
113 | 113 |
114 | 114 |
115 /** | 115 /** |
116 * Called by the browser when all processes complete tracing. | 116 * Called by the browser when all processes complete tracing. |
117 */ | 117 */ |
118 onEndTracingComplete: function() { | 118 onEndTracingComplete: function() { |
119 this.overlay_.visible = false; | 119 this.overlay_.visible = false; |
120 this.tracingEnabled_ = false; | 120 this.tracingEnabled_ = false; |
121 console.log('onEndTracingComplete p1 with ' + | 121 console.log('onEndTracingComplete p1 with ' + |
122 this.traceEvents_.length + ' events.'); | 122 this.traceEvents_.length + ' events.'); |
123 var e = new cr.Event('traceEnded'); | 123 var e = new cr.Event('traceEnded'); |
124 e.events = this.traceEvents_; | 124 e.events = this.traceEvents_; |
125 this.dispatchEvent(e); | 125 this.dispatchEvent(e); |
126 }, | 126 }, |
127 | 127 |
128 selfTest: function() { | 128 selfTest: function() { |
129 this.beginTracing(); | 129 this.beginTracing(); |
130 window.setTimeout(this.endTracing.bind(This), 500); | 130 window.setTimeout(this.endTracing.bind(This), 500); |
131 } | 131 } |
132 }; | 132 }; |
133 return { | 133 return { |
134 TracingController: TracingController | 134 TracingController: TracingController |
135 }; | 135 }; |
136 }); | 136 }); |
137 | 137 |
OLD | NEW |