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

Side by Side Diff: Source/devtools/front_end/sdk/DebuggerModel.js

Issue 614323003: DevTools: enable by default disableAgentsWhenProfile experiment (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: unnecessary line was removed 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 this._scripts = {}; 46 this._scripts = {};
47 /** @type {!StringMap.<!Array.<!WebInspector.Script>>} */ 47 /** @type {!StringMap.<!Array.<!WebInspector.Script>>} */
48 this._scriptsBySourceURL = new StringMap(); 48 this._scriptsBySourceURL = new StringMap();
49 49
50 /** @type {!WebInspector.Object} */ 50 /** @type {!WebInspector.Object} */
51 this._breakpointResolvedEventTarget = new WebInspector.Object(); 51 this._breakpointResolvedEventTarget = new WebInspector.Object();
52 52
53 this._isPausing = false; 53 this._isPausing = false;
54 WebInspector.settings.pauseOnExceptionEnabled.addChangeListener(this._pauseO nExceptionStateChanged, this); 54 WebInspector.settings.pauseOnExceptionEnabled.addChangeListener(this._pauseO nExceptionStateChanged, this);
55 WebInspector.settings.pauseOnCaughtException.addChangeListener(this._pauseOn ExceptionStateChanged, this); 55 WebInspector.settings.pauseOnCaughtException.addChangeListener(this._pauseOn ExceptionStateChanged, this);
56 56 WebInspector.settings.enableAsyncStackTraces.addChangeListener(this.asyncSta ckTracesStateChanged, this);
57 WebInspector.settings.enableAsyncStackTraces.addChangeListener(this._asyncSt ackTracesStateChanged, this); 57 WebInspector.settings.skipStackFramesPattern.addChangeListener(this._applySk ipStackFrameSettings, this);
58 WebInspector.profilingLock().addEventListener(WebInspector.Lock.Events.State Changed, this._profilingStateChanged, this); 58 WebInspector.settings.skipContentScripts.addChangeListener(this._applySkipSt ackFrameSettings, this);
59 59
60 this.enableDebugger(); 60 this.enableDebugger();
61 61
62 WebInspector.settings.skipStackFramesPattern.addChangeListener(this._applySk ipStackFrameSettings, this);
63 WebInspector.settings.skipContentScripts.addChangeListener(this._applySkipSt ackFrameSettings, this);
64 this._applySkipStackFrameSettings(); 62 this._applySkipStackFrameSettings();
65 } 63 }
66 64
67 /** @typedef {{location: ?WebInspector.DebuggerModel.Location, sourceURL: ?strin g, functionName: string, scopeChain: (Array.<!DebuggerAgent.Scope>|null)}} */ 65 /** @typedef {{location: ?WebInspector.DebuggerModel.Location, sourceURL: ?strin g, functionName: string, scopeChain: (Array.<!DebuggerAgent.Scope>|null)}} */
68 WebInspector.DebuggerModel.FunctionDetails; 66 WebInspector.DebuggerModel.FunctionDetails;
69 67
70 /** 68 /**
71 * Keep these in sync with WebCore::ScriptDebugServer 69 * Keep these in sync with WebCore::ScriptDebugServer
72 * 70 *
73 * @enum {string} 71 * @enum {string}
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 return !!this._debuggerEnabled; 108 return !!this._debuggerEnabled;
111 }, 109 },
112 110
113 enableDebugger: function() 111 enableDebugger: function()
114 { 112 {
115 if (this._debuggerEnabled) 113 if (this._debuggerEnabled)
116 return; 114 return;
117 this._agent.enable(); 115 this._agent.enable();
118 this._debuggerEnabled = true; 116 this._debuggerEnabled = true;
119 this._pauseOnExceptionStateChanged(); 117 this._pauseOnExceptionStateChanged();
120 this._asyncStackTracesStateChanged(); 118 this.asyncStackTracesStateChanged();
121 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.Debugger WasEnabled); 119 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.Debugger WasEnabled);
122 }, 120 },
123 121
124 disableDebugger: function() 122 disableDebugger: function()
125 { 123 {
126 if (!this._debuggerEnabled) 124 if (!this._debuggerEnabled)
127 return; 125 return;
128 126
129 this._agent.disable(); 127 this._agent.disable();
130 this._debuggerEnabled = false; 128 this._debuggerEnabled = false;
131 this._isPausing = false; 129 this._isPausing = false;
130 this.asyncStackTracesStateChanged();
132 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.Debugger WasDisabled); 131 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.Debugger WasDisabled);
133 }, 132 },
134 133
135 /** 134 /**
136 * @param {boolean} skip 135 * @param {boolean} skip
137 * @param {boolean=} untilReload 136 * @param {boolean=} untilReload
138 */ 137 */
139 skipAllPauses: function(skip, untilReload) 138 skipAllPauses: function(skip, untilReload)
140 { 139 {
141 if (this._skipAllPausesTimeout) { 140 if (this._skipAllPausesTimeout) {
(...skipping 21 matching lines...) Expand all
163 if (!WebInspector.settings.pauseOnExceptionEnabled.get()) { 162 if (!WebInspector.settings.pauseOnExceptionEnabled.get()) {
164 state = WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseO nExceptions; 163 state = WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseO nExceptions;
165 } else if (WebInspector.settings.pauseOnCaughtException.get()) { 164 } else if (WebInspector.settings.pauseOnCaughtException.get()) {
166 state = WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAll Exceptions; 165 state = WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAll Exceptions;
167 } else { 166 } else {
168 state = WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUnc aughtExceptions; 167 state = WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUnc aughtExceptions;
169 } 168 }
170 this._agent.setPauseOnExceptions(state); 169 this._agent.setPauseOnExceptions(state);
171 }, 170 },
172 171
173 _profilingStateChanged: function() 172 suspendModel: function()
174 { 173 {
175 if (Runtime.experiments.isEnabled("disableAgentsWhenProfile")) { 174 this.disableDebugger();
176 if (WebInspector.profilingLock().isAcquired())
177 this.disableDebugger();
178 else
179 this.enableDebugger();
180 }
181 this._asyncStackTracesStateChanged();
182 }, 175 },
183 176
184 _asyncStackTracesStateChanged: function() 177 resumeModel: function()
178 {
179 this.enableDebugger();
180 },
181
182 asyncStackTracesStateChanged: function()
185 { 183 {
186 const maxAsyncStackChainDepth = 4; 184 const maxAsyncStackChainDepth = 4;
187 var enabled = WebInspector.settings.enableAsyncStackTraces.get() && !Web Inspector.profilingLock().isAcquired(); 185 var enabled = WebInspector.settings.enableAsyncStackTraces.get() && !Web Inspector.targetManager.allTargetsSuspended();
188 this._agent.setAsyncCallStackDepth(enabled ? maxAsyncStackChainDepth : 0 ); 186 this._agent.setAsyncCallStackDepth(enabled ? maxAsyncStackChainDepth : 0 );
189 }, 187 },
190 188
191 stepInto: function() 189 stepInto: function()
192 { 190 {
193 /** 191 /**
194 * @this {WebInspector.DebuggerModel} 192 * @this {WebInspector.DebuggerModel}
195 */ 193 */
196 function callback() 194 function callback()
197 { 195 {
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 { 716 {
719 this._breakpointResolvedEventTarget.removeEventListener(breakpointId, li stener, thisObject); 717 this._breakpointResolvedEventTarget.removeEventListener(breakpointId, li stener, thisObject);
720 }, 718 },
721 719
722 dispose: function() 720 dispose: function()
723 { 721 {
724 WebInspector.settings.pauseOnExceptionEnabled.removeChangeListener(this. _pauseOnExceptionStateChanged, this); 722 WebInspector.settings.pauseOnExceptionEnabled.removeChangeListener(this. _pauseOnExceptionStateChanged, this);
725 WebInspector.settings.pauseOnCaughtException.removeChangeListener(this._ pauseOnExceptionStateChanged, this); 723 WebInspector.settings.pauseOnCaughtException.removeChangeListener(this._ pauseOnExceptionStateChanged, this);
726 WebInspector.settings.skipStackFramesPattern.removeChangeListener(this._ applySkipStackFrameSettings, this); 724 WebInspector.settings.skipStackFramesPattern.removeChangeListener(this._ applySkipStackFrameSettings, this);
727 WebInspector.settings.skipContentScripts.removeChangeListener(this._appl ySkipStackFrameSettings, this); 725 WebInspector.settings.skipContentScripts.removeChangeListener(this._appl ySkipStackFrameSettings, this);
728 WebInspector.settings.enableAsyncStackTraces.removeChangeListener(this._ asyncStackTracesStateChanged, this); 726 WebInspector.settings.enableAsyncStackTraces.removeChangeListener(this.a syncStackTracesStateChanged, this);
729 }, 727 },
730 728
731 __proto__: WebInspector.SDKModel.prototype 729 __proto__: WebInspector.SDKModel.prototype
732 } 730 }
733 731
734 WebInspector.DebuggerEventTypes = { 732 WebInspector.DebuggerEventTypes = {
735 JavaScriptPause: 0, 733 JavaScriptPause: 0,
736 JavaScriptBreakpoint: 1, 734 JavaScriptBreakpoint: 1,
737 NativeBreakpoint: 2 735 NativeBreakpoint: 2
738 }; 736 };
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 return this.target().runtimeModel.createRemoteObject(/** @type {!Runtime Agent.RemoteObject} */(this.auxData)); 1101 return this.target().runtimeModel.createRemoteObject(/** @type {!Runtime Agent.RemoteObject} */(this.auxData));
1104 }, 1102 },
1105 1103
1106 __proto__: WebInspector.SDKObject.prototype 1104 __proto__: WebInspector.SDKObject.prototype
1107 } 1105 }
1108 1106
1109 /** 1107 /**
1110 * @type {!WebInspector.DebuggerModel} 1108 * @type {!WebInspector.DebuggerModel}
1111 */ 1109 */
1112 WebInspector.debuggerModel; 1110 WebInspector.debuggerModel;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698