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

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

Issue 323503002: Devtools: Support disabling and enabling of debugger in TargetBreakpoints (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix expectations Created 6 years, 6 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
« no previous file with comments | « LayoutTests/inspector/sources/debugger/debugger-disable-enable-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/sdk/BreakpointManager.js
diff --git a/Source/devtools/front_end/sdk/BreakpointManager.js b/Source/devtools/front_end/sdk/BreakpointManager.js
index a6e2a53674f863932ccd416149429af385f7a1e9..fb2e32caf6c1f480e2430729433a100cc4d3e24a 100644
--- a/Source/devtools/front_end/sdk/BreakpointManager.js
+++ b/Source/devtools/front_end/sdk/BreakpointManager.js
@@ -437,8 +437,8 @@ WebInspector.BreakpointManager.Breakpoint = function(breakpointManager, projectI
/** @type {!Map.<!WebInspector.Target, !WebInspector.BreakpointManager.TargetBreakpoint>}*/
this._targetBreakpoints = new Map();
- this._breakpointManager._targetManager.observeTargets(this);
this._updateState(condition, enabled);
+ this._breakpointManager._targetManager.observeTargets(this);
}
WebInspector.BreakpointManager.Breakpoint.prototype = {
@@ -455,7 +455,9 @@ WebInspector.BreakpointManager.Breakpoint.prototype = {
*/
targetRemoved: function(target)
{
- this._targetBreakpoints.remove(target)._resetLocations();
+ var targetBreakpoint = this._targetBreakpoints.remove(target);
+ targetBreakpoint._cleanUpAfterDebuggerIsGone();
+ targetBreakpoint._removeEventListeners();
},
/**
@@ -594,8 +596,10 @@ WebInspector.BreakpointManager.Breakpoint.prototype = {
var removeFromStorage = !keepInStorage;
this._removeFakeBreakpointAtPrimaryLocation();
var targetBreakpoints = this._targetBreakpoints.values();
- for (var i = 0; i < targetBreakpoints.length; ++i)
+ for (var i = 0; i < targetBreakpoints.length; ++i) {
targetBreakpoints[i]._removeFromDebugger();
+ targetBreakpoints[i]._removeEventListeners();
+ }
this._breakpointManager._removeBreakpoint(this, removeFromStorage);
this._breakpointManager._targetManager.unobserveTargets(this);
@@ -661,6 +665,10 @@ WebInspector.BreakpointManager.TargetBreakpoint = function(target, breakpoint)
/** @type {!Object.<string, !WebInspector.UILocation>} */
this._uiLocations = {};
+ target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasDisabled, this._cleanUpAfterDebuggerIsGone, this);
+ target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasEnabled, this._updateInDebugger, this);
+ if (target.debuggerModel.debuggerEnabled())
+ this._updateInDebugger();
}
WebInspector.BreakpointManager.TargetBreakpoint.prototype = {
@@ -777,6 +785,19 @@ WebInspector.BreakpointManager.TargetBreakpoint.prototype = {
return true;
},
+ _cleanUpAfterDebuggerIsGone: function()
+ {
+ this._resetLocations();
+ if (this._debuggerId)
+ this._didRemoveFromDebugger();
+ },
+
+ _removeEventListeners: function()
+ {
+ this.target().debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.DebuggerWasDisabled, this._cleanUpAfterDebuggerIsGone, this);
+ this.target().debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.DebuggerWasEnabled, this._updateInDebugger, this);
+ },
+
__proto__: WebInspector.TargetAware.prototype
}
« no previous file with comments | « LayoutTests/inspector/sources/debugger/debugger-disable-enable-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698