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

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 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 }
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