| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 this._numberOfDebuggerLocationForUILocation = {}; | 430 this._numberOfDebuggerLocationForUILocation = {}; |
| 431 | 431 |
| 432 // Force breakpoint update. | 432 // Force breakpoint update. |
| 433 /** @type {string} */ this._condition; | 433 /** @type {string} */ this._condition; |
| 434 /** @type {boolean} */ this._enabled; | 434 /** @type {boolean} */ this._enabled; |
| 435 /** @type {boolean} */ this._isRemoved; | 435 /** @type {boolean} */ this._isRemoved; |
| 436 /** @type {!WebInspector.UILocation|undefined} */ this._fakePrimaryLocation; | 436 /** @type {!WebInspector.UILocation|undefined} */ this._fakePrimaryLocation; |
| 437 | 437 |
| 438 /** @type {!Map.<!WebInspector.Target, !WebInspector.BreakpointManager.Targe
tBreakpoint>}*/ | 438 /** @type {!Map.<!WebInspector.Target, !WebInspector.BreakpointManager.Targe
tBreakpoint>}*/ |
| 439 this._targetBreakpoints = new Map(); | 439 this._targetBreakpoints = new Map(); |
| 440 this._updateState(condition, enabled); |
| 440 this._breakpointManager._targetManager.observeTargets(this); | 441 this._breakpointManager._targetManager.observeTargets(this); |
| 441 this._updateState(condition, enabled); | |
| 442 } | 442 } |
| 443 | 443 |
| 444 WebInspector.BreakpointManager.Breakpoint.prototype = { | 444 WebInspector.BreakpointManager.Breakpoint.prototype = { |
| 445 /** | 445 /** |
| 446 * @param {!WebInspector.Target} target | 446 * @param {!WebInspector.Target} target |
| 447 */ | 447 */ |
| 448 targetAdded: function(target) | 448 targetAdded: function(target) |
| 449 { | 449 { |
| 450 this._targetBreakpoints.put(target, new WebInspector.BreakpointManager.T
argetBreakpoint(target, this)); | 450 this._targetBreakpoints.put(target, new WebInspector.BreakpointManager.T
argetBreakpoint(target, this)); |
| 451 }, | 451 }, |
| 452 | 452 |
| 453 /** | 453 /** |
| 454 * @param {!WebInspector.Target} target | 454 * @param {!WebInspector.Target} target |
| 455 */ | 455 */ |
| 456 targetRemoved: function(target) | 456 targetRemoved: function(target) |
| 457 { | 457 { |
| 458 this._targetBreakpoints.remove(target)._resetLocations(); | 458 this._targetBreakpoints.remove(target)._dispose(true); |
| 459 }, | 459 }, |
| 460 | 460 |
| 461 /** | 461 /** |
| 462 * @return {string} | 462 * @return {string} |
| 463 */ | 463 */ |
| 464 projectId: function() | 464 projectId: function() |
| 465 { | 465 { |
| 466 return this._projectId; | 466 return this._projectId; |
| 467 }, | 467 }, |
| 468 | 468 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 /** | 588 /** |
| 589 * @param {boolean=} keepInStorage | 589 * @param {boolean=} keepInStorage |
| 590 */ | 590 */ |
| 591 remove: function(keepInStorage) | 591 remove: function(keepInStorage) |
| 592 { | 592 { |
| 593 this._isRemoved = true; | 593 this._isRemoved = true; |
| 594 var removeFromStorage = !keepInStorage; | 594 var removeFromStorage = !keepInStorage; |
| 595 this._removeFakeBreakpointAtPrimaryLocation(); | 595 this._removeFakeBreakpointAtPrimaryLocation(); |
| 596 var targetBreakpoints = this._targetBreakpoints.values(); | 596 var targetBreakpoints = this._targetBreakpoints.values(); |
| 597 for (var i = 0; i < targetBreakpoints.length; ++i) | 597 for (var i = 0; i < targetBreakpoints.length; ++i) |
| 598 targetBreakpoints[i]._removeFromDebugger(); | 598 targetBreakpoints[i]._dispose(); |
| 599 | 599 |
| 600 this._breakpointManager._removeBreakpoint(this, removeFromStorage); | 600 this._breakpointManager._removeBreakpoint(this, removeFromStorage); |
| 601 this._breakpointManager._targetManager.unobserveTargets(this); | 601 this._breakpointManager._targetManager.unobserveTargets(this); |
| 602 }, | 602 }, |
| 603 | 603 |
| 604 _updateInDebugger: function() | 604 _updateInDebugger: function() |
| 605 { | 605 { |
| 606 var targetBreakpoints = this._targetBreakpoints.values(); | 606 var targetBreakpoints = this._targetBreakpoints.values(); |
| 607 for (var i = 0; i < targetBreakpoints.length; ++i) | 607 for (var i = 0; i < targetBreakpoints.length; ++i) |
| 608 targetBreakpoints[i]._updateInDebugger(); | 608 targetBreakpoints[i]._updateInDebugger(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 */ | 654 */ |
| 655 WebInspector.BreakpointManager.TargetBreakpoint = function(target, breakpoint) | 655 WebInspector.BreakpointManager.TargetBreakpoint = function(target, breakpoint) |
| 656 { | 656 { |
| 657 WebInspector.TargetAware.call(this, target); | 657 WebInspector.TargetAware.call(this, target); |
| 658 this._breakpoint = breakpoint; | 658 this._breakpoint = breakpoint; |
| 659 /** @type {!Array.<!WebInspector.Script.Location>} */ | 659 /** @type {!Array.<!WebInspector.Script.Location>} */ |
| 660 this._liveLocations = []; | 660 this._liveLocations = []; |
| 661 | 661 |
| 662 /** @type {!Object.<string, !WebInspector.UILocation>} */ | 662 /** @type {!Object.<string, !WebInspector.UILocation>} */ |
| 663 this._uiLocations = {}; | 663 this._uiLocations = {}; |
| 664 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Debu
ggerWasDisabled, this._removeLocally, this); |
| 665 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Debu
ggerWasEnabled, this._updateInDebugger, this); |
| 666 if (target.debuggerModel.debuggerEnabled()) |
| 667 this._updateInDebugger(); |
| 664 } | 668 } |
| 665 | 669 |
| 666 WebInspector.BreakpointManager.TargetBreakpoint.prototype = { | 670 WebInspector.BreakpointManager.TargetBreakpoint.prototype = { |
| 667 | 671 |
| 668 _resetLocations: function() | 672 _resetLocations: function() |
| 669 { | 673 { |
| 670 var uiLocations = Object.values(this._uiLocations); | 674 var uiLocations = Object.values(this._uiLocations); |
| 671 for (var i = 0; i < uiLocations.length; ++i) | 675 for (var i = 0; i < uiLocations.length; ++i) |
| 672 this._breakpoint._removeUILocation(uiLocations[i]); | 676 this._breakpoint._removeUILocation(uiLocations[i]); |
| 673 | 677 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 var breakpoint = this._breakpoint._breakpointManager.findBreakpoint(uiLo
cation.uiSourceCode, uiLocation.lineNumber, uiLocation.columnNumber); | 774 var breakpoint = this._breakpoint._breakpointManager.findBreakpoint(uiLo
cation.uiSourceCode, uiLocation.lineNumber, uiLocation.columnNumber); |
| 771 if (breakpoint && breakpoint != this._breakpoint) { | 775 if (breakpoint && breakpoint != this._breakpoint) { |
| 772 // location clash | 776 // location clash |
| 773 this._breakpoint.remove(); | 777 this._breakpoint.remove(); |
| 774 return false; | 778 return false; |
| 775 } | 779 } |
| 776 this._liveLocations.push(location.createLiveLocation(this._locationUpdat
ed.bind(this, location))); | 780 this._liveLocations.push(location.createLiveLocation(this._locationUpdat
ed.bind(this, location))); |
| 777 return true; | 781 return true; |
| 778 }, | 782 }, |
| 779 | 783 |
| 784 _removeLocally: function() |
| 785 { |
| 786 this._resetLocations(); |
| 787 if (this._debuggerId) |
| 788 this._didRemoveFromDebugger(); |
| 789 }, |
| 790 |
| 791 /** |
| 792 * @param {boolean=} locally |
| 793 */ |
| 794 _dispose: function(locally) |
| 795 { |
| 796 if (locally) |
| 797 this._removeLocally(); |
| 798 else |
| 799 this._removeFromDebugger(); |
| 800 this.target().debuggerModel.addEventListener(WebInspector.DebuggerModel.
Events.DebuggerWasDisabled, this._removeLocally, this); |
| 801 this.target().debuggerModel.removeEventListener(WebInspector.DebuggerMod
el.Events.DebuggerWasEnabled, this._updateInDebugger, this); |
| 802 }, |
| 803 |
| 780 __proto__: WebInspector.TargetAware.prototype | 804 __proto__: WebInspector.TargetAware.prototype |
| 781 } | 805 } |
| 782 | 806 |
| 783 /** | 807 /** |
| 784 * @constructor | 808 * @constructor |
| 785 * @param {!WebInspector.BreakpointManager} breakpointManager | 809 * @param {!WebInspector.BreakpointManager} breakpointManager |
| 786 * @param {!WebInspector.Setting} setting | 810 * @param {!WebInspector.Setting} setting |
| 787 */ | 811 */ |
| 788 WebInspector.BreakpointManager.Storage = function(breakpointManager, setting) | 812 WebInspector.BreakpointManager.Storage = function(breakpointManager, setting) |
| 789 { | 813 { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 { | 889 { |
| 866 this.sourceFileId = breakpoint._sourceFileId; | 890 this.sourceFileId = breakpoint._sourceFileId; |
| 867 this.lineNumber = breakpoint.lineNumber(); | 891 this.lineNumber = breakpoint.lineNumber(); |
| 868 this.columnNumber = breakpoint.columnNumber(); | 892 this.columnNumber = breakpoint.columnNumber(); |
| 869 this.condition = breakpoint.condition(); | 893 this.condition = breakpoint.condition(); |
| 870 this.enabled = breakpoint.enabled(); | 894 this.enabled = breakpoint.enabled(); |
| 871 } | 895 } |
| 872 | 896 |
| 873 /** @type {!WebInspector.BreakpointManager} */ | 897 /** @type {!WebInspector.BreakpointManager} */ |
| 874 WebInspector.breakpointManager; | 898 WebInspector.breakpointManager; |
| OLD | NEW |