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

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

Issue 104523002: [DevTools] Add power profiler and power overview in timeline panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase 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.Object}
8 */
9 WebInspector.PowerProfiler = function()
10 {
11 WebInspector.Object.call(this);
12 this._dispatcher = new WebInspector.PowerDispatcher(this);
13 }
14
15 WebInspector.PowerProfiler.EventTypes = {
16 PowerEventRecorded: "PowerEventRecorded"
17 }
18
19 WebInspector.PowerProfiler.prototype = {
20
21 startProfile: function ()
22 {
23 PowerAgent.start();
24 },
25
26 stopProfile: function ()
27 {
28 PowerAgent.end();
29 },
30
31 __proto__: WebInspector.Object.prototype
32 }
33
34 /**
35 * @constructor
36 * @implements {WebInspector.PowerEventDispatcher}
37 */
38 WebInspector.PowerDispatcher = function(profiler)
39 {
40 this._profiler = profiler;
41 InspectorBackend.registerPowerDispatcher(this);
42 }
43
44 WebInspector.PowerDispatcher.prototype = {
45 dataAvailable: function(events)
46 {
47 for (var i in events) {
48 events[i]["startTime"] = events[i].timestamp;
49 delete events[i].timestamp;
50 this._profiler.dispatchEventToListeners(WebInspector.PowerProfiler.E ventTypes.PowerEventRecorded, events[i]);
pfeldman 2014/03/11 12:24:02 It is better to repack data here instead of renami
Pan 2014/03/18 10:16:48 Done.
51 }
52 }
53 }
54
55 /**
56 * @type {!WebInspector.PowerProfiler}
57 */
58 WebInspector.powerProfiler;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698