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 var targetBreakpoint = this._targetBreakpoints.remove(target); |
| 459 targetBreakpoint._cleanUpAfterDebuggerIsGone(); |
| 460 targetBreakpoint._removeEventListeners(); |
459 }, | 461 }, |
460 | 462 |
461 /** | 463 /** |
462 * @return {string} | 464 * @return {string} |
463 */ | 465 */ |
464 projectId: function() | 466 projectId: function() |
465 { | 467 { |
466 return this._projectId; | 468 return this._projectId; |
467 }, | 469 }, |
468 | 470 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 | 589 |
588 /** | 590 /** |
589 * @param {boolean=} keepInStorage | 591 * @param {boolean=} keepInStorage |
590 */ | 592 */ |
591 remove: function(keepInStorage) | 593 remove: function(keepInStorage) |
592 { | 594 { |
593 this._isRemoved = true; | 595 this._isRemoved = true; |
594 var removeFromStorage = !keepInStorage; | 596 var removeFromStorage = !keepInStorage; |
595 this._removeFakeBreakpointAtPrimaryLocation(); | 597 this._removeFakeBreakpointAtPrimaryLocation(); |
596 var targetBreakpoints = this._targetBreakpoints.values(); | 598 var targetBreakpoints = this._targetBreakpoints.values(); |
597 for (var i = 0; i < targetBreakpoints.length; ++i) | 599 for (var i = 0; i < targetBreakpoints.length; ++i) { |
598 targetBreakpoints[i]._removeFromDebugger(); | 600 targetBreakpoints[i]._removeFromDebugger(); |
| 601 targetBreakpoints[i]._removeEventListeners(); |
| 602 } |
599 | 603 |
600 this._breakpointManager._removeBreakpoint(this, removeFromStorage); | 604 this._breakpointManager._removeBreakpoint(this, removeFromStorage); |
601 this._breakpointManager._targetManager.unobserveTargets(this); | 605 this._breakpointManager._targetManager.unobserveTargets(this); |
602 }, | 606 }, |
603 | 607 |
604 _updateInDebugger: function() | 608 _updateInDebugger: function() |
605 { | 609 { |
606 var targetBreakpoints = this._targetBreakpoints.values(); | 610 var targetBreakpoints = this._targetBreakpoints.values(); |
607 for (var i = 0; i < targetBreakpoints.length; ++i) | 611 for (var i = 0; i < targetBreakpoints.length; ++i) |
608 targetBreakpoints[i]._updateInDebugger(); | 612 targetBreakpoints[i]._updateInDebugger(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 */ | 658 */ |
655 WebInspector.BreakpointManager.TargetBreakpoint = function(target, breakpoint) | 659 WebInspector.BreakpointManager.TargetBreakpoint = function(target, breakpoint) |
656 { | 660 { |
657 WebInspector.TargetAware.call(this, target); | 661 WebInspector.TargetAware.call(this, target); |
658 this._breakpoint = breakpoint; | 662 this._breakpoint = breakpoint; |
659 /** @type {!Array.<!WebInspector.Script.Location>} */ | 663 /** @type {!Array.<!WebInspector.Script.Location>} */ |
660 this._liveLocations = []; | 664 this._liveLocations = []; |
661 | 665 |
662 /** @type {!Object.<string, !WebInspector.UILocation>} */ | 666 /** @type {!Object.<string, !WebInspector.UILocation>} */ |
663 this._uiLocations = {}; | 667 this._uiLocations = {}; |
| 668 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Debu
ggerWasDisabled, this._cleanUpAfterDebuggerIsGone, this); |
| 669 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Debu
ggerWasEnabled, this._updateInDebugger, this); |
| 670 if (target.debuggerModel.debuggerEnabled()) |
| 671 this._updateInDebugger(); |
664 } | 672 } |
665 | 673 |
666 WebInspector.BreakpointManager.TargetBreakpoint.prototype = { | 674 WebInspector.BreakpointManager.TargetBreakpoint.prototype = { |
667 | 675 |
668 _resetLocations: function() | 676 _resetLocations: function() |
669 { | 677 { |
670 var uiLocations = Object.values(this._uiLocations); | 678 var uiLocations = Object.values(this._uiLocations); |
671 for (var i = 0; i < uiLocations.length; ++i) | 679 for (var i = 0; i < uiLocations.length; ++i) |
672 this._breakpoint._removeUILocation(uiLocations[i]); | 680 this._breakpoint._removeUILocation(uiLocations[i]); |
673 | 681 |
(...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); | 778 var breakpoint = this._breakpoint._breakpointManager.findBreakpoint(uiLo
cation.uiSourceCode, uiLocation.lineNumber, uiLocation.columnNumber); |
771 if (breakpoint && breakpoint != this._breakpoint) { | 779 if (breakpoint && breakpoint != this._breakpoint) { |
772 // location clash | 780 // location clash |
773 this._breakpoint.remove(); | 781 this._breakpoint.remove(); |
774 return false; | 782 return false; |
775 } | 783 } |
776 this._liveLocations.push(location.createLiveLocation(this._locationUpdat
ed.bind(this, location))); | 784 this._liveLocations.push(location.createLiveLocation(this._locationUpdat
ed.bind(this, location))); |
777 return true; | 785 return true; |
778 }, | 786 }, |
779 | 787 |
| 788 _cleanUpAfterDebuggerIsGone: function() |
| 789 { |
| 790 this._resetLocations(); |
| 791 if (this._debuggerId) |
| 792 this._didRemoveFromDebugger(); |
| 793 }, |
| 794 |
| 795 _removeEventListeners: function() |
| 796 { |
| 797 this.target().debuggerModel.removeEventListener(WebInspector.DebuggerMod
el.Events.DebuggerWasDisabled, this._cleanUpAfterDebuggerIsGone, this); |
| 798 this.target().debuggerModel.removeEventListener(WebInspector.DebuggerMod
el.Events.DebuggerWasEnabled, this._updateInDebugger, this); |
| 799 }, |
| 800 |
780 __proto__: WebInspector.TargetAware.prototype | 801 __proto__: WebInspector.TargetAware.prototype |
781 } | 802 } |
782 | 803 |
783 /** | 804 /** |
784 * @constructor | 805 * @constructor |
785 * @param {!WebInspector.BreakpointManager} breakpointManager | 806 * @param {!WebInspector.BreakpointManager} breakpointManager |
786 * @param {!WebInspector.Setting} setting | 807 * @param {!WebInspector.Setting} setting |
787 */ | 808 */ |
788 WebInspector.BreakpointManager.Storage = function(breakpointManager, setting) | 809 WebInspector.BreakpointManager.Storage = function(breakpointManager, setting) |
789 { | 810 { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 { | 886 { |
866 this.sourceFileId = breakpoint._sourceFileId; | 887 this.sourceFileId = breakpoint._sourceFileId; |
867 this.lineNumber = breakpoint.lineNumber(); | 888 this.lineNumber = breakpoint.lineNumber(); |
868 this.columnNumber = breakpoint.columnNumber(); | 889 this.columnNumber = breakpoint.columnNumber(); |
869 this.condition = breakpoint.condition(); | 890 this.condition = breakpoint.condition(); |
870 this.enabled = breakpoint.enabled(); | 891 this.enabled = breakpoint.enabled(); |
871 } | 892 } |
872 | 893 |
873 /** @type {!WebInspector.BreakpointManager} */ | 894 /** @type {!WebInspector.BreakpointManager} */ |
874 WebInspector.breakpointManager; | 895 WebInspector.breakpointManager; |
OLD | NEW |