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 SDK.TargetManager = class extends Common.Object { | 7 SDK.TargetManager = class extends Common.Object { |
8 constructor() { | 8 constructor() { |
9 super(); | 9 super(); |
10 /** @type {!Array.<!SDK.Target>} */ | 10 /** @type {!Array.<!SDK.Target>} */ |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 var resourceTreeModel = target.model(SDK.ResourceTreeModel); | 251 var resourceTreeModel = target.model(SDK.ResourceTreeModel); |
252 if (networkManager && resourceTreeModel) | 252 if (networkManager && resourceTreeModel) |
253 new SDK.NetworkLog(target, resourceTreeModel, networkManager); | 253 new SDK.NetworkLog(target, resourceTreeModel, networkManager); |
254 | 254 |
255 /** @type {!SDK.RuntimeModel} */ | 255 /** @type {!SDK.RuntimeModel} */ |
256 target.runtimeModel = /** @type {!SDK.RuntimeModel} */ (target.model(SDK.Run
timeModel)); | 256 target.runtimeModel = /** @type {!SDK.RuntimeModel} */ (target.model(SDK.Run
timeModel)); |
257 target.model(SDK.DebuggerModel); | 257 target.model(SDK.DebuggerModel); |
258 target.model(SDK.DOMModel); | 258 target.model(SDK.DOMModel); |
259 target.model(SDK.CSSModel); | 259 target.model(SDK.CSSModel); |
260 target.model(SDK.CPUProfilerModel); | 260 target.model(SDK.CPUProfilerModel); |
261 | |
262 target.tracingManager = new SDK.TracingManager(target); | |
263 | |
264 target.model(SDK.ServiceWorkerManager); | 261 target.model(SDK.ServiceWorkerManager); |
265 | 262 |
266 if (target.hasTargetCapability()) | 263 if (target.hasTargetCapability()) |
267 this._childTargetManagers.set(target, new SDK.ChildTargetManager(this, tar
get, resourceTreeModel)); | 264 this._childTargetManagers.set(target, new SDK.ChildTargetManager(this, tar
get, resourceTreeModel)); |
268 | 265 |
269 // Force creation of models which have observers. | 266 // Force creation of models which have observers. |
270 for (var modelClass of this._modelObservers.keys()) | 267 for (var modelClass of this._modelObservers.keys()) |
271 target.model(modelClass); | 268 target.model(modelClass); |
272 this._pendingTargets.delete(target); | 269 this._pendingTargets.delete(target); |
273 | 270 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 this, 'main', Common.UIString('Node'), SDK.Target.Capability.Target, t
his._createMainConnection.bind(this), | 396 this, 'main', Common.UIString('Node'), SDK.Target.Capability.Target, t
his._createMainConnection.bind(this), |
400 null); | 397 null); |
401 target.setInspectedURL('Node'); | 398 target.setInspectedURL('Node'); |
402 this._childTargetManagers.set(target, new SDK.ChildTargetManager(this, tar
get, null)); | 399 this._childTargetManagers.set(target, new SDK.ChildTargetManager(this, tar
get, null)); |
403 Host.userMetrics.actionTaken(Host.UserMetrics.Action.ConnectToNodeJSFromFr
ontend); | 400 Host.userMetrics.actionTaken(Host.UserMetrics.Action.ConnectToNodeJSFromFr
ontend); |
404 return; | 401 return; |
405 } | 402 } |
406 | 403 |
407 var capabilities = SDK.Target.Capability.Browser | SDK.Target.Capability.DOM
| SDK.Target.Capability.JS | | 404 var capabilities = SDK.Target.Capability.Browser | SDK.Target.Capability.DOM
| SDK.Target.Capability.JS | |
408 SDK.Target.Capability.Log | SDK.Target.Capability.Network | SDK.Target.C
apability.Target | | 405 SDK.Target.Capability.Log | SDK.Target.Capability.Network | SDK.Target.C
apability.Target | |
409 SDK.Target.Capability.ScreenCapture; | 406 SDK.Target.Capability.ScreenCapture | SDK.Target.Capability.Tracing; |
410 if (Runtime.queryParam('isSharedWorker')) { | 407 if (Runtime.queryParam('isSharedWorker')) { |
411 capabilities = SDK.Target.Capability.Browser | SDK.Target.Capability.Log |
SDK.Target.Capability.Network | | 408 capabilities = SDK.Target.Capability.Browser | SDK.Target.Capability.Log |
SDK.Target.Capability.Network | |
412 SDK.Target.Capability.Target; | 409 SDK.Target.Capability.Target; |
413 } else if (Runtime.queryParam('v8only')) { | 410 } else if (Runtime.queryParam('v8only')) { |
414 capabilities = SDK.Target.Capability.JS; | 411 capabilities = SDK.Target.Capability.JS; |
415 Host.userMetrics.actionTaken(Host.UserMetrics.Action.ConnectToNodeJSDirect
ly); | 412 Host.userMetrics.actionTaken(Host.UserMetrics.Action.ConnectToNodeJSDirect
ly); |
416 } | 413 } |
417 | 414 |
418 var target = | 415 var target = |
419 this.createTarget('main', Common.UIString('Main'), capabilities, this._c
reateMainConnection.bind(this), null); | 416 this.createTarget('main', Common.UIString('Main'), capabilities, this._c
reateMainConnection.bind(this), null); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 * @param {string} type | 510 * @param {string} type |
514 * @return {number} | 511 * @return {number} |
515 */ | 512 */ |
516 _capabilitiesForType(type) { | 513 _capabilitiesForType(type) { |
517 if (type === 'worker') | 514 if (type === 'worker') |
518 return SDK.Target.Capability.JS | SDK.Target.Capability.Log; | 515 return SDK.Target.Capability.JS | SDK.Target.Capability.Log; |
519 if (type === 'service_worker') | 516 if (type === 'service_worker') |
520 return SDK.Target.Capability.Log | SDK.Target.Capability.Network | SDK.Tar
get.Capability.Target; | 517 return SDK.Target.Capability.Log | SDK.Target.Capability.Network | SDK.Tar
get.Capability.Target; |
521 if (type === 'iframe') { | 518 if (type === 'iframe') { |
522 return SDK.Target.Capability.Browser | SDK.Target.Capability.DOM | SDK.Tar
get.Capability.JS | | 519 return SDK.Target.Capability.Browser | SDK.Target.Capability.DOM | SDK.Tar
get.Capability.JS | |
523 SDK.Target.Capability.Log | SDK.Target.Capability.Network | SDK.Target
.Capability.Target; | 520 SDK.Target.Capability.Log | SDK.Target.Capability.Network | SDK.Target
.Capability.Target | |
| 521 SDK.Target.Capability.Tracing; |
524 } | 522 } |
525 if (type === 'node') | 523 if (type === 'node') |
526 return SDK.Target.Capability.JS; | 524 return SDK.Target.Capability.JS; |
527 return 0; | 525 return 0; |
528 } | 526 } |
529 | 527 |
530 _detachWorkersOnMainFrameNavigated() { | 528 _detachWorkersOnMainFrameNavigated() { |
531 // TODO(dgozman): send these from backend. | 529 // TODO(dgozman): send these from backend. |
532 var idsToDetach = []; | 530 var idsToDetach = []; |
533 for (var target of this._targetManager._targets) { | 531 for (var target of this._targetManager._targets) { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 /** | 700 /** |
703 * @param {!T} model | 701 * @param {!T} model |
704 */ | 702 */ |
705 modelRemoved(model) {}, | 703 modelRemoved(model) {}, |
706 }; | 704 }; |
707 | 705 |
708 /** | 706 /** |
709 * @type {!SDK.TargetManager} | 707 * @type {!SDK.TargetManager} |
710 */ | 708 */ |
711 SDK.targetManager = new SDK.TargetManager(); | 709 SDK.targetManager = new SDK.TargetManager(); |
OLD | NEW |