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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js

Issue 2859073002: Revert of DevTools: support resolving a UILocation to multiple raw script locations (Closed)
Patch Set: Created 3 years, 7 months 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 var entry = mappings[first]; 338 var entry = mappings[first];
339 if (!first && entry && 339 if (!first && entry &&
340 (lineNumber < entry.lineNumber || (lineNumber === entry.lineNumber && co lumnNumber < entry.columnNumber))) 340 (lineNumber < entry.lineNumber || (lineNumber === entry.lineNumber && co lumnNumber < entry.columnNumber)))
341 return null; 341 return null;
342 return entry; 342 return entry;
343 } 343 }
344 344
345 /** 345 /**
346 * @param {string} sourceURL 346 * @param {string} sourceURL
347 * @param {number} lineNumber 347 * @param {number} lineNumber
348 * @return {!Array<!SDK.SourceMapEntry>} 348 * @return {?SDK.SourceMapEntry}
349 */ 349 */
350 mappingsForLine(sourceURL, lineNumber) { 350 firstSourceLineMapping(sourceURL, lineNumber) {
351 var mappings = this._reversedMappings(sourceURL); 351 var mappings = this._reversedMappings(sourceURL);
352 var startIndex = mappings.lowerBound(lineNumber, (lineNumber, mapping) => li neNumber - mapping.sourceLineNumber); 352 var index = mappings.lowerBound(lineNumber, lineComparator);
353 var endIndex = startIndex; 353 if (index >= mappings.length || mappings[index].sourceLineNumber !== lineNum ber)
354 while (endIndex < mappings.length && mappings[endIndex].sourceLineNumber === lineNumber) 354 return null;
355 ++endIndex; 355 return mappings[index];
356 return mappings.slice(startIndex, endIndex); 356
357 /**
358 * @param {number} lineNumber
359 * @param {!SDK.SourceMapEntry} mapping
360 * @return {number}
361 */
362 function lineComparator(lineNumber, mapping) {
363 return lineNumber - mapping.sourceLineNumber;
364 }
357 } 365 }
358 366
359 /** 367 /**
360 * @return {!Array<!SDK.SourceMapEntry>} 368 * @return {!Array<!SDK.SourceMapEntry>}
361 */ 369 */
362 mappings() { 370 mappings() {
363 if (this._mappings === null) { 371 if (this._mappings === null) {
364 this._mappings = []; 372 this._mappings = [];
365 this._eachSection(this._parseMap.bind(this)); 373 this._eachSection(this._parseMap.bind(this));
366 this._json = null; 374 this._json = null;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 * @param {?string} content 602 * @param {?string} content
595 * @param {?Array<!SDK.SourceMapEntry>} reverseMappings 603 * @param {?Array<!SDK.SourceMapEntry>} reverseMappings
596 */ 604 */
597 constructor(content, reverseMappings) { 605 constructor(content, reverseMappings) {
598 this.content = content; 606 this.content = content;
599 this.reverseMappings = reverseMappings; 607 this.reverseMappings = reverseMappings;
600 } 608 }
601 }; 609 };
602 610
603 SDK.TextSourceMap._sourcesListSymbol = Symbol('sourcesList'); 611 SDK.TextSourceMap._sourcesListSymbol = Symbol('sourcesList');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698