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