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