Chromium Code Reviews| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 /** @type {!Map<!Workspace.UISourceCode, !Map<number, !Map<number, !Array<!B indings.BreakpointManager.Breakpoint>>>>} */ | 49 /** @type {!Map<!Workspace.UISourceCode, !Map<number, !Map<number, !Array<!B indings.BreakpointManager.Breakpoint>>>>} */ |
| 50 this._breakpointsForUISourceCode = new Map(); | 50 this._breakpointsForUISourceCode = new Map(); |
| 51 /** @type {!Map<!Workspace.UISourceCode, !Array<!Bindings.BreakpointManager. Breakpoint>>} */ | 51 /** @type {!Map<!Workspace.UISourceCode, !Array<!Bindings.BreakpointManager. Breakpoint>>} */ |
| 52 this._breakpointsForPrimaryUISourceCode = new Map(); | 52 this._breakpointsForPrimaryUISourceCode = new Map(); |
| 53 /** @type {!Multimap.<string, !Bindings.BreakpointManager.Breakpoint>} */ | 53 /** @type {!Multimap.<string, !Bindings.BreakpointManager.Breakpoint>} */ |
| 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 this._debuggerWorkspaceBinding.addEventListener(Bindings.DebuggerWorkspaceBi nding.Events.SourceMappingChanged, this._uiSourceCodeMappingChanged, this); | 59 this._debuggerWorkspaceBinding.addEventListener( |
| 60 Bindings.DebuggerWorkspaceBinding.Events.SourceMappingChanged, this._uiS ourceCodeMappingChanged, this); | |
| 60 | 61 |
| 61 targetManager.observeTargets(this, SDK.Target.Capability.JS); | 62 targetManager.observeTargets(this, SDK.Target.Capability.JS); |
| 62 } | 63 } |
| 63 | 64 |
| 64 /** | 65 /** |
| 65 * @param {string} url | 66 * @param {string} url |
| 66 * @param {number} lineNumber | 67 * @param {number} lineNumber |
| 67 * @param {number} columnNumber | 68 * @param {number} columnNumber |
| 68 * @return {string} | 69 * @return {string} |
| 69 */ | 70 */ |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 318 var lineBreakpoints = breakpoints[i]; | 319 var lineBreakpoints = breakpoints[i]; |
| 319 var columnBreakpointArrays = lineBreakpoints ? lineBreakpoints.valuesArray () : []; | 320 var columnBreakpointArrays = lineBreakpoints ? lineBreakpoints.valuesArray () : []; |
| 320 result = result.concat.apply(result, columnBreakpointArrays); | 321 result = result.concat.apply(result, columnBreakpointArrays); |
| 321 } | 322 } |
| 322 return result; | 323 return result; |
| 323 } | 324 } |
| 324 | 325 |
| 325 /** | 326 /** |
| 326 * @return {!Array.<!Bindings.BreakpointManager.Breakpoint>} | 327 * @return {!Array.<!Bindings.BreakpointManager.Breakpoint>} |
| 327 */ | 328 */ |
| 328 _allBreakpoints() { | 329 allBreakpoints() { |
| 329 var result = []; | 330 var result = []; |
| 330 var uiSourceCodes = this._breakpointsForUISourceCode.keysArray(); | 331 var uiSourceCodes = this._breakpointsForUISourceCode.keysArray(); |
| 331 for (var i = 0; i < uiSourceCodes.length; ++i) | 332 for (var i = 0; i < uiSourceCodes.length; ++i) |
| 332 result = result.concat(this.breakpointsForUISourceCode(uiSourceCodes[i])); | 333 result = result.concat(this.breakpointsForUISourceCode(uiSourceCodes[i])); |
| 333 return result; | 334 return result; |
| 334 } | 335 } |
| 335 | 336 |
| 336 /** | 337 /** |
| 337 * @param {!Workspace.UISourceCode} uiSourceCode | 338 * @param {!Workspace.UISourceCode} uiSourceCode |
| 338 * @return {!Array.<!{breakpoint: !Bindings.BreakpointManager.Breakpoint, uiLo cation: !Workspace.UILocation}>} | 339 * @return {!Array.<!{breakpoint: !Bindings.BreakpointManager.Breakpoint, uiLo cation: !Workspace.UILocation}>} |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 363 */ | 364 */ |
| 364 allBreakpointLocations() { | 365 allBreakpointLocations() { |
| 365 var result = []; | 366 var result = []; |
| 366 var uiSourceCodes = this._breakpointsForUISourceCode.keysArray(); | 367 var uiSourceCodes = this._breakpointsForUISourceCode.keysArray(); |
| 367 for (var i = 0; i < uiSourceCodes.length; ++i) | 368 for (var i = 0; i < uiSourceCodes.length; ++i) |
| 368 result = result.concat(this.breakpointLocationsForUISourceCode(uiSourceCod es[i])); | 369 result = result.concat(this.breakpointLocationsForUISourceCode(uiSourceCod es[i])); |
| 369 return result; | 370 return result; |
| 370 } | 371 } |
| 371 | 372 |
| 372 /** | 373 /** |
| 374 * @param {!Array.<!Bindings.BreakpointManager.Breakpoint>} breakpoints | |
| 373 * @param {boolean} toggleState | 375 * @param {boolean} toggleState |
| 374 */ | 376 */ |
| 375 toggleAllBreakpoints(toggleState) { | 377 toggleAllBreakpoints(breakpoints, toggleState) { |
|
pfeldman
2017/02/01 19:41:02
I would leave this as is.
| |
| 376 var breakpoints = this._allBreakpoints(); | |
| 377 for (var i = 0; i < breakpoints.length; ++i) | 378 for (var i = 0; i < breakpoints.length; ++i) |
| 378 breakpoints[i].setEnabled(toggleState); | 379 breakpoints[i].setEnabled(toggleState); |
| 379 } | 380 } |
| 380 | 381 |
| 381 removeAllBreakpoints() { | 382 /** |
| 382 var breakpoints = this._allBreakpoints(); | 383 * @param {!Array.<!Bindings.BreakpointManager.Breakpoint>} breakpoints |
| 384 */ | |
| 385 removeAllBreakpoints(breakpoints) { | |
|
pfeldman
2017/02/01 19:41:02
I would leave this as is.
| |
| 383 for (var i = 0; i < breakpoints.length; ++i) | 386 for (var i = 0; i < breakpoints.length; ++i) |
| 384 breakpoints[i].remove(); | 387 breakpoints[i].remove(); |
| 385 } | 388 } |
| 386 | 389 |
| 390 /** | |
| 391 * @param {!Array.<!Bindings.BreakpointManager.Breakpoint>} allBreakpoints | |
| 392 * @param {!Array.<!Bindings.BreakpointManager.Breakpoint>} selectedBreakpoint s | |
| 393 */ | |
| 394 removeOtherBreakpoints(allBreakpoints, selectedBreakpoints) { | |
|
pfeldman
2017/02/01 19:41:02
Here you can make it accept the one (ones) you wan
Oleksii Kadurin
2017/02/01 20:16:37
And compare breakpoints not by _breakpointStorageI
| |
| 395 allBreakpoints.forEach(breakpoint => { | |
| 396 var storageId = breakpoint._breakpointStorageId(); | |
| 397 var isSelected = | |
| 398 selectedBreakpoints.some(selectedBreakpoint => selectedBreakpoint._bre akpointStorageId() === storageId); | |
| 399 if (!isSelected) | |
| 400 breakpoint.remove(); | |
| 401 }); | |
| 402 } | |
| 403 | |
| 387 _projectRemoved(event) { | 404 _projectRemoved(event) { |
| 388 var project = /** @type {!Workspace.Project} */ (event.data); | 405 var project = /** @type {!Workspace.Project} */ (event.data); |
| 389 var uiSourceCodes = project.uiSourceCodes(); | 406 var uiSourceCodes = project.uiSourceCodes(); |
| 390 for (var i = 0; i < uiSourceCodes.length; ++i) | 407 for (var i = 0; i < uiSourceCodes.length; ++i) |
| 391 this._removeUISourceCode(uiSourceCodes[i]); | 408 this._removeUISourceCode(uiSourceCodes[i]); |
| 392 } | 409 } |
| 393 | 410 |
| 394 /** | 411 /** |
| 395 * @param {!Bindings.BreakpointManager.Breakpoint} breakpoint | 412 * @param {!Bindings.BreakpointManager.Breakpoint} breakpoint |
| 396 * @param {boolean} removeFromStorage | 413 * @param {boolean} removeFromStorage |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1083 this.url = breakpoint._url; | 1100 this.url = breakpoint._url; |
| 1084 this.lineNumber = breakpoint.lineNumber(); | 1101 this.lineNumber = breakpoint.lineNumber(); |
| 1085 this.columnNumber = breakpoint.columnNumber(); | 1102 this.columnNumber = breakpoint.columnNumber(); |
| 1086 this.condition = breakpoint.condition(); | 1103 this.condition = breakpoint.condition(); |
| 1087 this.enabled = breakpoint.enabled(); | 1104 this.enabled = breakpoint.enabled(); |
| 1088 } | 1105 } |
| 1089 }; | 1106 }; |
| 1090 | 1107 |
| 1091 /** @type {!Bindings.BreakpointManager} */ | 1108 /** @type {!Bindings.BreakpointManager} */ |
| 1092 Bindings.breakpointManager; | 1109 Bindings.breakpointManager; |
| OLD | NEW |