Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Unified Diff: Source/devtools/front_end/sdk/Target.js

Issue 614323003: DevTools: enable by default disableAgentsWhenProfile experiment (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: small change Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/sdk/Target.js
diff --git a/Source/devtools/front_end/sdk/Target.js b/Source/devtools/front_end/sdk/Target.js
index 904255f07090ba22a13acd14d2c8d70461de79f9..40b62e8f3648e26c94a2e84910d47a3c9bc7e7b7 100644
--- a/Source/devtools/front_end/sdk/Target.js
+++ b/Source/devtools/front_end/sdk/Target.js
@@ -47,6 +47,23 @@ WebInspector.Target.Capabilities = {
WebInspector.Target._nextId = 1;
WebInspector.Target.prototype = {
+ suspend: function()
+ {
+ 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.
+ if (!Runtime.experiments.isEnabled("disableAgentsWhenProfile"))
+ return;
+ this.cssModel.suspendModel();
+ this.domModel.suspendModel();
+ },
+
+ resume: function()
+ {
+ if (Runtime.experiments.isEnabled("disableAgentsWhenProfile")) {
+ this.domModel.resumeModel();
+ this.cssModel.resumeModel();
+ }
+ this.debuggerModel.resumeModel();
+ },
/**
* @return {number}
@@ -272,16 +289,51 @@ WebInspector.TargetManager = function()
this._observers = [];
/** @type {!Object.<string, !Array.<{modelClass: !Function, thisObject: (!Object|undefined), listener: function(!WebInspector.Event)}>>} */
this._modelListeners = {};
+ /** @type {boolean} */
+ this._targetsSuspended = false;
}
WebInspector.TargetManager.Events = {
InspectedURLChanged: "InspectedURLChanged",
MainFrameNavigated: "MainFrameNavigated",
Load: "Load",
- WillReloadPage: "WillReloadPage"
+ WillReloadPage: "WillReloadPage",
+ SuspendStateChanged: "SuspendStateChanged"
}
WebInspector.TargetManager.prototype = {
+ suspendAllTargets: function()
+ {
+ console.assert(!this._targetsSuspended);
+ if (this._targetsSuspended)
+ return;
+ this._targetsSuspended = true;
+ 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.
+ target.suspend();
+ });
+ this.dispatchEventToListeners(WebInspector.TargetManager.Events.SuspendStateChanged);
+ },
+
+ resumeAllTargets: function()
+ {
+ console.assert(this._targetsSuspended);
+ if (!this._targetsSuspended)
+ return;
+ this._targetsSuspended = false;
+ this._targets.forEach(function(target) {
yurys 2014/10/15 14:07:34 ditto
loislo 2014/10/15 15:38:47 Done.
+ target.resume();
+ });
+ this.dispatchEventToListeners(WebInspector.TargetManager.Events.SuspendStateChanged);
+ },
+
+ /**
+ * @return {boolean}
+ */
+ areTargetsSuspended: function()
+ {
+ return this._targetsSuspended;
+ },
+
/**
* @return {string}
*/

Powered by Google App Engine
This is Rietveld 408576698