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

Side by Side Diff: Source/devtools/front_end/Target.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: 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
1 /* 1 /*
2 * Copyright 2014 The Chromium Authors. All rights reserved. 2 * Copyright 2014 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /** 7 /**
8 * @constructor 8 * @constructor
9 * @extends {Protocol.Agents} 9 * @extends {Protocol.Agents}
10 * @param {!InspectorBackendClass.Connection} connection 10 * @param {!InspectorBackendClass.Connection} connection
11 * @param {function(!WebInspector.Target)=} callback 11 * @param {function(!WebInspector.Target)=} callback
12 */ 12 */
13 WebInspector.Target = function(connection, callback) 13 WebInspector.Target = function(connection, callback)
14 { 14 {
15 Protocol.Agents.call(this, connection.agentsMap()); 15 Protocol.Agents.call(this, connection.agentsMap());
16 this._connection = connection; 16 this._connection = connection;
17 this.isMainFrontend = false; 17 this.isMainFrontend = false;
18 18
19 this.pageAgent().canScreencast(this._initializeCapability.bind(this, "canScr eencast", null)); 19 this.pageAgent().canScreencast(this._initializeCapability.bind(this, "canScr eencast", null));
20
21 if (WebInspector.experimentsSettings.powerProfiler.isEnabled())
22 this.powerAgent().canProfilePower(this._initializeCapability.bind(this, "canProfilePower", null));
23
20 this.workerAgent().canInspectWorkers(this._initializeCapability.bind(this, " isMainFrontend", this._loadedWithCapabilities.bind(this, callback))); 24 this.workerAgent().canInspectWorkers(this._initializeCapability.bind(this, " isMainFrontend", this._loadedWithCapabilities.bind(this, callback)));
21 } 25 }
22 26
23 WebInspector.Target.prototype = { 27 WebInspector.Target.prototype = {
24 28
25 _initializeCapability: function(name, callback, error, result) 29 _initializeCapability: function(name, callback, error, result)
26 { 30 {
27 this[name] = result; 31 this[name] = result;
28 if (!Capabilities[name]) 32 if (!Capabilities[name])
29 Capabilities[name] = result; 33 Capabilities[name] = result;
(...skipping 29 matching lines...) Expand all
59 63
60 //we can't name it domAgent, because it clashes with function, WebInspec tor.DOMAgent should be renamed to DOMModel 64 //we can't name it domAgent, because it clashes with function, WebInspec tor.DOMAgent should be renamed to DOMModel
61 this.domModel = new WebInspector.DOMAgent(); 65 this.domModel = new WebInspector.DOMAgent();
62 if (!WebInspector.domAgent) 66 if (!WebInspector.domAgent)
63 WebInspector.domAgent = this.domModel; 67 WebInspector.domAgent = this.domModel;
64 68
65 this.workerManager = new WebInspector.WorkerManager(this, this.isMainFro ntend); 69 this.workerManager = new WebInspector.WorkerManager(this, this.isMainFro ntend);
66 if (!WebInspector.workerManager) 70 if (!WebInspector.workerManager)
67 WebInspector.workerManager = this.workerManager; 71 WebInspector.workerManager = this.workerManager;
68 72
73 if (this.canProfilePower)
74 WebInspector.powerProfiler = new WebInspector.PowerProfiler();
75
69 if (callback) 76 if (callback)
70 callback(this); 77 callback(this);
71 }, 78 },
72 79
73 /** 80 /**
74 * @override 81 * @override
75 * @param {string} domain 82 * @param {string} domain
76 * @param {!Object} dispatcher 83 * @param {!Object} dispatcher
77 */ 84 */
78 registerDispatcher: function(domain, dispatcher) 85 registerDispatcher: function(domain, dispatcher)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 return this._targets[0]; 154 return this._targets[0];
148 }, 155 },
149 156
150 __proto__: WebInspector.Object.prototype 157 __proto__: WebInspector.Object.prototype
151 } 158 }
152 159
153 /** 160 /**
154 * @type {!WebInspector.TargetManager} 161 * @type {!WebInspector.TargetManager}
155 */ 162 */
156 WebInspector.targetManager; 163 WebInspector.targetManager;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698