| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 this._provisionalBreakpoints = new Multimap(); | 54 this._provisionalBreakpoints = new Multimap(); |
| 55 | 55 |
| 56 this._workspace.addEventListener(Workspace.Workspace.Events.ProjectRemoved,
this._projectRemoved, this); | 56 this._workspace.addEventListener(Workspace.Workspace.Events.ProjectRemoved,
this._projectRemoved, this); |
| 57 this._workspace.addEventListener(Workspace.Workspace.Events.UISourceCodeAdde
d, this._uiSourceCodeAdded, this); | 57 this._workspace.addEventListener(Workspace.Workspace.Events.UISourceCodeAdde
d, this._uiSourceCodeAdded, this); |
| 58 this._workspace.addEventListener(Workspace.Workspace.Events.UISourceCodeRemo
ved, this._uiSourceCodeRemoved, this); | 58 this._workspace.addEventListener(Workspace.Workspace.Events.UISourceCodeRemo
ved, this._uiSourceCodeRemoved, this); |
| 59 | 59 |
| 60 targetManager.observeTargets(this, SDK.Target.Capability.JS); | 60 targetManager.observeTargets(this, SDK.Target.Capability.JS); |
| 61 } | 61 } |
| 62 | 62 |
| 63 /** | 63 /** |
| 64 * @param {string} sourceFileId | 64 * @param {string} url |
| 65 * @param {number} lineNumber | 65 * @param {number} lineNumber |
| 66 * @param {number} columnNumber | 66 * @param {number} columnNumber |
| 67 * @return {string} | 67 * @return {string} |
| 68 */ | 68 */ |
| 69 static _breakpointStorageId(sourceFileId, lineNumber, columnNumber) { | 69 static _breakpointStorageId(url, lineNumber, columnNumber) { |
| 70 if (!sourceFileId) | 70 if (!url) |
| 71 return ''; | 71 return ''; |
| 72 return sourceFileId + ':' + lineNumber + ':' + columnNumber; | 72 return url + ':' + lineNumber + ':' + columnNumber; |
| 73 } | 73 } |
| 74 | 74 |
| 75 /** | 75 /** |
| 76 * @param {!Workspace.UISourceCode} uiSourceCode | |
| 77 * @return {string} | |
| 78 */ | |
| 79 _sourceFileId(uiSourceCode) { | |
| 80 // TODO(lushnikov): _sourceFileId is not needed any more. | |
| 81 return uiSourceCode.url(); | |
| 82 } | |
| 83 | |
| 84 /** | |
| 85 * @override | 76 * @override |
| 86 * @param {!SDK.Target} target | 77 * @param {!SDK.Target} target |
| 87 */ | 78 */ |
| 88 targetAdded(target) { | 79 targetAdded(target) { |
| 89 var debuggerModel = SDK.DebuggerModel.fromTarget(target); | 80 var debuggerModel = SDK.DebuggerModel.fromTarget(target); |
| 90 if (debuggerModel && !this._breakpointsActive) | 81 if (debuggerModel && !this._breakpointsActive) |
| 91 debuggerModel.setBreakpointsActive(this._breakpointsActive); | 82 debuggerModel.setBreakpointsActive(this._breakpointsActive); |
| 92 } | 83 } |
| 93 | 84 |
| 94 /** | 85 /** |
| 95 * @override | 86 * @override |
| 96 * @param {!SDK.Target} target | 87 * @param {!SDK.Target} target |
| 97 */ | 88 */ |
| 98 targetRemoved(target) { | 89 targetRemoved(target) { |
| 99 } | 90 } |
| 100 | 91 |
| 101 /** | 92 /** |
| 102 * @param {string} sourceFileId | 93 * @param {string} url |
| 103 * @return {!Map.<string, !Bindings.BreakpointManager.Breakpoint>} | 94 * @return {!Map.<string, !Bindings.BreakpointManager.Breakpoint>} |
| 104 */ | 95 */ |
| 105 _provisionalBreakpointsForSourceFileId(sourceFileId) { | 96 _provisionalBreakpointsForURL(url) { |
| 106 var result = new Map(); | 97 var result = new Map(); |
| 107 var breakpoints = this._provisionalBreakpoints.get(sourceFileId).valuesArray
(); | 98 var breakpoints = this._provisionalBreakpoints.get(url).valuesArray(); |
| 108 for (var i = 0; i < breakpoints.length; ++i) | 99 for (var i = 0; i < breakpoints.length; ++i) |
| 109 result.set(breakpoints[i]._breakpointStorageId(), breakpoints[i]); | 100 result.set(breakpoints[i]._breakpointStorageId(), breakpoints[i]); |
| 110 return result; | 101 return result; |
| 111 } | 102 } |
| 112 | 103 |
| 113 removeProvisionalBreakpointsForTest() { | 104 removeProvisionalBreakpointsForTest() { |
| 114 var breakpoints = this._provisionalBreakpoints.valuesArray(); | 105 var breakpoints = this._provisionalBreakpoints.valuesArray(); |
| 115 for (var i = 0; i < breakpoints.length; ++i) | 106 for (var i = 0; i < breakpoints.length; ++i) |
| 116 breakpoints[i].remove(); | 107 breakpoints[i].remove(); |
| 117 this._provisionalBreakpoints.clear(); | 108 this._provisionalBreakpoints.clear(); |
| 118 } | 109 } |
| 119 | 110 |
| 120 /** | 111 /** |
| 121 * @param {!Workspace.UISourceCode} uiSourceCode | 112 * @param {!Workspace.UISourceCode} uiSourceCode |
| 122 */ | 113 */ |
| 123 _restoreBreakpoints(uiSourceCode) { | 114 _restoreBreakpoints(uiSourceCode) { |
| 124 var sourceFileId = this._sourceFileId(uiSourceCode); | 115 var url = uiSourceCode.url(); |
| 125 if (!sourceFileId) | 116 if (!url) |
| 126 return; | 117 return; |
| 127 | 118 |
| 128 this._storage.mute(); | 119 this._storage.mute(); |
| 129 var breakpointItems = this._storage.breakpointItems(this._sourceFileId(uiSou
rceCode)); | 120 var breakpointItems = this._storage.breakpointItems(url); |
| 130 var provisionalBreakpoints = this._provisionalBreakpointsForSourceFileId(sou
rceFileId); | 121 var provisionalBreakpoints = this._provisionalBreakpointsForURL(url); |
| 131 for (var i = 0; i < breakpointItems.length; ++i) { | 122 for (var i = 0; i < breakpointItems.length; ++i) { |
| 132 var breakpointItem = breakpointItems[i]; | 123 var breakpointItem = breakpointItems[i]; |
| 133 var itemStorageId = Bindings.BreakpointManager._breakpointStorageId( | 124 var itemStorageId = Bindings.BreakpointManager._breakpointStorageId( |
| 134 breakpointItem.sourceFileId, breakpointItem.lineNumber, breakpointItem
.columnNumber); | 125 breakpointItem.url, breakpointItem.lineNumber, breakpointItem.columnNu
mber); |
| 135 var provisionalBreakpoint = provisionalBreakpoints.get(itemStorageId); | 126 var provisionalBreakpoint = provisionalBreakpoints.get(itemStorageId); |
| 136 if (provisionalBreakpoint) { | 127 if (provisionalBreakpoint) { |
| 137 if (!this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)) | 128 if (!this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)) |
| 138 this._breakpointsForPrimaryUISourceCode.set(uiSourceCode, []); | 129 this._breakpointsForPrimaryUISourceCode.set(uiSourceCode, []); |
| 139 this._breakpointsForPrimaryUISourceCode.get(uiSourceCode).push(provision
alBreakpoint); | 130 this._breakpointsForPrimaryUISourceCode.get(uiSourceCode).push(provision
alBreakpoint); |
| 140 provisionalBreakpoint._updateBreakpoint(); | 131 provisionalBreakpoint._updateBreakpoint(); |
| 141 } else { | 132 } else { |
| 142 this._innerSetBreakpoint( | 133 this._innerSetBreakpoint( |
| 143 uiSourceCode, breakpointItem.lineNumber, breakpointItem.columnNumber
, breakpointItem.condition, | 134 uiSourceCode, breakpointItem.lineNumber, breakpointItem.columnNumber
, breakpointItem.condition, |
| 144 breakpointItem.enabled); | 135 breakpointItem.enabled); |
| 145 } | 136 } |
| 146 } | 137 } |
| 147 this._provisionalBreakpoints.removeAll(sourceFileId); | 138 this._provisionalBreakpoints.removeAll(url); |
| 148 this._storage.unmute(); | 139 this._storage.unmute(); |
| 149 } | 140 } |
| 150 | 141 |
| 151 /** | 142 /** |
| 152 * @param {!Common.Event} event | 143 * @param {!Common.Event} event |
| 153 */ | 144 */ |
| 154 _uiSourceCodeAdded(event) { | 145 _uiSourceCodeAdded(event) { |
| 155 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data); | 146 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data); |
| 156 this._restoreBreakpoints(uiSourceCode); | 147 this._restoreBreakpoints(uiSourceCode); |
| 157 if (uiSourceCode.contentType().hasScripts()) { | 148 if (uiSourceCode.contentType().hasScripts()) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 180 var breakpoints = this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)
|| []; | 171 var breakpoints = this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)
|| []; |
| 181 for (var i = 0; i < breakpoints.length; ++i) | 172 for (var i = 0; i < breakpoints.length; ++i) |
| 182 breakpoints[i]._updateInDebuggerForTarget(target); | 173 breakpoints[i]._updateInDebuggerForTarget(target); |
| 183 } | 174 } |
| 184 | 175 |
| 185 /** | 176 /** |
| 186 * @param {!Workspace.UISourceCode} uiSourceCode | 177 * @param {!Workspace.UISourceCode} uiSourceCode |
| 187 */ | 178 */ |
| 188 _removeUISourceCode(uiSourceCode) { | 179 _removeUISourceCode(uiSourceCode) { |
| 189 var breakpoints = this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)
|| []; | 180 var breakpoints = this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)
|| []; |
| 190 var sourceFileId = this._sourceFileId(uiSourceCode); | |
| 191 for (var i = 0; i < breakpoints.length; ++i) { | 181 for (var i = 0; i < breakpoints.length; ++i) { |
| 192 breakpoints[i]._resetLocations(); | 182 breakpoints[i]._resetLocations(); |
| 193 if (breakpoints[i].enabled()) | 183 if (breakpoints[i].enabled()) |
| 194 this._provisionalBreakpoints.set(sourceFileId, breakpoints[i]); | 184 this._provisionalBreakpoints.set(uiSourceCode.url(), breakpoints[i]); |
| 195 } | 185 } |
| 196 uiSourceCode.removeEventListener( | 186 uiSourceCode.removeEventListener( |
| 197 Workspace.UISourceCode.Events.SourceMappingChanged, this._uiSourceCodeMa
ppingChanged, this); | 187 Workspace.UISourceCode.Events.SourceMappingChanged, this._uiSourceCodeMa
ppingChanged, this); |
| 198 this._breakpointsForPrimaryUISourceCode.remove(uiSourceCode); | 188 this._breakpointsForPrimaryUISourceCode.remove(uiSourceCode); |
| 199 } | 189 } |
| 200 | 190 |
| 201 /** | 191 /** |
| 202 * @param {!Workspace.UISourceCode} uiSourceCode | 192 * @param {!Workspace.UISourceCode} uiSourceCode |
| 203 * @param {number} lineNumber | 193 * @param {number} lineNumber |
| 204 * @param {number} columnNumber | 194 * @param {number} columnNumber |
| (...skipping 21 matching lines...) Expand all Loading... |
| 226 * @param {boolean} enabled | 216 * @param {boolean} enabled |
| 227 * @return {!Bindings.BreakpointManager.Breakpoint} | 217 * @return {!Bindings.BreakpointManager.Breakpoint} |
| 228 */ | 218 */ |
| 229 _innerSetBreakpoint(uiSourceCode, lineNumber, columnNumber, condition, enabled
) { | 219 _innerSetBreakpoint(uiSourceCode, lineNumber, columnNumber, condition, enabled
) { |
| 230 var breakpoint = this.findBreakpoint(uiSourceCode, lineNumber, columnNumber)
; | 220 var breakpoint = this.findBreakpoint(uiSourceCode, lineNumber, columnNumber)
; |
| 231 if (breakpoint) { | 221 if (breakpoint) { |
| 232 breakpoint._updateState(condition, enabled); | 222 breakpoint._updateState(condition, enabled); |
| 233 return breakpoint; | 223 return breakpoint; |
| 234 } | 224 } |
| 235 var projectId = uiSourceCode.project().id(); | 225 var projectId = uiSourceCode.project().id(); |
| 236 var path = uiSourceCode.url(); | |
| 237 var sourceFileId = this._sourceFileId(uiSourceCode); | |
| 238 breakpoint = new Bindings.BreakpointManager.Breakpoint( | 226 breakpoint = new Bindings.BreakpointManager.Breakpoint( |
| 239 this, projectId, path, sourceFileId, lineNumber, columnNumber, condition
, enabled); | 227 this, projectId, uiSourceCode.url(), lineNumber, columnNumber, condition
, enabled); |
| 240 if (!this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)) | 228 if (!this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)) |
| 241 this._breakpointsForPrimaryUISourceCode.set(uiSourceCode, []); | 229 this._breakpointsForPrimaryUISourceCode.set(uiSourceCode, []); |
| 242 this._breakpointsForPrimaryUISourceCode.get(uiSourceCode).push(breakpoint); | 230 this._breakpointsForPrimaryUISourceCode.get(uiSourceCode).push(breakpoint); |
| 243 return breakpoint; | 231 return breakpoint; |
| 244 } | 232 } |
| 245 | 233 |
| 246 /** | 234 /** |
| 247 * @param {!Workspace.UISourceCode} uiSourceCode | 235 * @param {!Workspace.UISourceCode} uiSourceCode |
| 248 * @param {number} lineNumber | 236 * @param {number} lineNumber |
| 249 * @return {!Array<!Bindings.BreakpointManager.Breakpoint>} | 237 * @return {!Array<!Bindings.BreakpointManager.Breakpoint>} |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 /** | 389 /** |
| 402 * @param {!Bindings.BreakpointManager.Breakpoint} breakpoint | 390 * @param {!Bindings.BreakpointManager.Breakpoint} breakpoint |
| 403 * @param {boolean} removeFromStorage | 391 * @param {boolean} removeFromStorage |
| 404 */ | 392 */ |
| 405 _removeBreakpoint(breakpoint, removeFromStorage) { | 393 _removeBreakpoint(breakpoint, removeFromStorage) { |
| 406 var uiSourceCode = breakpoint.uiSourceCode(); | 394 var uiSourceCode = breakpoint.uiSourceCode(); |
| 407 var breakpoints = uiSourceCode ? this._breakpointsForPrimaryUISourceCode.get
(uiSourceCode) || [] : []; | 395 var breakpoints = uiSourceCode ? this._breakpointsForPrimaryUISourceCode.get
(uiSourceCode) || [] : []; |
| 408 breakpoints.remove(breakpoint); | 396 breakpoints.remove(breakpoint); |
| 409 if (removeFromStorage) | 397 if (removeFromStorage) |
| 410 this._storage._removeBreakpoint(breakpoint); | 398 this._storage._removeBreakpoint(breakpoint); |
| 411 this._provisionalBreakpoints.remove(breakpoint._sourceFileId, breakpoint); | 399 this._provisionalBreakpoints.remove(breakpoint._url, breakpoint); |
| 412 } | 400 } |
| 413 | 401 |
| 414 /** | 402 /** |
| 415 * @param {!Bindings.BreakpointManager.Breakpoint} breakpoint | 403 * @param {!Bindings.BreakpointManager.Breakpoint} breakpoint |
| 416 * @param {!Workspace.UILocation} uiLocation | 404 * @param {!Workspace.UILocation} uiLocation |
| 417 */ | 405 */ |
| 418 _uiLocationAdded(breakpoint, uiLocation) { | 406 _uiLocationAdded(breakpoint, uiLocation) { |
| 419 var breakpoints = this._breakpointsForUISourceCode.get(uiLocation.uiSourceCo
de); | 407 var breakpoints = this._breakpointsForUISourceCode.get(uiLocation.uiSourceCo
de); |
| 420 if (!breakpoints) { | 408 if (!breakpoints) { |
| 421 breakpoints = new Map(); | 409 breakpoints = new Map(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 | 482 |
| 495 | 483 |
| 496 /** | 484 /** |
| 497 * @implements {SDK.TargetManager.Observer} | 485 * @implements {SDK.TargetManager.Observer} |
| 498 * @unrestricted | 486 * @unrestricted |
| 499 */ | 487 */ |
| 500 Bindings.BreakpointManager.Breakpoint = class { | 488 Bindings.BreakpointManager.Breakpoint = class { |
| 501 /** | 489 /** |
| 502 * @param {!Bindings.BreakpointManager} breakpointManager | 490 * @param {!Bindings.BreakpointManager} breakpointManager |
| 503 * @param {string} projectId | 491 * @param {string} projectId |
| 504 * @param {string} path | 492 * @param {string} url |
| 505 * @param {string} sourceFileId | |
| 506 * @param {number} lineNumber | 493 * @param {number} lineNumber |
| 507 * @param {number} columnNumber | 494 * @param {number} columnNumber |
| 508 * @param {string} condition | 495 * @param {string} condition |
| 509 * @param {boolean} enabled | 496 * @param {boolean} enabled |
| 510 */ | 497 */ |
| 511 constructor(breakpointManager, projectId, path, sourceFileId, lineNumber, colu
mnNumber, condition, enabled) { | 498 constructor(breakpointManager, projectId, url, lineNumber, columnNumber, condi
tion, enabled) { |
| 512 this._breakpointManager = breakpointManager; | 499 this._breakpointManager = breakpointManager; |
| 513 this._projectId = projectId; | 500 this._projectId = projectId; |
| 514 this._path = path; | 501 this._url = url; |
| 515 this._lineNumber = lineNumber; | 502 this._lineNumber = lineNumber; |
| 516 this._columnNumber = columnNumber; | 503 this._columnNumber = columnNumber; |
| 517 this._sourceFileId = sourceFileId; | |
| 518 | 504 |
| 519 /** @type {!Map<string, number>} */ | 505 /** @type {!Map<string, number>} */ |
| 520 this._numberOfDebuggerLocationForUILocation = new Map(); | 506 this._numberOfDebuggerLocationForUILocation = new Map(); |
| 521 | 507 |
| 522 // Force breakpoint update. | 508 // Force breakpoint update. |
| 523 /** @type {string} */ this._condition; | 509 /** @type {string} */ this._condition; |
| 524 /** @type {boolean} */ this._enabled; | 510 /** @type {boolean} */ this._enabled; |
| 525 /** @type {boolean} */ this._isRemoved; | 511 /** @type {boolean} */ this._isRemoved; |
| 526 /** @type {!Workspace.UILocation|undefined} */ this._fakePrimaryLocation; | 512 /** @type {!Workspace.UILocation|undefined} */ this._fakePrimaryLocation; |
| 527 | 513 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 /** | 547 /** |
| 562 * @return {string} | 548 * @return {string} |
| 563 */ | 549 */ |
| 564 projectId() { | 550 projectId() { |
| 565 return this._projectId; | 551 return this._projectId; |
| 566 } | 552 } |
| 567 | 553 |
| 568 /** | 554 /** |
| 569 * @return {string} | 555 * @return {string} |
| 570 */ | 556 */ |
| 571 path() { | 557 url() { |
| 572 return this._path; | 558 return this._url; |
| 573 } | 559 } |
| 574 | 560 |
| 575 /** | 561 /** |
| 576 * @return {number} | 562 * @return {number} |
| 577 */ | 563 */ |
| 578 lineNumber() { | 564 lineNumber() { |
| 579 return this._lineNumber; | 565 return this._lineNumber; |
| 580 } | 566 } |
| 581 | 567 |
| 582 /** | 568 /** |
| 583 * @return {number} | 569 * @return {number} |
| 584 */ | 570 */ |
| 585 columnNumber() { | 571 columnNumber() { |
| 586 return this._columnNumber; | 572 return this._columnNumber; |
| 587 } | 573 } |
| 588 | 574 |
| 589 /** | 575 /** |
| 590 * @return {?Workspace.UISourceCode} | 576 * @return {?Workspace.UISourceCode} |
| 591 */ | 577 */ |
| 592 uiSourceCode() { | 578 uiSourceCode() { |
| 593 return this._breakpointManager._workspace.uiSourceCode(this._projectId, this
._path); | 579 return this._breakpointManager._workspace.uiSourceCode(this._projectId, this
._url); |
| 594 } | 580 } |
| 595 | 581 |
| 596 /** | 582 /** |
| 597 * @param {?Workspace.UILocation} oldUILocation | 583 * @param {?Workspace.UILocation} oldUILocation |
| 598 * @param {!Workspace.UILocation} newUILocation | 584 * @param {!Workspace.UILocation} newUILocation |
| 599 */ | 585 */ |
| 600 _replaceUILocation(oldUILocation, newUILocation) { | 586 _replaceUILocation(oldUILocation, newUILocation) { |
| 601 if (this._isRemoved) | 587 if (this._isRemoved) |
| 602 return; | 588 return; |
| 603 | 589 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 * @param {!SDK.Target} target | 684 * @param {!SDK.Target} target |
| 699 */ | 685 */ |
| 700 _updateInDebuggerForTarget(target) { | 686 _updateInDebuggerForTarget(target) { |
| 701 this._targetBreakpoints.get(target)._scheduleUpdateInDebugger(); | 687 this._targetBreakpoints.get(target)._scheduleUpdateInDebugger(); |
| 702 } | 688 } |
| 703 | 689 |
| 704 /** | 690 /** |
| 705 * @return {string} | 691 * @return {string} |
| 706 */ | 692 */ |
| 707 _breakpointStorageId() { | 693 _breakpointStorageId() { |
| 708 return Bindings.BreakpointManager._breakpointStorageId(this._sourceFileId, t
his._lineNumber, this._columnNumber); | 694 return Bindings.BreakpointManager._breakpointStorageId(this._url, this._line
Number, this._columnNumber); |
| 709 } | 695 } |
| 710 | 696 |
| 711 _fakeBreakpointAtPrimaryLocation() { | 697 _fakeBreakpointAtPrimaryLocation() { |
| 712 if (this._isRemoved || this._numberOfDebuggerLocationForUILocation.size || t
his._fakePrimaryLocation) | 698 if (this._isRemoved || this._numberOfDebuggerLocationForUILocation.size || t
his._fakePrimaryLocation) |
| 713 return; | 699 return; |
| 714 | 700 |
| 715 var uiSourceCode = this._breakpointManager._workspace.uiSourceCode(this._pro
jectId, this._path); | 701 var uiSourceCode = this._breakpointManager._workspace.uiSourceCode(this._pro
jectId, this._url); |
| 716 if (!uiSourceCode) | 702 if (!uiSourceCode) |
| 717 return; | 703 return; |
| 718 | 704 |
| 719 this._fakePrimaryLocation = uiSourceCode.uiLocation(this._lineNumber, this._
columnNumber); | 705 this._fakePrimaryLocation = uiSourceCode.uiLocation(this._lineNumber, this._
columnNumber); |
| 720 if (this._fakePrimaryLocation) | 706 if (this._fakePrimaryLocation) |
| 721 this._breakpointManager._uiLocationAdded(this, this._fakePrimaryLocation); | 707 this._breakpointManager._uiLocationAdded(this, this._fakePrimaryLocation); |
| 722 } | 708 } |
| 723 | 709 |
| 724 _removeFakeBreakpointAtPrimaryLocation() { | 710 _removeFakeBreakpointAtPrimaryLocation() { |
| 725 if (this._fakePrimaryLocation) { | 711 if (this._fakePrimaryLocation) { |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 */ | 1006 */ |
| 1021 constructor(breakpointManager, setting) { | 1007 constructor(breakpointManager, setting) { |
| 1022 this._breakpointManager = breakpointManager; | 1008 this._breakpointManager = breakpointManager; |
| 1023 this._setting = setting || Common.settings.createLocalSetting('breakpoints',
[]); | 1009 this._setting = setting || Common.settings.createLocalSetting('breakpoints',
[]); |
| 1024 var breakpoints = this._setting.get(); | 1010 var breakpoints = this._setting.get(); |
| 1025 /** @type {!Object.<string, !Bindings.BreakpointManager.Storage.Item>} */ | 1011 /** @type {!Object.<string, !Bindings.BreakpointManager.Storage.Item>} */ |
| 1026 this._breakpoints = {}; | 1012 this._breakpoints = {}; |
| 1027 for (var i = 0; i < breakpoints.length; ++i) { | 1013 for (var i = 0; i < breakpoints.length; ++i) { |
| 1028 var breakpoint = /** @type {!Bindings.BreakpointManager.Storage.Item} */ (
breakpoints[i]); | 1014 var breakpoint = /** @type {!Bindings.BreakpointManager.Storage.Item} */ (
breakpoints[i]); |
| 1029 breakpoint.columnNumber = breakpoint.columnNumber || 0; | 1015 breakpoint.columnNumber = breakpoint.columnNumber || 0; |
| 1030 this._breakpoints[breakpoint.sourceFileId + ':' + breakpoint.lineNumber +
':' + breakpoint.columnNumber] = | 1016 this._breakpoints[breakpoint.url + ':' + breakpoint.lineNumber + ':' + bre
akpoint.columnNumber] = breakpoint; |
| 1031 breakpoint; | |
| 1032 } | 1017 } |
| 1033 } | 1018 } |
| 1034 | 1019 |
| 1035 mute() { | 1020 mute() { |
| 1036 this._muted = true; | 1021 this._muted = true; |
| 1037 } | 1022 } |
| 1038 | 1023 |
| 1039 unmute() { | 1024 unmute() { |
| 1040 delete this._muted; | 1025 delete this._muted; |
| 1041 } | 1026 } |
| 1042 | 1027 |
| 1043 /** | 1028 /** |
| 1044 * @param {string} sourceFileId | 1029 * @param {string} url |
| 1045 * @return {!Array.<!Bindings.BreakpointManager.Storage.Item>} | 1030 * @return {!Array.<!Bindings.BreakpointManager.Storage.Item>} |
| 1046 */ | 1031 */ |
| 1047 breakpointItems(sourceFileId) { | 1032 breakpointItems(url) { |
| 1048 var result = []; | 1033 var result = []; |
| 1049 for (var id in this._breakpoints) { | 1034 for (var id in this._breakpoints) { |
| 1050 var breakpoint = this._breakpoints[id]; | 1035 var breakpoint = this._breakpoints[id]; |
| 1051 if (breakpoint.sourceFileId === sourceFileId) | 1036 if (breakpoint.url === url) |
| 1052 result.push(breakpoint); | 1037 result.push(breakpoint); |
| 1053 } | 1038 } |
| 1054 return result; | 1039 return result; |
| 1055 } | 1040 } |
| 1056 | 1041 |
| 1057 /** | 1042 /** |
| 1058 * @param {!Bindings.BreakpointManager.Breakpoint} breakpoint | 1043 * @param {!Bindings.BreakpointManager.Breakpoint} breakpoint |
| 1059 */ | 1044 */ |
| 1060 _updateBreakpoint(breakpoint) { | 1045 _updateBreakpoint(breakpoint) { |
| 1061 if (this._muted || !breakpoint._breakpointStorageId()) | 1046 if (this._muted || !breakpoint._breakpointStorageId()) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1083 }; | 1068 }; |
| 1084 | 1069 |
| 1085 /** | 1070 /** |
| 1086 * @unrestricted | 1071 * @unrestricted |
| 1087 */ | 1072 */ |
| 1088 Bindings.BreakpointManager.Storage.Item = class { | 1073 Bindings.BreakpointManager.Storage.Item = class { |
| 1089 /** | 1074 /** |
| 1090 * @param {!Bindings.BreakpointManager.Breakpoint} breakpoint | 1075 * @param {!Bindings.BreakpointManager.Breakpoint} breakpoint |
| 1091 */ | 1076 */ |
| 1092 constructor(breakpoint) { | 1077 constructor(breakpoint) { |
| 1093 this.sourceFileId = breakpoint._sourceFileId; | 1078 this.url = breakpoint._url; |
| 1094 this.lineNumber = breakpoint.lineNumber(); | 1079 this.lineNumber = breakpoint.lineNumber(); |
| 1095 this.columnNumber = breakpoint.columnNumber(); | 1080 this.columnNumber = breakpoint.columnNumber(); |
| 1096 this.condition = breakpoint.condition(); | 1081 this.condition = breakpoint.condition(); |
| 1097 this.enabled = breakpoint.enabled(); | 1082 this.enabled = breakpoint.enabled(); |
| 1098 } | 1083 } |
| 1099 }; | 1084 }; |
| 1100 | 1085 |
| 1101 /** @type {!Bindings.BreakpointManager} */ | 1086 /** @type {!Bindings.BreakpointManager} */ |
| 1102 Bindings.breakpointManager; | 1087 Bindings.breakpointManager; |
| OLD | NEW |