Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/BreakpointManager.js

Issue 2500493003: [DevTools] make breakpoints better (Closed)
Patch Set: fixed context menu items for gutter Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 } 244 }
245 245
246 /** 246 /**
247 * @param {!Workspace.UISourceCode} uiSourceCode 247 * @param {!Workspace.UISourceCode} uiSourceCode
248 * @param {number} lineNumber 248 * @param {number} lineNumber
249 * @return {!Array<!Bindings.BreakpointManager.Breakpoint>} 249 * @return {!Array<!Bindings.BreakpointManager.Breakpoint>}
250 */ 250 */
251 findBreakpoints(uiSourceCode, lineNumber) { 251 findBreakpoints(uiSourceCode, lineNumber) {
252 var breakpoints = this._breakpointsForUISourceCode.get(uiSourceCode); 252 var breakpoints = this._breakpointsForUISourceCode.get(uiSourceCode);
253 var lineBreakpoints = breakpoints ? breakpoints.get(lineNumber) : null; 253 var lineBreakpoints = breakpoints ? breakpoints.get(lineNumber) : null;
254 return lineBreakpoints ? lineBreakpoints.valuesArray()[0] : []; 254 if (!lineBreakpoints)
255 return [];
256 breakpoints = [].concat.apply([], lineBreakpoints.valuesArray());
dgozman 2016/11/15 23:35:13 breakpoints = lineBreakpoints.valuesArray() ?
257 breakpoints.sort((breakpoint1, breakpoint2) => breakpoint1.columnNumber() - breakpoint2.columnNumber());
258 return breakpoints;
255 } 259 }
256 260
257 /** 261 /**
258 * @param {!Workspace.UISourceCode} uiSourceCode 262 * @param {!Workspace.UISourceCode} uiSourceCode
259 * @param {number} lineNumber 263 * @param {number} lineNumber
260 * @param {number} columnNumber 264 * @param {number} columnNumber
261 * @return {?Bindings.BreakpointManager.Breakpoint} 265 * @return {?Bindings.BreakpointManager.Breakpoint}
262 */ 266 */
263 findBreakpoint(uiSourceCode, lineNumber, columnNumber) { 267 findBreakpoint(uiSourceCode, lineNumber, columnNumber) {
264 var breakpoints = this._breakpointsForUISourceCode.get(uiSourceCode); 268 var breakpoints = this._breakpointsForUISourceCode.get(uiSourceCode);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 345 }
342 346
343 /** 347 /**
344 * @param {!Workspace.UISourceCode} uiSourceCode 348 * @param {!Workspace.UISourceCode} uiSourceCode
345 * @return {!Array.<!{breakpoint: !Bindings.BreakpointManager.Breakpoint, uiLo cation: !Workspace.UILocation}>} 349 * @return {!Array.<!{breakpoint: !Bindings.BreakpointManager.Breakpoint, uiLo cation: !Workspace.UILocation}>}
346 */ 350 */
347 breakpointLocationsForUISourceCode(uiSourceCode) { 351 breakpointLocationsForUISourceCode(uiSourceCode) {
348 var uiSourceCodeBreakpoints = this._breakpointsForUISourceCode.get(uiSourceC ode); 352 var uiSourceCodeBreakpoints = this._breakpointsForUISourceCode.get(uiSourceC ode);
349 var lineNumbers = uiSourceCodeBreakpoints ? uiSourceCodeBreakpoints.keysArra y() : []; 353 var lineNumbers = uiSourceCodeBreakpoints ? uiSourceCodeBreakpoints.keysArra y() : [];
350 var result = []; 354 var result = [];
351 for (var i = 0; i < lineNumbers.length; ++i) { 355 for (var lineNumber of lineNumbers)
352 var lineBreakpoints = uiSourceCodeBreakpoints.get(lineNumbers[i]); 356 result = result.concat(this.breakpontLocationsForLineNumber(uiSourceCode, lineNumber));
353 var columnNumbers = lineBreakpoints.keysArray(); 357 return result;
354 for (var j = 0; j < columnNumbers.length; ++j) { 358 }
355 var columnBreakpoints = lineBreakpoints.get(columnNumbers[j]); 359
356 var lineNumber = parseInt(lineNumbers[i], 10); 360 /**
357 var columnNumber = parseInt(columnNumbers[j], 10); 361 * @param {!Workspace.UISourceCode} uiSourceCode
358 for (var k = 0; k < columnBreakpoints.length; ++k) { 362 * @param {number} lineNumber
359 var breakpoint = columnBreakpoints[k]; 363 * @return {!Array<!{breakpoint: !Bindings.BreakpointManager.Breakpoint, uiLoc ation: !Workspace.UILocation}>}
360 var uiLocation = uiSourceCode.uiLocation(lineNumber, columnNumber); 364 */
361 result.push({breakpoint: breakpoint, uiLocation: uiLocation}); 365 breakpontLocationsForLineNumber(uiSourceCode, lineNumber) {
lushnikov 2016/11/17 04:31:50 typo: breakpointLocationsForLineNumber
362 } 366 var uiSourceCodeBreakpoints = this._breakpointsForUISourceCode.get(uiSourceC ode);
367 if (!uiSourceCodeBreakpoints)
368 return [];
369 var lineBreakpoints = uiSourceCodeBreakpoints.get(lineNumber);
370 if (!lineBreakpoints)
371 return [];
372 var result = [];
373 for (var columnNumber of lineBreakpoints.keysArray()) {
374 var columnBreakpoints = lineBreakpoints.get(columnNumber);
375 for (var breakpoint of columnBreakpoints) {
376 var uiLocation = uiSourceCode.uiLocation(lineNumber, columnNumber);
377 result.push({breakpoint: breakpoint, uiLocation: uiLocation});
363 } 378 }
364 } 379 }
365 return result; 380 return result;
366 } 381 }
367 382
368 /** 383 /**
369 * @return {!Array.<!{breakpoint: !Bindings.BreakpointManager.Breakpoint, uiLo cation: !Workspace.UILocation}>} 384 * @return {!Array.<!{breakpoint: !Bindings.BreakpointManager.Breakpoint, uiLo cation: !Workspace.UILocation}>}
370 */ 385 */
371 allBreakpointLocations() { 386 allBreakpointLocations() {
372 var result = []; 387 var result = [];
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 this.sourceFileId = breakpoint._sourceFileId; 1108 this.sourceFileId = breakpoint._sourceFileId;
1094 this.lineNumber = breakpoint.lineNumber(); 1109 this.lineNumber = breakpoint.lineNumber();
1095 this.columnNumber = breakpoint.columnNumber(); 1110 this.columnNumber = breakpoint.columnNumber();
1096 this.condition = breakpoint.condition(); 1111 this.condition = breakpoint.condition();
1097 this.enabled = breakpoint.enabled(); 1112 this.enabled = breakpoint.enabled();
1098 } 1113 }
1099 }; 1114 };
1100 1115
1101 /** @type {!Bindings.BreakpointManager} */ 1116 /** @type {!Bindings.BreakpointManager} */
1102 Bindings.breakpointManager; 1117 Bindings.breakpointManager;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698