| <!DOCTYPE html> |
| <!-- |
| Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style license that can be |
| found in the LICENSE file. |
| --> |
| |
| <link rel="import" href="/base/guid.html"> |
| <link rel="import" href="/base/range.html"> |
| <link rel="import" href="/model/event_container.html"> |
| |
| <script> |
| 'use strict'; |
| |
| /** |
| * @fileoverview Provides the Device class. |
| */ |
| tr.exportTo('tr.model', function() { |
| |
| /** |
| * Device represents the device-level objects in the model. |
| * @constructor |
| @extends {tr.model.EventContainer} |
| */ |
| function Device(model) { |
| if (!model) |
| throw new Error('Must provide a model.'); |
| |
| tr.model.EventContainer.call(this); |
| |
| this.bounds = new tr.b.Range(); |
| this.guid = tr.b.GUID.allocate(); |
| }; |
| |
| Device.compare = function(x, y) { |
| return x.guid - y.guid; |
| }; |
| |
| Device.prototype = { |
| __proto__: tr.model.EventContainer.prototype, |
| |
| compareTo: function(that) { |
| return Device.compare(this, that); |
| }, |
| |
| get userFriendlyName() { |
| return 'Device'; |
| }, |
| |
| get userFriendlyDetails() { |
| return 'Device'; |
| }, |
| |
| get stableId() { |
| return 'Device'; |
| }, |
| |
| getSettingsKey: function() { |
| return 'device'; |
| }, |
| |
| get counters() { |
| return {}; |
| }, |
| |
| updateBounds: function() { |
| this.bounds.reset(); |
| // TODO(charliea): Update and add bounds for all children counters |
| }, |
| |
| shiftTimestampsForward: function(amount) { |
| // TODO(charliea): Shift timestamps for all children |
| }, |
| |
| addCategoriesToDict: function(categoriesDict) { |
| // TODO(charliea): Add categories for all counters to dictionary |
| }, |
| |
| iterateAllEventsInThisContainer: function(eventTypePredicate, |
| callback, opt_this) { |
| }, |
| |
| iterateAllChildEventContainers: function(callback, opt_this) { |
| // TODO(charliea): Call callback on all child counters |
| } |
| }; |
| |
| return { |
| Device: Device |
| }; |
| }); |
| </script> |