OLD | NEW |
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.canInspectWorkers = false; | 17 this.canInspectWorkers = 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 this.powerAgent().canProfilePower(this._initializeCapability.bind(this, "can
ProfilePower", null)); |
20 this.workerAgent().canInspectWorkers(this._initializeCapability.bind(this, "
canInspectWorkers", this._loadedWithCapabilities.bind(this, callback))); | 21 this.workerAgent().canInspectWorkers(this._initializeCapability.bind(this, "
canInspectWorkers", this._loadedWithCapabilities.bind(this, callback))); |
21 | 22 |
22 // In case of loading as a web page with no bindings / harness, kick off ini
tialization manually. | 23 // In case of loading as a web page with no bindings / harness, kick off ini
tialization manually. |
23 if (InspectorFrontendHost.isStub) { | 24 if (InspectorFrontendHost.isStub) { |
24 // give a chance to add listeners of WebInspector.Target.Events.TargetIs
Ready | 25 // give a chance to add listeners of WebInspector.Target.Events.TargetIs
Ready |
25 setTimeout(this._loadedWithCapabilities.bind(this, callback), 0); | 26 setTimeout(this._loadedWithCapabilities.bind(this, callback), 0); |
26 } | 27 } |
27 } | 28 } |
28 | 29 |
29 WebInspector.Target.prototype = { | 30 WebInspector.Target.prototype = { |
(...skipping 22 matching lines...) Expand all Loading... |
52 WebInspector.debuggerModel = this.debuggerModel; | 53 WebInspector.debuggerModel = this.debuggerModel; |
53 this.runtimeModel = new WebInspector.RuntimeModel(this.resourceTreeModel
); | 54 this.runtimeModel = new WebInspector.RuntimeModel(this.resourceTreeModel
); |
54 WebInspector.runtimeModel = this.runtimeModel; | 55 WebInspector.runtimeModel = this.runtimeModel; |
55 | 56 |
56 //we can't name it domAgent, because it clashes with function, WebInspec
tor.DOMAgent should be renamed to DOMModel | 57 //we can't name it domAgent, because it clashes with function, WebInspec
tor.DOMAgent should be renamed to DOMModel |
57 this._domAgent = new WebInspector.DOMAgent(); | 58 this._domAgent = new WebInspector.DOMAgent(); |
58 WebInspector.domAgent = this._domAgent; | 59 WebInspector.domAgent = this._domAgent; |
59 this.workerManager = new WebInspector.WorkerManager(this.canInspectWorke
rs); | 60 this.workerManager = new WebInspector.WorkerManager(this.canInspectWorke
rs); |
60 WebInspector.workerManager = this.workerManager; | 61 WebInspector.workerManager = this.workerManager; |
61 | 62 |
| 63 if (WebInspector.experimentsSettings.powerTimeline.isEnabled() && this.c
anProfilePower) |
| 64 WebInspector.powerProfiler = new WebInspector.PowerProfiler(); |
| 65 |
62 if (callback) | 66 if (callback) |
63 callback(this); | 67 callback(this); |
64 }, | 68 }, |
65 | 69 |
66 __proto__: Protocol.Agents.prototype | 70 __proto__: Protocol.Agents.prototype |
67 } | 71 } |
68 | 72 |
69 /** | 73 /** |
70 * @constructor | 74 * @constructor |
71 */ | 75 */ |
72 WebInspector.TargetManager = function() | 76 WebInspector.TargetManager = function() |
73 { | 77 { |
74 /** @type {!Array.<!WebInspector.Target>} */ | 78 /** @type {!Array.<!WebInspector.Target>} */ |
75 this._targets = []; | 79 this._targets = []; |
76 } | 80 } |
77 | 81 |
78 WebInspector.TargetManager.prototype = { | 82 WebInspector.TargetManager.prototype = { |
79 | 83 |
80 /** | 84 /** |
81 * @param {!InspectorBackendClass.Connection} connection | 85 * @param {!InspectorBackendClass.Connection} connection |
82 * @param {function(!WebInspector.Target)=} callback | 86 * @param {function(!WebInspector.Target)=} callback |
83 */ | 87 */ |
84 createTarget: function(connection, callback) | 88 createTarget: function(connection, callback) |
85 { | 89 { |
86 var newTarget = new WebInspector.Target(connection, callback); | 90 var newTarget = new WebInspector.Target(connection, callback); |
87 this._targets.push(newTarget); | 91 this._targets.push(newTarget); |
88 } | 92 } |
89 | 93 |
90 } | 94 } |
OLD | NEW |