Chromium Code Reviews| 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 if (Capabilities.canProfilePower) | |
|
pfeldman
2014/03/26 14:22:54
I don't think you need this check - you only get t
Pan
2014/03/26 14:30:53
yes, thanks, done.
| |
| 18 WebInspector.powerProfiler.addEventListener(WebInspector.PowerProfiler.E ventTypes.PowerEventRecorded, this._onRecordAdded, this); | |
| 19 } | |
| 20 | |
| 21 WebInspector.TimelinePowerGraph.prototype = { | |
| 22 _onRecordAdded: function(event) | |
| 23 { | |
| 24 var record = event.data; | |
| 25 if (!this._previousRecord) { | |
| 26 this._previousRecord = record; | |
| 27 return; | |
| 28 } | |
| 29 | |
| 30 // "value" of original PowerEvent means the average power between previo us sampling to current one. | |
| 31 // Here, it is converted to average power between current sampling to ne xt one. | |
| 32 this._counter.appendSample(this._previousRecord.timestamp, record.value) ; | |
| 33 this._previousRecord = record; | |
| 34 this.scheduleRefresh(); | |
| 35 }, | |
| 36 | |
| 37 /** | |
| 38 * @param {!WebInspector.TimelineModel.Record} record | |
| 39 */ | |
| 40 addRecord: function(record) | |
| 41 { | |
| 42 }, | |
| 43 | |
| 44 __proto__: WebInspector.CountersGraph.prototype | |
| 45 } | |
| OLD | NEW |