| Index: third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js b/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
|
| index a3f59f1072088747f07a7b7b362046351bf01561..cc8ee55fe6c41e307f9cc4fe36bcab75148ae69c 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
|
| @@ -410,13 +410,31 @@ SDK.ChildTargetManager = class {
|
| if (Runtime.experiments.isEnabled('autoAttachToCrossProcessSubframes'))
|
| this._targetAgent.setAttachToFrames(true);
|
|
|
| - if (!parentTarget.parentTarget()) {
|
| - this._targetAgent.setRemoteLocations([{host: 'localhost', port: 9229}]);
|
| + if (!parentTarget.parentTarget())
|
| this._targetAgent.setDiscoverTargets(true);
|
| +
|
| + if (Runtime.queryParam('nodeFrontend') && !this._parentTarget.parentTarget()) {
|
| + InspectorFrontendHost.setDevicesUpdatesEnabled(true);
|
| + InspectorFrontendHost.events.addEventListener(
|
| + InspectorFrontendHostAPI.Events.DevicesDiscoveryConfigChanged, this._devicesDiscoveryConfigChanged, this);
|
| }
|
| }
|
|
|
| /**
|
| + * @param {!Common.Event} event
|
| + */
|
| + _devicesDiscoveryConfigChanged(event) {
|
| + var config = /** @type {!Adb.Config} */ (event.data);
|
| + var locations = [];
|
| + for (var address of config.networkDiscoveryConfig) {
|
| + var parts = address.split(':');
|
| + var port = parseInt(parts[1], 10);
|
| + locations.push({host: parts[0] || 'localhost', port: port || 9229});
|
| + }
|
| + this._targetAgent.setRemoteLocations(locations);
|
| + }
|
| +
|
| + /**
|
| * @return {!Promise}
|
| */
|
| suspend() {
|
| @@ -431,6 +449,11 @@ SDK.ChildTargetManager = class {
|
| }
|
|
|
| dispose() {
|
| + if (Runtime.queryParam('nodeFrontend') && !this._parentTarget.parentTarget()) {
|
| + InspectorFrontendHost.events.removeEventListener(
|
| + InspectorFrontendHostAPI.Events.DevicesDiscoveryConfigChanged, this._devicesDiscoveryConfigChanged, this);
|
| + }
|
| +
|
| // TODO(dgozman): this is O(n^2) when removing main target.
|
| var childTargets = this._targetManager._targets.filter(child => child.parentTarget() === this._parentTarget);
|
| for (var child of childTargets)
|
| @@ -508,6 +531,9 @@ SDK.ChildTargetManager = class {
|
| debuggerModel.pause();
|
| }
|
| target.runtimeAgent().runIfWaitingForDebugger();
|
| +
|
| + if (Runtime.queryParam('nodeFrontend'))
|
| + InspectorFrontendHost.bringToFront();
|
| }
|
|
|
| /**
|
|
|