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="/tracing/base/guid.html"> 9 <link rel="import" href="/tracing/base/range.html"> 10 <link rel="import" href="/tracing/model/event_container.html"> 11 <link rel="import" href="/tracing/model/power_series.html"> 12 13 <script> 14 'use strict'; 15 16 /** 17 * @fileoverview Provides the Device class. 18 */ 19 tr.exportTo('tr.model', function() { 20 21 /** 22 * Device represents the device-level objects in the model. 23 * @constructor 24 * @extends {tr.model.EventContainer} 25 */ 26 function Device(model) { 27 if (!model) 28 throw new Error('Must provide a model.'); 29 30 tr.model.EventContainer.call(this); 31 32 this.powerSeries_ = undefined; 33 this.vSyncTimestamps_ = []; 34 }; 35 36 Device.compare = function(x, y) { 37 return x.guid - y.guid; 38 }; 39 40 Device.prototype = { 41 __proto__: tr.model.EventContainer.prototype, 42 43 compareTo: function(that) { 44 return Device.compare(this, that); 45 }, 46 47 get userFriendlyName() { 48 return 'Device'; 49 }, 50 51 get userFriendlyDetails() { 52 return 'Device'; 53 }, 54 55 get stableId() { 56 return 'Device'; 57 }, 58 59 getSettingsKey: function() { 60 return 'device'; 61 }, 62 63 get powerSeries() { 64 return this.powerSeries_; 65 }, 66 67 set powerSeries(powerSeries) { 68 this.powerSeries_ = powerSeries; 69 }, 70 71 get vSyncTimestamps() { 72 return this.vSyncTimestamps_; 73 }, 74 75 set vSyncTimestamps(value) { 76 this.vSyncTimestamps_ = value; 77 }, 78 79 updateBounds: function() { 80 this.bounds.reset(); 81 82 this.iterateAllChildEventContainers(function(child) { 83 child.updateBounds(); 84 this.bounds.addRange(child.bounds); 85 }, this); 86 }, 87 88 shiftTimestampsForward: function(amount) { 89 this.iterateAllChildEventContainers(function(child) { 90 child.shiftTimestampsForward(amount); 91 }); 92 93 for (var i = 0; i < this.vSyncTimestamps_.length; i++) 94 this.vSyncTimestamps_[i] += amount; 95 }, 96 97 addCategoriesToDict: function(categoriesDict) { 98 }, 99 100 iterateAllEventsInThisContainer: function(eventTypePredicate, 101 callback, opt_this) { 102 }, 103 104 iterateAllChildEventContainers: function(callback, opt_this) { 105 if (this.powerSeries_) 106 callback.call(opt_this, this.powerSeries_); 107 } 108 }; 109 110 return { 111 Device: Device 112 }; 113 }); 114 </script> 115