1 <!DOCTYPE html> 2 <!-- 3 Copyright (c) 2015 The Chromium Authors. All rights reserved. 4 Use of this source code is governed by a BSD-style license that can be 5 found in the LICENSE file. 6 --> 7 8 <link rel="import" href="/ui/base/event_presenter.html"> 9 <link rel="import" href="/ui/tracks/letter_dot_track.html"> 10 <link rel="import" href="/ui/base/color_scheme.html"> 11 <link rel="import" href="/ui/base/ui.html"> 12 13 <script> 14 'use strict'; 15 16 tr.exportTo('tr.ui.tracks', function() { 17 var palette = tr.ui.b.getColorPalette(); 18 19 var startCompare = function(x, y) { return x.start - y.start; } 20 21 /** 22 * Track enabling quick selection of frame slices/events. 23 * @constructor 24 */ 25 var FrameTrack = tr.ui.b.define( 26 'frame-track', tr.ui.tracks.LetterDotTrack); 27 28 FrameTrack.prototype = { 29 __proto__: tr.ui.tracks.LetterDotTrack.prototype, 30 31 decorate: function(viewport) { 32 tr.ui.tracks.LetterDotTrack.prototype.decorate.call(this, viewport); 33 this.heading = 'Frames'; 34 35 this.frames_ = undefined; 36 this.items = undefined; 37 }, 38 39 get frames() { 40 return this.frames_; 41 }, 42 43 set frames(frames) { 44 this.frames_ = frames; 45 if (frames === undefined) 46 return; 47 48 this.frames_ = this.frames_.slice(); 49 this.frames_.sort(startCompare); 50 51 // letter dots 52 this.items = this.frames_.map(function(frame) { 53 return new FrameDot(frame); 54 }); 55 } 56 }; 57 58 /** 59 * @constructor 60 * @extends {LetterDot} 61 */ 62 function FrameDot(frame) { 63 tr.ui.tracks.LetterDot.call(this, frame, 'F', frame.colorId, frame.start); 64 } 65 66 FrameDot.prototype = { 67 __proto__: tr.ui.tracks.LetterDot.prototype 68 }; 69 70 return { 71 FrameTrack: FrameTrack 72 }; 73 }); 74 </script> 75