| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.SDKObject} | 7 * @extends {WebInspector.SDKObject} |
| 8 * @param {!WebInspector.Target} target | 8 * @param {!WebInspector.Target} target |
| 9 * @implements {BrowserAgent.Dispatcher} | 9 * @implements {BrowserAgent.Dispatcher} |
| 10 */ | 10 */ |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 */ | 38 */ |
| 39 _discoverTargets: function() | 39 _discoverTargets: function() |
| 40 { | 40 { |
| 41 return this.target().browserAgent().setRemoteLocations(this._defaultLoca
tions, this._requestTargets.bind(this)); | 41 return this.target().browserAgent().setRemoteLocations(this._defaultLoca
tions, this._requestTargets.bind(this)); |
| 42 }, | 42 }, |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * @param {?Protocol.Error} error | 45 * @param {?Protocol.Error} error |
| 46 * @return {!Promise} | 46 * @return {!Promise} |
| 47 */ | 47 */ |
| 48 _requestTargets: function (error) | 48 _requestTargets: function(error) |
| 49 { | 49 { |
| 50 if (error) { | 50 if (error) { |
| 51 console.error(error); | 51 console.error(error); |
| 52 return Promise.resolve(); | 52 return Promise.resolve(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 return this.target().browserAgent().getTargets(this._processTargets.bind
(this)); | 55 return this.target().browserAgent().getTargets(this._processTargets.bind
(this)); |
| 56 }, | 56 }, |
| 57 | 57 |
| 58 /** | 58 /** |
| (...skipping 13 matching lines...) Expand all Loading... |
| 72 if (info.type !== "node") | 72 if (info.type !== "node") |
| 73 continue; | 73 continue; |
| 74 newTargetInfos.set(info.targetId, info); | 74 newTargetInfos.set(info.targetId, info); |
| 75 } | 75 } |
| 76 | 76 |
| 77 for (var targetId of this._connectedTargets.keys()) { | 77 for (var targetId of this._connectedTargets.keys()) { |
| 78 if (!newTargetInfos.has(targetId)) { | 78 if (!newTargetInfos.has(targetId)) { |
| 79 var target = this._connectedTargets.get(targetId); | 79 var target = this._connectedTargets.get(targetId); |
| 80 this._connectedTargets.delete(targetId); | 80 this._connectedTargets.delete(targetId); |
| 81 if (target) | 81 if (target) |
| 82 WebInspector.targetManager.removeTarget(target); | 82 target.dispose(); |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 var promises = []; | 86 var promises = []; |
| 87 for (var targetId of newTargetInfos.keys()) { | 87 for (var targetId of newTargetInfos.keys()) { |
| 88 if (this._connectedTargets.has(targetId)) | 88 if (this._connectedTargets.has(targetId)) |
| 89 continue; | 89 continue; |
| 90 | 90 |
| 91 this._connectedTargets.set(targetId, null); | 91 this._connectedTargets.set(targetId, null); |
| 92 promises.push(this.target().browserAgent().attach(targetId, this._cr
eateConnection.bind(this, targetId, newTargetInfos.get(targetId).title))); | 92 promises.push(this.target().browserAgent().attach(targetId, this._cr
eateConnection.bind(this, targetId, newTargetInfos.get(targetId).title))); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 WebInspector.RemoteLocationConnection.prototype = { | 133 WebInspector.RemoteLocationConnection.prototype = { |
| 134 /** | 134 /** |
| 135 * @override | 135 * @override |
| 136 * @param {!Object} messageObject | 136 * @param {!Object} messageObject |
| 137 */ | 137 */ |
| 138 sendMessage: function(messageObject) | 138 sendMessage: function(messageObject) |
| 139 { | 139 { |
| 140 this._agent.sendMessage(this._targetId, JSON.stringify(messageObject)); | 140 this._agent.sendMessage(this._targetId, JSON.stringify(messageObject)); |
| 141 }, | 141 }, |
| 142 | 142 |
| 143 _close: function() | 143 /** |
| 144 * @override |
| 145 */ |
| 146 forceClose: function() |
| 144 { | 147 { |
| 145 this.connectionClosed("node_detached"); | 148 this._agent.detach(this._targetId, () => {}); |
| 146 }, | 149 }, |
| 147 | 150 |
| 148 __proto__: InspectorBackendClass.Connection.prototype | 151 __proto__: InspectorBackendClass.Connection.prototype |
| 149 } | 152 } |
| OLD | NEW |