Chromium Code Reviews| 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..05a6438b35489eac0e62f9a8f3d9d19e116c1d70 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,7 @@ WebInspector.BreakpointManager.Breakpoint.prototype = { |
| */ |
| targetRemoved: function(target) |
| { |
| - this._targetBreakpoints.remove(target)._resetLocations(); |
| + this._targetBreakpoints.remove(target)._dispose(true); |
| }, |
| /** |
| @@ -595,7 +595,7 @@ WebInspector.BreakpointManager.Breakpoint.prototype = { |
| this._removeFakeBreakpointAtPrimaryLocation(); |
| var targetBreakpoints = this._targetBreakpoints.values(); |
| for (var i = 0; i < targetBreakpoints.length; ++i) |
| - targetBreakpoints[i]._removeFromDebugger(); |
| + targetBreakpoints[i]._dispose(); |
| this._breakpointManager._removeBreakpoint(this, removeFromStorage); |
| this._breakpointManager._targetManager.unobserveTargets(this); |
| @@ -661,6 +661,10 @@ WebInspector.BreakpointManager.TargetBreakpoint = function(target, breakpoint) |
| /** @type {!Object.<string, !WebInspector.UILocation>} */ |
| this._uiLocations = {}; |
| + target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasDisabled, this._removeLocally, this); |
| + target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasEnabled, this._updateInDebugger, this); |
| + if (target.debuggerModel.debuggerEnabled()) |
| + this._updateInDebugger(); |
| } |
| WebInspector.BreakpointManager.TargetBreakpoint.prototype = { |
| @@ -777,6 +781,26 @@ WebInspector.BreakpointManager.TargetBreakpoint.prototype = { |
| return true; |
| }, |
| + _removeLocally: function() |
|
vsevik
2014/06/10 09:16:22
cleanUpAfterDebuggerIsGone
sergeyv
2014/06/10 11:14:37
Done.
|
| + { |
| + this._resetLocations(); |
| + if (this._debuggerId) |
| + this._didRemoveFromDebugger(); |
| + }, |
| + |
| + /** |
| + * @param {boolean=} locally |
| + */ |
| + _dispose: function(locally) |
| + { |
| + if (locally) |
|
vsevik
2014/06/10 09:16:22
Let's call these separately.
sergeyv
2014/06/10 11:14:37
Done.
|
| + this._removeLocally(); |
| + else |
| + this._removeFromDebugger(); |
| + this.target().debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasDisabled, this._removeLocally, this); |
|
vsevik
2014/06/10 09:16:22
removeEve..
sergeyv
2014/06/10 11:14:37
Done.
|
| + this.target().debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.DebuggerWasEnabled, this._updateInDebugger, this); |
| + }, |
| + |
| __proto__: WebInspector.TargetAware.prototype |
| } |