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 * @fileoverview Interactive visualizaiton of TimelineModel objects | 6 * @fileoverview Interactive visualizaiton of TimelineModel objects |
7 * based loosely on gantt charts. Each thread in the TimelineModel is given a | 7 * based loosely on gantt charts. Each thread in the TimelineModel is given a |
8 * set of TimelineTracks, one per subrow in the thread. The Timeline class | 8 * set of TimelineTracks, one per subrow in the thread. The Timeline class |
9 * acts as a controller, creating the individual tracks, while TimelineTracks | 9 * acts as a controller, creating the individual tracks, while TimelineTracks |
10 * do actual drawing. | 10 * do actual drawing. |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 if (!model) | 201 if (!model) |
202 throw Error('Model cannot be null'); | 202 throw Error('Model cannot be null'); |
203 if (this.model) { | 203 if (this.model) { |
204 throw Error('Cannot set model twice.'); | 204 throw Error('Cannot set model twice.'); |
205 } | 205 } |
206 this.model_ = model; | 206 this.model_ = model; |
207 | 207 |
208 // Create tracks. | 208 // Create tracks. |
209 this.tracks_.textContent = ''; | 209 this.tracks_.textContent = ''; |
210 var threads = model.getAllThreads(); | 210 var threads = model.getAllThreads(); |
| 211 threads.sort(gpu.TimelineThread.compare); |
211 for (var tI = 0; tI < threads.length; tI++) { | 212 for (var tI = 0; tI < threads.length; tI++) { |
212 var thread = threads[tI]; | 213 var thread = threads[tI]; |
213 var track = new TimelineThreadTrack(); | 214 var track = new TimelineThreadTrack(); |
214 track.thread = thread; | 215 track.thread = thread; |
215 track.viewport = this.viewport_; | 216 track.viewport = this.viewport_; |
216 this.tracks_.appendChild(track); | 217 this.tracks_.appendChild(track); |
217 | 218 |
218 } | 219 } |
219 | 220 |
220 this.needsViewportReset_ = true; | 221 this.needsViewportReset_ = true; |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 /** | 578 /** |
578 * The TimelineModel being viewed by the timeline | 579 * The TimelineModel being viewed by the timeline |
579 * @type {TimelineModel} | 580 * @type {TimelineModel} |
580 */ | 581 */ |
581 cr.defineProperty(Timeline, 'model', cr.PropertyKind.JS); | 582 cr.defineProperty(Timeline, 'model', cr.PropertyKind.JS); |
582 | 583 |
583 return { | 584 return { |
584 Timeline: Timeline | 585 Timeline: Timeline |
585 }; | 586 }; |
586 }); | 587 }); |
OLD | NEW |