Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: Source/devtools/front_end/TimelinePowerGraph.js

Issue 212843003: DevTools: Add TimelinePowerGraph (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/TimelinePanel.js ('k') | Source/devtools/scripts/frontend_modules.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698