OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * @constructor |
| 7 * @extends {WebInspector.CountersGraph} |
| 8 * @implements {WebInspector.TimelineModeView} |
| 9 * @param {!WebInspector.TimelineModeViewDelegate} delegate |
| 10 * @param {!WebInspector.TimelineModel} model |
| 11 */ |
| 12 WebInspector.TimelinePowerGraph = function(delegate, model) |
| 13 { |
| 14 WebInspector.CountersGraph.call(this, delegate, model); |
| 15 |
| 16 this._counter = this.createCounter(WebInspector.UIString("Power"), WebInspec
tor.UIString("Power: %.2f\u2009watts"), "#d00"); |
| 17 WebInspector.powerProfiler.addEventListener(WebInspector.PowerProfiler.Event
Types.PowerEventRecorded, this._onRecordAdded, this); |
| 18 } |
| 19 |
| 20 WebInspector.TimelinePowerGraph.prototype = { |
| 21 _onRecordAdded: function(event) |
| 22 { |
| 23 var record = event.data; |
| 24 if (!this._previousRecord) { |
| 25 this._previousRecord = record; |
| 26 return; |
| 27 } |
| 28 |
| 29 // "value" of original PowerEvent means the average power between previo
us sampling to current one. |
| 30 // Here, it is converted to average power between current sampling to ne
xt one. |
| 31 this._counter.appendSample(this._previousRecord.timestamp, record.value)
; |
| 32 this._previousRecord = record; |
| 33 this.scheduleRefresh(); |
| 34 }, |
| 35 |
| 36 /** |
| 37 * @param {!WebInspector.TimelineModel.Record} record |
| 38 */ |
| 39 addRecord: function(record) |
| 40 { |
| 41 }, |
| 42 |
| 43 __proto__: WebInspector.CountersGraph.prototype |
| 44 } |
OLD | NEW |