| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 var columnBreakpoints = lineBreakpoints ? lineBreakpoints.get(columnNumber)
: null; | 259 var columnBreakpoints = lineBreakpoints ? lineBreakpoints.get(columnNumber)
: null; |
| 260 return columnBreakpoints ? columnBreakpoints[0] : null; | 260 return columnBreakpoints ? columnBreakpoints[0] : null; |
| 261 } | 261 } |
| 262 | 262 |
| 263 /** | 263 /** |
| 264 * @param {!Workspace.UISourceCode} uiSourceCode | 264 * @param {!Workspace.UISourceCode} uiSourceCode |
| 265 * @param {!TextUtils.TextRange} textRange | 265 * @param {!TextUtils.TextRange} textRange |
| 266 * @return {!Promise<!Array<!Workspace.UILocation>>} | 266 * @return {!Promise<!Array<!Workspace.UILocation>>} |
| 267 */ | 267 */ |
| 268 possibleBreakpoints(uiSourceCode, textRange) { | 268 possibleBreakpoints(uiSourceCode, textRange) { |
| 269 var startLocation = Bindings.debuggerWorkspaceBinding.uiLocationToRawLocatio
n( | 269 var startLocations = Bindings.debuggerWorkspaceBinding.uiLocationToRawLocati
ons( |
| 270 uiSourceCode, textRange.startLine, textRange.startColumn); | 270 uiSourceCode, textRange.startLine, textRange.startColumn); |
| 271 var endLocation = | 271 var endLocations = Bindings.debuggerWorkspaceBinding.uiLocationToRawLocation
s( |
| 272 Bindings.debuggerWorkspaceBinding.uiLocationToRawLocation(uiSourceCode,
textRange.endLine, textRange.endColumn); | 272 uiSourceCode, textRange.endLine, textRange.endColumn); |
| 273 if (!startLocation || !endLocation || startLocation.debuggerModel !== endLoc
ation.debuggerModel) | 273 var startLocationsByScript = new Map(startLocations.map(location => [locatio
n.script(), location])); |
| 274 var endLocation = endLocations.find(location => location.script() && startLo
cationsByScript.get(location.script())); |
| 275 if (!endLocation) |
| 274 return Promise.resolve([]); | 276 return Promise.resolve([]); |
| 275 | 277 var startLocation = startLocationsByScript.get(endLocation.script()); |
| 276 return startLocation.debuggerModel | 278 return startLocation.debuggerModel |
| 277 .getPossibleBreakpoints(startLocation, endLocation, /* restrictToFunctio
n */ false) | 279 .getPossibleBreakpoints(startLocation, endLocation, /* restrictToFunctio
n */ false) |
| 278 .then(toUILocations.bind(this)); | 280 .then(toUILocations.bind(this)); |
| 279 | 281 |
| 280 /** | 282 /** |
| 281 * @this {!Bindings.BreakpointManager} | 283 * @this {!Bindings.BreakpointManager} |
| 282 * @param {!Array<!SDK.DebuggerModel.BreakLocation>} locations | 284 * @param {!Array<!SDK.DebuggerModel.BreakLocation>} locations |
| 283 * @return {!Array<!Workspace.UILocation>} | 285 * @return {!Array<!Workspace.UILocation>} |
| 284 */ | 286 */ |
| 285 function toUILocations(locations) { | 287 function toUILocations(locations) { |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 callback(); | 804 callback(); |
| 803 return; | 805 return; |
| 804 } | 806 } |
| 805 | 807 |
| 806 var uiSourceCode = this._breakpoint.uiSourceCode(); | 808 var uiSourceCode = this._breakpoint.uiSourceCode(); |
| 807 var lineNumber = this._breakpoint._lineNumber; | 809 var lineNumber = this._breakpoint._lineNumber; |
| 808 var columnNumber = this._breakpoint._columnNumber; | 810 var columnNumber = this._breakpoint._columnNumber; |
| 809 var condition = this._breakpoint.condition(); | 811 var condition = this._breakpoint.condition(); |
| 810 | 812 |
| 811 var debuggerLocation = uiSourceCode && | 813 var debuggerLocation = uiSourceCode && |
| 812 Bindings.debuggerWorkspaceBinding.uiLocationToRawLocation(uiSourceCode,
lineNumber, columnNumber); | 814 Bindings.debuggerWorkspaceBinding.uiLocationToRawLocations(uiSourceCode,
lineNumber, columnNumber)[0]; |
| 813 var newState; | 815 var newState; |
| 814 if (this._breakpoint._isRemoved || !this._breakpoint.enabled() || this._scri
ptDiverged()) { | 816 if (this._breakpoint._isRemoved || !this._breakpoint.enabled() || this._scri
ptDiverged()) { |
| 815 newState = null; | 817 newState = null; |
| 816 } else if (debuggerLocation) { | 818 } else if (debuggerLocation) { |
| 817 var script = debuggerLocation.script(); | 819 var script = debuggerLocation.script(); |
| 818 if (script.sourceURL) { | 820 if (script.sourceURL) { |
| 819 newState = new Bindings.BreakpointManager.Breakpoint.State( | 821 newState = new Bindings.BreakpointManager.Breakpoint.State( |
| 820 script.sourceURL, null, debuggerLocation.lineNumber, debuggerLocatio
n.columnNumber, condition); | 822 script.sourceURL, null, debuggerLocation.lineNumber, debuggerLocatio
n.columnNumber, condition); |
| 821 } else { | 823 } else { |
| 822 newState = new Bindings.BreakpointManager.Breakpoint.State( | 824 newState = new Bindings.BreakpointManager.Breakpoint.State( |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 this.url = breakpoint._url; | 1082 this.url = breakpoint._url; |
| 1081 this.lineNumber = breakpoint.lineNumber(); | 1083 this.lineNumber = breakpoint.lineNumber(); |
| 1082 this.columnNumber = breakpoint.columnNumber(); | 1084 this.columnNumber = breakpoint.columnNumber(); |
| 1083 this.condition = breakpoint.condition(); | 1085 this.condition = breakpoint.condition(); |
| 1084 this.enabled = breakpoint.enabled(); | 1086 this.enabled = breakpoint.enabled(); |
| 1085 } | 1087 } |
| 1086 }; | 1088 }; |
| 1087 | 1089 |
| 1088 /** @type {!Bindings.BreakpointManager} */ | 1090 /** @type {!Bindings.BreakpointManager} */ |
| 1089 Bindings.breakpointManager; | 1091 Bindings.breakpointManager; |
| OLD | NEW |