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 {string} name | 10 * @param {string} name |
(...skipping 29 matching lines...) Expand all Loading... |
40 CanScreencast: "CanScreencast", | 40 CanScreencast: "CanScreencast", |
41 HasTouchInputs: "HasTouchInputs", | 41 HasTouchInputs: "HasTouchInputs", |
42 CanProfilePower: "CanProfilePower", | 42 CanProfilePower: "CanProfilePower", |
43 CanInspectWorkers: "CanInspectWorkers", | 43 CanInspectWorkers: "CanInspectWorkers", |
44 CanEmulate: "CanEmulate" | 44 CanEmulate: "CanEmulate" |
45 } | 45 } |
46 | 46 |
47 WebInspector.Target._nextId = 1; | 47 WebInspector.Target._nextId = 1; |
48 | 48 |
49 WebInspector.Target.prototype = { | 49 WebInspector.Target.prototype = { |
| 50 suspend: function() |
| 51 { |
| 52 if (!Runtime.experiments.isEnabled("disableAgentsWhenProfile")) { |
| 53 this.debuggerModel.asyncStackTracesStateChanged(); |
| 54 return; |
| 55 } |
| 56 this.debuggerModel.suspendModel(); |
| 57 this.cssModel.suspendModel(); |
| 58 this.domModel.suspendModel(); |
| 59 }, |
| 60 |
| 61 resume: function() |
| 62 { |
| 63 if (Runtime.experiments.isEnabled("disableAgentsWhenProfile")) { |
| 64 this.domModel.resumeModel(); |
| 65 this.cssModel.resumeModel(); |
| 66 this.debuggerModel.resumeModel(); |
| 67 } else { |
| 68 this.debuggerModel.asyncStackTracesStateChanged(); |
| 69 } |
| 70 }, |
50 | 71 |
51 /** | 72 /** |
52 * @return {number} | 73 * @return {number} |
53 */ | 74 */ |
54 id: function() | 75 id: function() |
55 { | 76 { |
56 return this._id; | 77 return this._id; |
57 }, | 78 }, |
58 | 79 |
59 /** | 80 /** |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 */ | 289 */ |
269 WebInspector.TargetManager = function() | 290 WebInspector.TargetManager = function() |
270 { | 291 { |
271 WebInspector.Object.call(this); | 292 WebInspector.Object.call(this); |
272 /** @type {!Array.<!WebInspector.Target>} */ | 293 /** @type {!Array.<!WebInspector.Target>} */ |
273 this._targets = []; | 294 this._targets = []; |
274 /** @type {!Array.<!WebInspector.TargetManager.Observer>} */ | 295 /** @type {!Array.<!WebInspector.TargetManager.Observer>} */ |
275 this._observers = []; | 296 this._observers = []; |
276 /** @type {!Object.<string, !Array.<{modelClass: !Function, thisObject: (!Ob
ject|undefined), listener: function(!WebInspector.Event)}>>} */ | 297 /** @type {!Object.<string, !Array.<{modelClass: !Function, thisObject: (!Ob
ject|undefined), listener: function(!WebInspector.Event)}>>} */ |
277 this._modelListeners = {}; | 298 this._modelListeners = {}; |
| 299 /** @type {boolean} */ |
| 300 this._allTargetsSuspended = false; |
278 } | 301 } |
279 | 302 |
280 WebInspector.TargetManager.Events = { | 303 WebInspector.TargetManager.Events = { |
281 InspectedURLChanged: "InspectedURLChanged", | 304 InspectedURLChanged: "InspectedURLChanged", |
282 MainFrameNavigated: "MainFrameNavigated", | 305 MainFrameNavigated: "MainFrameNavigated", |
283 Load: "Load", | 306 Load: "Load", |
284 WillReloadPage: "WillReloadPage" | 307 WillReloadPage: "WillReloadPage", |
| 308 SuspendStateChanged: "SuspendStateChanged" |
285 } | 309 } |
286 | 310 |
287 WebInspector.TargetManager.prototype = { | 311 WebInspector.TargetManager.prototype = { |
| 312 suspendAllTargets: function() |
| 313 { |
| 314 console.assert(!this._allTargetsSuspended); |
| 315 if (this._allTargetsSuspended) |
| 316 return; |
| 317 this._allTargetsSuspended = true; |
| 318 this._targets.forEach(function(target) |
| 319 { |
| 320 target.suspend(); |
| 321 }); |
| 322 this.dispatchEventToListeners(WebInspector.TargetManager.Events.SuspendS
tateChanged); |
| 323 }, |
| 324 |
| 325 resumeAllTargets: function() |
| 326 { |
| 327 console.assert(this._allTargetsSuspended); |
| 328 if (!this._allTargetsSuspended) |
| 329 return; |
| 330 this._allTargetsSuspended = false; |
| 331 this._targets.forEach(function(target) |
| 332 { |
| 333 target.resume(); |
| 334 }); |
| 335 this.dispatchEventToListeners(WebInspector.TargetManager.Events.SuspendS
tateChanged); |
| 336 }, |
| 337 |
| 338 /** |
| 339 * @return {boolean} |
| 340 */ |
| 341 allTargetsSuspended: function() |
| 342 { |
| 343 return this._allTargetsSuspended; |
| 344 }, |
| 345 |
288 /** | 346 /** |
289 * @return {string} | 347 * @return {string} |
290 */ | 348 */ |
291 inspectedPageURL: function() | 349 inspectedPageURL: function() |
292 { | 350 { |
293 if (!this._targets.length) | 351 if (!this._targets.length) |
294 return ""; | 352 return ""; |
295 | 353 |
296 return this._targets[0].resourceTreeModel.inspectedPageURL(); | 354 return this._targets[0].resourceTreeModel.inspectedPageURL(); |
297 }, | 355 }, |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 /** | 556 /** |
499 * @param {!WebInspector.Target} target | 557 * @param {!WebInspector.Target} target |
500 */ | 558 */ |
501 targetRemoved: function(target) { }, | 559 targetRemoved: function(target) { }, |
502 } | 560 } |
503 | 561 |
504 /** | 562 /** |
505 * @type {!WebInspector.TargetManager} | 563 * @type {!WebInspector.TargetManager} |
506 */ | 564 */ |
507 WebInspector.targetManager = new WebInspector.TargetManager(); | 565 WebInspector.targetManager = new WebInspector.TargetManager(); |
OLD | NEW |