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 this.debuggerModel.suspendModel(); | |
yurys
2014/10/15 14:07:34
Why is this model listed before the experiment che
loislo
2014/10/15 15:38:47
Done.
| |
53 if (!Runtime.experiments.isEnabled("disableAgentsWhenProfile")) | |
54 return; | |
55 this.cssModel.suspendModel(); | |
56 this.domModel.suspendModel(); | |
57 }, | |
58 | |
59 resume: function() | |
60 { | |
61 if (Runtime.experiments.isEnabled("disableAgentsWhenProfile")) { | |
62 this.domModel.resumeModel(); | |
63 this.cssModel.resumeModel(); | |
64 } | |
65 this.debuggerModel.resumeModel(); | |
66 }, | |
50 | 67 |
51 /** | 68 /** |
52 * @return {number} | 69 * @return {number} |
53 */ | 70 */ |
54 id: function() | 71 id: function() |
55 { | 72 { |
56 return this._id; | 73 return this._id; |
57 }, | 74 }, |
58 | 75 |
59 /** | 76 /** |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
265 */ | 282 */ |
266 WebInspector.TargetManager = function() | 283 WebInspector.TargetManager = function() |
267 { | 284 { |
268 WebInspector.Object.call(this); | 285 WebInspector.Object.call(this); |
269 /** @type {!Array.<!WebInspector.Target>} */ | 286 /** @type {!Array.<!WebInspector.Target>} */ |
270 this._targets = []; | 287 this._targets = []; |
271 /** @type {!Array.<!WebInspector.TargetManager.Observer>} */ | 288 /** @type {!Array.<!WebInspector.TargetManager.Observer>} */ |
272 this._observers = []; | 289 this._observers = []; |
273 /** @type {!Object.<string, !Array.<{modelClass: !Function, thisObject: (!Ob ject|undefined), listener: function(!WebInspector.Event)}>>} */ | 290 /** @type {!Object.<string, !Array.<{modelClass: !Function, thisObject: (!Ob ject|undefined), listener: function(!WebInspector.Event)}>>} */ |
274 this._modelListeners = {}; | 291 this._modelListeners = {}; |
292 /** @type {boolean} */ | |
293 this._targetsSuspended = false; | |
275 } | 294 } |
276 | 295 |
277 WebInspector.TargetManager.Events = { | 296 WebInspector.TargetManager.Events = { |
278 InspectedURLChanged: "InspectedURLChanged", | 297 InspectedURLChanged: "InspectedURLChanged", |
279 MainFrameNavigated: "MainFrameNavigated", | 298 MainFrameNavigated: "MainFrameNavigated", |
280 Load: "Load", | 299 Load: "Load", |
281 WillReloadPage: "WillReloadPage" | 300 WillReloadPage: "WillReloadPage", |
301 SuspendStateChanged: "SuspendStateChanged" | |
282 } | 302 } |
283 | 303 |
284 WebInspector.TargetManager.prototype = { | 304 WebInspector.TargetManager.prototype = { |
305 suspendAllTargets: function() | |
306 { | |
307 console.assert(!this._targetsSuspended); | |
308 if (this._targetsSuspended) | |
309 return; | |
310 this._targetsSuspended = true; | |
311 this._targets.forEach(function(target) { | |
yurys
2014/10/15 14:07:34
style: { on a separate line.
loislo
2014/10/15 15:38:47
Done.
| |
312 target.suspend(); | |
313 }); | |
314 this.dispatchEventToListeners(WebInspector.TargetManager.Events.SuspendS tateChanged); | |
315 }, | |
316 | |
317 resumeAllTargets: function() | |
318 { | |
319 console.assert(this._targetsSuspended); | |
320 if (!this._targetsSuspended) | |
321 return; | |
322 this._targetsSuspended = false; | |
323 this._targets.forEach(function(target) { | |
yurys
2014/10/15 14:07:34
ditto
loislo
2014/10/15 15:38:47
Done.
| |
324 target.resume(); | |
325 }); | |
326 this.dispatchEventToListeners(WebInspector.TargetManager.Events.SuspendS tateChanged); | |
327 }, | |
328 | |
329 /** | |
330 * @return {boolean} | |
331 */ | |
332 areTargetsSuspended: function() | |
333 { | |
334 return this._targetsSuspended; | |
335 }, | |
336 | |
285 /** | 337 /** |
286 * @return {string} | 338 * @return {string} |
287 */ | 339 */ |
288 inspectedPageURL: function() | 340 inspectedPageURL: function() |
289 { | 341 { |
290 if (!this._targets.length) | 342 if (!this._targets.length) |
291 return ""; | 343 return ""; |
292 | 344 |
293 return this._targets[0].resourceTreeModel.inspectedPageURL(); | 345 return this._targets[0].resourceTreeModel.inspectedPageURL(); |
294 }, | 346 }, |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
495 /** | 547 /** |
496 * @param {!WebInspector.Target} target | 548 * @param {!WebInspector.Target} target |
497 */ | 549 */ |
498 targetRemoved: function(target) { }, | 550 targetRemoved: function(target) { }, |
499 } | 551 } |
500 | 552 |
501 /** | 553 /** |
502 * @type {!WebInspector.TargetManager} | 554 * @type {!WebInspector.TargetManager} |
503 */ | 555 */ |
504 WebInspector.targetManager = new WebInspector.TargetManager(); | 556 WebInspector.targetManager = new WebInspector.TargetManager(); |
OLD | NEW |