| 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.SDKModel} | 7 * @extends {WebInspector.SDKModel} |
| 8 * @param {!WebInspector.Target} target | 8 * @param {!WebInspector.Target} target |
| 9 */ | 9 */ |
| 10 WebInspector.SubTargetsManager = function(target) | 10 WebInspector.SubTargetsManager = function(target) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 this._agent.setAutoAttach(true /* autoAttach */, true /* waitForDebugger
OnStart */, fulfill); | 58 this._agent.setAutoAttach(true /* autoAttach */, true /* waitForDebugger
OnStart */, fulfill); |
| 59 return promise; | 59 return promise; |
| 60 }, | 60 }, |
| 61 | 61 |
| 62 /** | 62 /** |
| 63 * @override | 63 * @override |
| 64 */ | 64 */ |
| 65 dispose: function() | 65 dispose: function() |
| 66 { | 66 { |
| 67 for (var connection of this._connections.values()) | 67 for (var connection of this._connections.values()) |
| 68 connection._close(); | 68 connection.close(); |
| 69 this._connections.clear(); | 69 this._connections.clear(); |
| 70 this._attachedTargets.clear(); | 70 this._attachedTargets.clear(); |
| 71 }, | 71 }, |
| 72 | 72 |
| 73 /** | 73 /** |
| 74 * @param {!TargetAgent.TargetID} targetId | 74 * @param {!TargetAgent.TargetID} targetId |
| 75 */ | 75 */ |
| 76 activateTarget: function(targetId) | 76 activateTarget: function(targetId) |
| 77 { | 77 { |
| 78 this._agent.activateTarget(targetId); | 78 this._agent.activateTarget(targetId); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 this.dispatchEventToListeners(WebInspector.SubTargetsManager.Events.SubT
argetAdded, target); | 187 this.dispatchEventToListeners(WebInspector.SubTargetsManager.Events.SubT
argetAdded, target); |
| 188 }, | 188 }, |
| 189 | 189 |
| 190 /** | 190 /** |
| 191 * @param {string} targetId | 191 * @param {string} targetId |
| 192 */ | 192 */ |
| 193 _detachedFromTarget: function(targetId) | 193 _detachedFromTarget: function(targetId) |
| 194 { | 194 { |
| 195 var connection = this._connections.get(targetId); | 195 var connection = this._connections.get(targetId); |
| 196 if (connection) | 196 if (connection) |
| 197 connection._close(); | 197 connection._reportClosed(); |
| 198 this._connections.delete(targetId); | 198 this._connections.delete(targetId); |
| 199 var target = this._attachedTargets.get(targetId); | 199 var target = this._attachedTargets.get(targetId); |
| 200 this._attachedTargets.delete(targetId); | 200 this._attachedTargets.delete(targetId); |
| 201 this.dispatchEventToListeners(WebInspector.SubTargetsManager.Events.SubT
argetRemoved, target); | 201 this.dispatchEventToListeners(WebInspector.SubTargetsManager.Events.SubT
argetRemoved, target); |
| 202 }, | 202 }, |
| 203 | 203 |
| 204 /** | 204 /** |
| 205 * @param {string} targetId | 205 * @param {string} targetId |
| 206 * @param {string} message | 206 * @param {string} message |
| 207 */ | 207 */ |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 WebInspector.SubTargetConnection.prototype = { | 290 WebInspector.SubTargetConnection.prototype = { |
| 291 /** | 291 /** |
| 292 * @override | 292 * @override |
| 293 * @param {!Object} messageObject | 293 * @param {!Object} messageObject |
| 294 */ | 294 */ |
| 295 sendMessage: function(messageObject) | 295 sendMessage: function(messageObject) |
| 296 { | 296 { |
| 297 this._agent.sendMessageToTarget(this._targetId, JSON.stringify(messageOb
ject)); | 297 this._agent.sendMessageToTarget(this._targetId, JSON.stringify(messageOb
ject)); |
| 298 }, | 298 }, |
| 299 | 299 |
| 300 _close: function() | 300 /** |
| 301 * @override |
| 302 */ |
| 303 forceClose: function() |
| 304 { |
| 305 this._agent.detachFromTarget(this._targetId); |
| 306 }, |
| 307 |
| 308 _reportClosed: function() |
| 301 { | 309 { |
| 302 this.connectionClosed("target_terminated"); | 310 this.connectionClosed("target_terminated"); |
| 303 }, | 311 }, |
| 304 | 312 |
| 305 __proto__: InspectorBackendClass.Connection.prototype | 313 __proto__: InspectorBackendClass.Connection.prototype |
| 306 } | 314 } |
| 307 | 315 |
| 308 /** | 316 /** |
| 309 * @constructor | 317 * @constructor |
| 310 * @param {!TargetAgent.TargetInfo} payload | 318 * @param {!TargetAgent.TargetInfo} payload |
| 311 */ | 319 */ |
| 312 WebInspector.TargetInfo = function(payload) | 320 WebInspector.TargetInfo = function(payload) |
| 313 { | 321 { |
| 314 this.id = payload.targetId; | 322 this.id = payload.targetId; |
| 315 this.url = payload.url; | 323 this.url = payload.url; |
| 316 this.type = payload.type; | 324 this.type = payload.type; |
| 317 if (this.type !== "page" && this.type !== "iframe") { | 325 if (this.type !== "page" && this.type !== "iframe") { |
| 318 this.title = WebInspector.UIString("Worker: %s", this.url); | 326 this.title = WebInspector.UIString("Worker: %s", this.url); |
| 319 this.canActivate = false; | 327 this.canActivate = false; |
| 320 } else { | 328 } else { |
| 321 this.title = payload.title; | 329 this.title = payload.title; |
| 322 this.canActivate = true; | 330 this.canActivate = true; |
| 323 } | 331 } |
| 324 } | 332 } |
| OLD | NEW |