| OLD | NEW |
| 1 // Copyright (c) 2011 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 ProfilingView visualizes GPU_TRACE events using the | 7 * @fileoverview ProfilingView visualizes TRACE_EVENT events using the |
| 8 * gpu.Timeline component. | 8 * tracing.Timeline component. |
| 9 */ | 9 */ |
| 10 cr.define('gpu', function() { | 10 cr.define('tracing', function() { |
| 11 /** | 11 /** |
| 12 * ProfilingView | 12 * ProfilingView |
| 13 * @constructor | 13 * @constructor |
| 14 * @extends {gpu.Tab} | 14 * @extends {ui.TabPanel} |
| 15 */ | 15 */ |
| 16 ProfilingView = cr.ui.define(cr.ui.TabPanel); | 16 ProfilingView = cr.ui.define(cr.ui.TabPanel); |
| 17 | 17 |
| 18 ProfilingView.prototype = { | 18 ProfilingView.prototype = { |
| 19 __proto__: cr.ui.TabPanel.prototype, | 19 __proto__: cr.ui.TabPanel.prototype, |
| 20 | 20 |
| 21 traceEvents_: [], | 21 traceEvents_: [], |
| 22 | 22 |
| 23 decorate: function() { | 23 decorate: function() { |
| 24 cr.ui.TabPanel.prototype.decorate.apply(this); | 24 cr.ui.TabPanel.prototype.decorate.apply(this); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 }, | 92 }, |
| 93 | 93 |
| 94 onRecordDone_: function() { | 94 onRecordDone_: function() { |
| 95 this.traceEvents_ = tracingController.traceEvents; | 95 this.traceEvents_ = tracingController.traceEvents; |
| 96 this.refresh_(); | 96 this.refresh_(); |
| 97 }, | 97 }, |
| 98 | 98 |
| 99 /////////////////////////////////////////////////////////////////////////// | 99 /////////////////////////////////////////////////////////////////////////// |
| 100 | 100 |
| 101 onSave_: function() { | 101 onSave_: function() { |
| 102 this.overlayEl_ = new gpu.Overlay(); | 102 this.overlayEl_ = new tracing.Overlay(); |
| 103 this.overlayEl_.className = 'profiling-overlay'; | 103 this.overlayEl_.className = 'profiling-overlay'; |
| 104 | 104 |
| 105 var labelEl = document.createElement('div'); | 105 var labelEl = document.createElement('div'); |
| 106 labelEl.className = 'label'; | 106 labelEl.className = 'label'; |
| 107 labelEl.textContent = 'Saving...'; | 107 labelEl.textContent = 'Saving...'; |
| 108 this.overlayEl_.appendChild(labelEl); | 108 this.overlayEl_.appendChild(labelEl); |
| 109 this.overlayEl_.visible = true; | 109 this.overlayEl_.visible = true; |
| 110 | 110 |
| 111 tracingController.beginSaveTraceFile(this.traceEvents_); | 111 tracingController.beginSaveTraceFile(this.traceEvents_); |
| 112 }, | 112 }, |
| 113 | 113 |
| 114 onSaveTraceFileComplete_: function(e) { | 114 onSaveTraceFileComplete_: function(e) { |
| 115 this.overlayEl_.visible = false; | 115 this.overlayEl_.visible = false; |
| 116 this.overlayEl_ = undefined; | 116 this.overlayEl_ = undefined; |
| 117 }, | 117 }, |
| 118 | 118 |
| 119 onSaveTraceFileCanceled_: function(e) { | 119 onSaveTraceFileCanceled_: function(e) { |
| 120 this.overlayEl_.visible = false; | 120 this.overlayEl_.visible = false; |
| 121 this.overlayEl_ = undefined; | 121 this.overlayEl_ = undefined; |
| 122 }, | 122 }, |
| 123 | 123 |
| 124 /////////////////////////////////////////////////////////////////////////// | 124 /////////////////////////////////////////////////////////////////////////// |
| 125 | 125 |
| 126 onLoad_: function() { | 126 onLoad_: function() { |
| 127 this.overlayEl_ = new gpu.Overlay(); | 127 this.overlayEl_ = new tracing.Overlay(); |
| 128 this.overlayEl_.className = 'profiling-overlay'; | 128 this.overlayEl_.className = 'profiling-overlay'; |
| 129 | 129 |
| 130 var labelEl = document.createElement('div'); | 130 var labelEl = document.createElement('div'); |
| 131 labelEl.className = 'label'; | 131 labelEl.className = 'label'; |
| 132 labelEl.textContent = 'Loading...'; | 132 labelEl.textContent = 'Loading...'; |
| 133 this.overlayEl_.appendChild(labelEl); | 133 this.overlayEl_.appendChild(labelEl); |
| 134 this.overlayEl_.visible = true; | 134 this.overlayEl_.visible = true; |
| 135 | 135 |
| 136 tracingController.beginLoadTraceFile(); | 136 tracingController.beginLoadTraceFile(); |
| 137 }, | 137 }, |
| 138 | 138 |
| 139 onLoadTraceFileComplete_: function(e) { | 139 onLoadTraceFileComplete_: function(e) { |
| 140 this.overlayEl_.visible = false; | 140 this.overlayEl_.visible = false; |
| 141 this.overlayEl_ = undefined; | 141 this.overlayEl_ = undefined; |
| 142 | 142 |
| 143 this.traceEvents_ = e.events; | 143 this.traceEvents_ = e.events; |
| 144 this.refresh_(); | 144 this.refresh_(); |
| 145 }, | 145 }, |
| 146 | 146 |
| 147 onLoadTraceFileCanceled_: function(e) { | 147 onLoadTraceFileCanceled_: function(e) { |
| 148 this.overlayEl_.visible = false; | 148 this.overlayEl_.visible = false; |
| 149 this.overlayEl_ = undefined; | 149 this.overlayEl_ = undefined; |
| 150 } | 150 } |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 return { | 153 return { |
| 154 ProfilingView: ProfilingView | 154 ProfilingView: ProfilingView |
| 155 }; | 155 }; |
| 156 }); | 156 }); |
| OLD | NEW |