| 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 16 matching lines...) Expand all Loading... |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @extends {WebInspector.Object} | 33 * @extends {WebInspector.Object} |
| 34 * @implements {WebInspector.TargetManager.Observer} | 34 * @implements {WebInspector.TargetManager.Observer} |
| 35 * @param {?WebInspector.Setting} breakpointsSetting | 35 * @param {?WebInspector.Setting} breakpointsSetting |
| 36 * @param {!WebInspector.Workspace} workspace | 36 * @param {!WebInspector.Workspace} workspace |
| 37 * @param {!WebInspector.NetworkMapping} networkMapping | |
| 38 * @param {!WebInspector.TargetManager} targetManager | 37 * @param {!WebInspector.TargetManager} targetManager |
| 39 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding | 38 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding |
| 40 */ | 39 */ |
| 41 WebInspector.BreakpointManager = function(breakpointsSetting, workspace, network
Mapping, targetManager, debuggerWorkspaceBinding) | 40 WebInspector.BreakpointManager = function(breakpointsSetting, workspace, targetM
anager, debuggerWorkspaceBinding) |
| 42 { | 41 { |
| 43 this._storage = new WebInspector.BreakpointManager.Storage(this, breakpoints
Setting); | 42 this._storage = new WebInspector.BreakpointManager.Storage(this, breakpoints
Setting); |
| 44 this._workspace = workspace; | 43 this._workspace = workspace; |
| 45 this._networkMapping = networkMapping; | |
| 46 this._targetManager = targetManager; | 44 this._targetManager = targetManager; |
| 47 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; | 45 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; |
| 48 | 46 |
| 49 this._breakpointsActive = true; | 47 this._breakpointsActive = true; |
| 50 this._breakpointsForUISourceCode = new Map(); | 48 this._breakpointsForUISourceCode = new Map(); |
| 51 this._breakpointsForPrimaryUISourceCode = new Map(); | 49 this._breakpointsForPrimaryUISourceCode = new Map(); |
| 52 /** @type {!Multimap.<string, !WebInspector.BreakpointManager.Breakpoint>} *
/ | 50 /** @type {!Multimap.<string, !WebInspector.BreakpointManager.Breakpoint>} *
/ |
| 53 this._provisionalBreakpoints = new Multimap(); | 51 this._provisionalBreakpoints = new Multimap(); |
| 54 | 52 |
| 55 this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemove
d, this._projectRemoved, this); | 53 this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemove
d, this._projectRemoved, this); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 77 return sourceFileId + ":" + lineNumber + ":" + columnNumber; | 75 return sourceFileId + ":" + lineNumber + ":" + columnNumber; |
| 78 } | 76 } |
| 79 | 77 |
| 80 WebInspector.BreakpointManager.prototype = { | 78 WebInspector.BreakpointManager.prototype = { |
| 81 /** | 79 /** |
| 82 * @param {!WebInspector.UISourceCode} uiSourceCode | 80 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 83 * @return {string} | 81 * @return {string} |
| 84 */ | 82 */ |
| 85 _sourceFileId: function(uiSourceCode) | 83 _sourceFileId: function(uiSourceCode) |
| 86 { | 84 { |
| 87 var networkURL = this._networkMapping.networkURL(uiSourceCode) | 85 // TODO(lushnikov): _sourceFileId is not needed any more. |
| 88 if (!networkURL) | |
| 89 return ""; | |
| 90 return uiSourceCode.url(); | 86 return uiSourceCode.url(); |
| 91 }, | 87 }, |
| 92 | 88 |
| 93 /** | 89 /** |
| 94 * @override | 90 * @override |
| 95 * @param {!WebInspector.Target} target | 91 * @param {!WebInspector.Target} target |
| 96 */ | 92 */ |
| 97 targetAdded: function(target) | 93 targetAdded: function(target) |
| 98 { | 94 { |
| 99 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); | 95 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 WebInspector.BreakpointManager.Breakpoint.prototype = { | 499 WebInspector.BreakpointManager.Breakpoint.prototype = { |
| 504 /** | 500 /** |
| 505 * @override | 501 * @override |
| 506 * @param {!WebInspector.Target} target | 502 * @param {!WebInspector.Target} target |
| 507 */ | 503 */ |
| 508 targetAdded: function(target) | 504 targetAdded: function(target) |
| 509 { | 505 { |
| 510 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); | 506 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); |
| 511 if (!debuggerModel) | 507 if (!debuggerModel) |
| 512 return; | 508 return; |
| 513 var networkMapping = this._breakpointManager._networkMapping; | |
| 514 var debuggerWorkspaceBinding = this._breakpointManager._debuggerWorkspac
eBinding; | 509 var debuggerWorkspaceBinding = this._breakpointManager._debuggerWorkspac
eBinding; |
| 515 this._targetBreakpoints.set(target, new WebInspector.BreakpointManager.T
argetBreakpoint(debuggerModel, this, networkMapping, debuggerWorkspaceBinding)); | 510 this._targetBreakpoints.set(target, new WebInspector.BreakpointManager.T
argetBreakpoint(debuggerModel, this, debuggerWorkspaceBinding)); |
| 516 }, | 511 }, |
| 517 | 512 |
| 518 /** | 513 /** |
| 519 * @override | 514 * @override |
| 520 * @param {!WebInspector.Target} target | 515 * @param {!WebInspector.Target} target |
| 521 */ | 516 */ |
| 522 targetRemoved: function(target) | 517 targetRemoved: function(target) |
| 523 { | 518 { |
| 524 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); | 519 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); |
| 525 if (!debuggerModel) | 520 if (!debuggerModel) |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 for (var i = 0; i < targetBreakpoints.length; ++i) | 720 for (var i = 0; i < targetBreakpoints.length; ++i) |
| 726 targetBreakpoints[i]._resetLocations(); | 721 targetBreakpoints[i]._resetLocations(); |
| 727 } | 722 } |
| 728 } | 723 } |
| 729 | 724 |
| 730 /** | 725 /** |
| 731 * @constructor | 726 * @constructor |
| 732 * @extends {WebInspector.SDKObject} | 727 * @extends {WebInspector.SDKObject} |
| 733 * @param {!WebInspector.DebuggerModel} debuggerModel | 728 * @param {!WebInspector.DebuggerModel} debuggerModel |
| 734 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint | 729 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint |
| 735 * @param {!WebInspector.NetworkMapping} networkMapping | |
| 736 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding | 730 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding |
| 737 */ | 731 */ |
| 738 WebInspector.BreakpointManager.TargetBreakpoint = function(debuggerModel, breakp
oint, networkMapping, debuggerWorkspaceBinding) | 732 WebInspector.BreakpointManager.TargetBreakpoint = function(debuggerModel, breakp
oint, debuggerWorkspaceBinding) |
| 739 { | 733 { |
| 740 WebInspector.SDKObject.call(this, debuggerModel.target()); | 734 WebInspector.SDKObject.call(this, debuggerModel.target()); |
| 741 this._debuggerModel = debuggerModel; | 735 this._debuggerModel = debuggerModel; |
| 742 this._breakpoint = breakpoint; | 736 this._breakpoint = breakpoint; |
| 743 this._networkMapping = networkMapping; | |
| 744 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; | 737 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; |
| 745 | 738 |
| 746 this._liveLocations = new WebInspector.LiveLocationPool(); | 739 this._liveLocations = new WebInspector.LiveLocationPool(); |
| 747 | 740 |
| 748 /** @type {!Map<string, !WebInspector.UILocation>} */ | 741 /** @type {!Map<string, !WebInspector.UILocation>} */ |
| 749 this._uiLocations = new Map(); | 742 this._uiLocations = new Map(); |
| 750 this._debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Debug
gerWasDisabled, this._cleanUpAfterDebuggerIsGone, this); | 743 this._debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Debug
gerWasDisabled, this._cleanUpAfterDebuggerIsGone, this); |
| 751 this._debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Debug
gerWasEnabled, this._scheduleUpdateInDebugger, this); | 744 this._debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Debug
gerWasEnabled, this._scheduleUpdateInDebugger, this); |
| 752 this._hasPendingUpdate = false; | 745 this._hasPendingUpdate = false; |
| 753 this._isUpdating = false; | 746 this._isUpdating = false; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 else if (debuggerLocation) { | 816 else if (debuggerLocation) { |
| 824 var script = debuggerLocation.script(); | 817 var script = debuggerLocation.script(); |
| 825 if (script.sourceURL) | 818 if (script.sourceURL) |
| 826 newState = new WebInspector.BreakpointManager.Breakpoint.State(s
cript.sourceURL, null, debuggerLocation.lineNumber, debuggerLocation.columnNumbe
r, condition); | 819 newState = new WebInspector.BreakpointManager.Breakpoint.State(s
cript.sourceURL, null, debuggerLocation.lineNumber, debuggerLocation.columnNumbe
r, condition); |
| 827 else | 820 else |
| 828 newState = new WebInspector.BreakpointManager.Breakpoint.State(n
ull, debuggerLocation.scriptId, debuggerLocation.lineNumber, debuggerLocation.co
lumnNumber, condition); | 821 newState = new WebInspector.BreakpointManager.Breakpoint.State(n
ull, debuggerLocation.scriptId, debuggerLocation.lineNumber, debuggerLocation.co
lumnNumber, condition); |
| 829 } else if (this._breakpoint._currentState && this._breakpoint._currentSt
ate.url) { | 822 } else if (this._breakpoint._currentState && this._breakpoint._currentSt
ate.url) { |
| 830 var position = this._breakpoint._currentState; | 823 var position = this._breakpoint._currentState; |
| 831 newState = new WebInspector.BreakpointManager.Breakpoint.State(posit
ion.url, null, position.lineNumber, position.columnNumber, condition); | 824 newState = new WebInspector.BreakpointManager.Breakpoint.State(posit
ion.url, null, position.lineNumber, position.columnNumber, condition); |
| 832 } else if (uiSourceCode) { | 825 } else if (uiSourceCode) { |
| 833 var networkURL = this._networkMapping.networkURL(uiSourceCode); | 826 newState = new WebInspector.BreakpointManager.Breakpoint.State(uiSou
rceCode.url(), null, lineNumber, columnNumber, condition); |
| 834 if (networkURL) | |
| 835 newState = new WebInspector.BreakpointManager.Breakpoint.State(n
etworkURL, null, lineNumber, columnNumber, condition); | |
| 836 } | 827 } |
| 837 if (this._debuggerId && WebInspector.BreakpointManager.Breakpoint.State.
equals(newState, this._currentState)) { | 828 if (this._debuggerId && WebInspector.BreakpointManager.Breakpoint.State.
equals(newState, this._currentState)) { |
| 838 callback(); | 829 callback(); |
| 839 return; | 830 return; |
| 840 } | 831 } |
| 841 | 832 |
| 842 this._breakpoint._currentState = newState; | 833 this._breakpoint._currentState = newState; |
| 843 | 834 |
| 844 if (this._debuggerId) { | 835 if (this._debuggerId) { |
| 845 this._resetLocations(); | 836 this._resetLocations(); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1084 { | 1075 { |
| 1085 this.sourceFileId = breakpoint._sourceFileId; | 1076 this.sourceFileId = breakpoint._sourceFileId; |
| 1086 this.lineNumber = breakpoint.lineNumber(); | 1077 this.lineNumber = breakpoint.lineNumber(); |
| 1087 this.columnNumber = breakpoint.columnNumber(); | 1078 this.columnNumber = breakpoint.columnNumber(); |
| 1088 this.condition = breakpoint.condition(); | 1079 this.condition = breakpoint.condition(); |
| 1089 this.enabled = breakpoint.enabled(); | 1080 this.enabled = breakpoint.enabled(); |
| 1090 } | 1081 } |
| 1091 | 1082 |
| 1092 /** @type {!WebInspector.BreakpointManager} */ | 1083 /** @type {!WebInspector.BreakpointManager} */ |
| 1093 WebInspector.breakpointManager; | 1084 WebInspector.breakpointManager; |
| OLD | NEW |