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 TimelineView visualizes GPU_TRACE events using the | 7 * @fileoverview TimelineView 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 function tsRound(ts) { | 11 function tsRound(ts) { |
12 return Math.round(ts * 1000.0) / 1000.0; | 12 return Math.round(ts * 1000.0) / 1000.0; |
13 } | 13 } |
14 function getPadding(text, width) { | 14 function getPadding(text, width) { |
15 width = width || 0; | 15 width = width || 0; |
16 | 16 |
17 if (typeof text != 'string') | 17 if (typeof text != 'string') |
18 text = String(text); | 18 text = String(text); |
19 | 19 |
20 if (text.length >= width) | 20 if (text.length >= width) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 summaryContainer_.appendChild(this.summaryEl_); | 59 summaryContainer_.appendChild(this.summaryEl_); |
60 this.appendChild(this.timelineContainer_); | 60 this.appendChild(this.timelineContainer_); |
61 this.appendChild(summaryContainer_); | 61 this.appendChild(summaryContainer_); |
62 | 62 |
63 this.onSelectionChangedBoundToThis_ = this.onSelectionChanged_.bind(this); | 63 this.onSelectionChangedBoundToThis_ = this.onSelectionChanged_.bind(this); |
64 }, | 64 }, |
65 | 65 |
66 set traceEvents(traceEvents) { | 66 set traceEvents(traceEvents) { |
67 console.log('TimelineView.refresh'); | 67 console.log('TimelineView.refresh'); |
68 this.timelineModel_ = new gpu.TimelineModel(traceEvents); | 68 this.timelineModel_ = new tracing.TimelineModel(traceEvents); |
69 | 69 |
70 // remove old timeline | 70 // remove old timeline |
71 this.timelineContainer_.textContent = ''; | 71 this.timelineContainer_.textContent = ''; |
72 | 72 |
73 // create new timeline if needed | 73 // create new timeline if needed |
74 if (traceEvents.length) { | 74 if (traceEvents.length) { |
75 this.timeline_ = new gpu.Timeline(); | 75 this.timeline_ = new tracing.Timeline(); |
76 this.timeline_.model = this.timelineModel_; | 76 this.timeline_.model = this.timelineModel_; |
77 this.timelineContainer_.appendChild(this.timeline_); | 77 this.timelineContainer_.appendChild(this.timeline_); |
78 this.timeline_.onResize(); | 78 this.timeline_.onResize(); |
79 this.timeline_.addEventListener('selectionChange', | 79 this.timeline_.addEventListener('selectionChange', |
80 this.onSelectionChangedBoundToThis_); | 80 this.onSelectionChangedBoundToThis_); |
81 this.onSelectionChanged_(); | 81 this.onSelectionChanged_(); |
82 } else { | 82 } else { |
83 this.timeline_ = null; | 83 this.timeline_ = null; |
84 } | 84 } |
85 }, | 85 }, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 var oldScrollTop = this.timelineContainer_.scrollTop; | 173 var oldScrollTop = this.timelineContainer_.scrollTop; |
174 this.summaryEl_.textContent = text; | 174 this.summaryEl_.textContent = text; |
175 this.timelineContainer_.scrollTop = oldScrollTop; | 175 this.timelineContainer_.scrollTop = oldScrollTop; |
176 } | 176 } |
177 }; | 177 }; |
178 | 178 |
179 return { | 179 return { |
180 TimelineView: TimelineView | 180 TimelineView: TimelineView |
181 }; | 181 }; |
182 }); | 182 }); |
OLD | NEW |