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 /** | 7 /** |
8 * @constructor | 8 * @constructor |
9 * @extends {Protocol.Agents} | 9 * @extends {Protocol.Agents} |
10 * @param {!InspectorBackendClass.Connection} connection | 10 * @param {!InspectorBackendClass.Connection} connection |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 createTarget: function(connection, callback) | 250 createTarget: function(connection, callback) |
251 { | 251 { |
252 var target = new WebInspector.Target(connection, callbackWrapper.bind(th
is)); | 252 var target = new WebInspector.Target(connection, callbackWrapper.bind(th
is)); |
253 | 253 |
254 /** | 254 /** |
255 * @this {WebInspector.TargetManager} | 255 * @this {WebInspector.TargetManager} |
256 * @param {!WebInspector.Target} newTarget | 256 * @param {!WebInspector.Target} newTarget |
257 */ | 257 */ |
258 function callbackWrapper(newTarget) | 258 function callbackWrapper(newTarget) |
259 { | 259 { |
260 this._targets.push(newTarget); | 260 this.addTarget(newTarget); |
261 var copy = this._observers; | |
262 for (var i = 0; i < copy.length; ++i) | |
263 copy[i].targetAdded(newTarget); | |
264 | |
265 if (callback) | 261 if (callback) |
266 callback(newTarget); | 262 callback(newTarget); |
267 } | 263 } |
268 }, | 264 }, |
269 | 265 |
270 /** | 266 /** |
| 267 * @param {!WebInspector.Target} newTarget |
| 268 */ |
| 269 addTarget: function(newTarget) |
| 270 { |
| 271 this._targets.push(newTarget); |
| 272 var copy = this._observers; |
| 273 for (var i = 0; i < copy.length; ++i) |
| 274 copy[i].targetAdded(newTarget); |
| 275 }, |
| 276 |
| 277 /** |
| 278 * @param {!WebInspector.Target} target |
| 279 */ |
| 280 removeTarget: function(target) |
| 281 { |
| 282 this._targets.remove(target); |
| 283 var copy = this._observers; |
| 284 for (var i = 0; i < copy.length; ++i) |
| 285 copy[i].targetRemoved(target); |
| 286 }, |
| 287 |
| 288 /** |
271 * @return {!Array.<!WebInspector.Target>} | 289 * @return {!Array.<!WebInspector.Target>} |
272 */ | 290 */ |
273 targets: function() | 291 targets: function() |
274 { | 292 { |
275 return this._targets; | 293 return this._targets; |
276 }, | 294 }, |
277 | 295 |
278 /** | 296 /** |
279 * @return {?WebInspector.Target} | 297 * @return {?WebInspector.Target} |
280 */ | 298 */ |
(...skipping 19 matching lines...) Expand all Loading... |
300 /** | 318 /** |
301 * @param {!WebInspector.Target} target | 319 * @param {!WebInspector.Target} target |
302 */ | 320 */ |
303 targetRemoved: function(target) { }, | 321 targetRemoved: function(target) { }, |
304 } | 322 } |
305 | 323 |
306 /** | 324 /** |
307 * @type {!WebInspector.TargetManager} | 325 * @type {!WebInspector.TargetManager} |
308 */ | 326 */ |
309 WebInspector.targetManager; | 327 WebInspector.targetManager; |
OLD | NEW |