1<!DOCTYPE html>
2<!--
3Copyright (c) 2015 The Chromium Authors. All rights reserved.
4Use of this source code is governed by a BSD-style license that can be
5found in the LICENSE file.
6-->
7
8<link rel="import" href="/tracing/model/event.html">
9<link rel="import" href="/tracing/model/event_registry.html">
10
11<script>
12'use strict';
13
14tr.exportTo('tr.model', function() {
15
16  var Event = tr.model.Event;
17  var EventRegistry = tr.model.EventRegistry;
18
19  /**
20   * A sample that contains a power measurement (in mW).
21   *
22   * @constructor
23   * @extends {Event}
24   */
25  function PowerSample(series, start, power) {
26    Event.call(this);
27
28    this.series_ = series;
29    this.start_ = start;
30    this.power_ = power;
31  }
32
33  PowerSample.prototype = {
34    __proto__: Event.prototype,
35
36    get series() {
37      return this.series_;
38    },
39
40    get start() {
41      return this.start_;
42    },
43
44    set start(value) {
45      this.start_ = value;
46    },
47
48    get power() {
49      return this.power_;
50    },
51
52    set power(value) {
53      this.power_ = value;
54    },
55
56    addBoundsToRange: function(range) {
57      range.addValue(this.start);
58    }
59  };
60
61  EventRegistry.register(
62      PowerSample,
63      {
64        name: 'powerSample',
65        pluralName: 'powerSamples',
66        singleViewElementName: 'tr-ui-a-single-power-sample-sub-view',
67        multiViewElementName: 'tr-ui-a-multi-power-sample-sub-view'
68      });
69
70  return {
71    PowerSample: PowerSample
72  };
73});
74</script>
75