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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js

Issue 2864263002: [DevTools] Expose TCP targets config in frontend, use it for Node (Closed)
Patch Set: panel Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
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();
}
/**

Powered by Google App Engine
This is Rietveld 408576698