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

Side by Side Diff: Source/devtools/front_end/sdk/PowerProfiler.js

Issue 336713005: [Blink] [PowerProfiler] Support accuracy level attribute for power data provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
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.Object} 7 * @extends {WebInspector.Object}
8 */ 8 */
9 WebInspector.PowerProfiler = function() 9 WebInspector.PowerProfiler = function()
10 { 10 {
11 WebInspector.Object.call(this); 11 WebInspector.Object.call(this);
12 this._dispatcher = new WebInspector.PowerDispatcher(this); 12 this._dispatcher = new WebInspector.PowerDispatcher(this);
13 PowerAgent.accuracyLevel(this._onAccuracyLevel.bind(this));
13 } 14 }
14 15
15 WebInspector.PowerProfiler.EventTypes = { 16 WebInspector.PowerProfiler.EventTypes = {
16 PowerEventRecorded: "PowerEventRecorded" 17 PowerEventRecorded: "PowerEventRecorded"
17 } 18 }
18 19
19 WebInspector.PowerProfiler.prototype = { 20 WebInspector.PowerProfiler.prototype = {
20 21
21 startProfile: function () 22 startProfile: function ()
22 { 23 {
23 PowerAgent.start(); 24 PowerAgent.start();
24 }, 25 },
25 26
26 stopProfile: function () 27 stopProfile: function ()
27 { 28 {
28 PowerAgent.end(); 29 PowerAgent.end();
29 }, 30 },
30 31
32 accuracyLevel: function()
33 {
34 return this._accuracyLevel;
35 },
36
37 _onAccuracyLevel: function(error, result) {
38 this._accuracyLevel = "";
39 if (error)
40 return;
yurys 2014/06/17 07:38:39 You might want to print the error in the console t
41 this._accuracyLevel = result;
42 },
43
31 __proto__: WebInspector.Object.prototype 44 __proto__: WebInspector.Object.prototype
32 } 45 }
33 46
34 /** 47 /**
35 * @constructor 48 * @constructor
36 * @implements {PowerAgent.Dispatcher} 49 * @implements {PowerAgent.Dispatcher}
37 */ 50 */
38 WebInspector.PowerDispatcher = function(profiler) 51 WebInspector.PowerDispatcher = function(profiler)
39 { 52 {
40 this._profiler = profiler; 53 this._profiler = profiler;
41 InspectorBackend.registerPowerDispatcher(this); 54 InspectorBackend.registerPowerDispatcher(this);
42 } 55 }
43 56
44 WebInspector.PowerDispatcher.prototype = { 57 WebInspector.PowerDispatcher.prototype = {
45 dataAvailable: function(events) 58 dataAvailable: function(events)
46 { 59 {
47 for (var i = 0; i < events.length; ++i) 60 for (var i = 0; i < events.length; ++i)
48 this._profiler.dispatchEventToListeners(WebInspector.PowerProfiler.E ventTypes.PowerEventRecorded, events[i]); 61 this._profiler.dispatchEventToListeners(WebInspector.PowerProfiler.E ventTypes.PowerEventRecorded, events[i]);
49 } 62 }
50 } 63 }
51 64
52 /** 65 /**
53 * @type {!WebInspector.PowerProfiler} 66 * @type {!WebInspector.PowerProfiler}
54 */ 67 */
55 WebInspector.powerProfiler; 68 WebInspector.powerProfiler;
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | Source/devtools/protocol.json » ('J')

Powered by Google App Engine
This is Rietveld 408576698