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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js b/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js
index 626b08ccbc2180a503ef0301cf26996e011f5c43..6ff41459509fc63009e271a4d5d4c1617c9b7967 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js
@@ -345,15 +345,23 @@
/**
* @param {string} sourceURL
* @param {number} lineNumber
- * @return {!Array<!SDK.SourceMapEntry>}
- */
- mappingsForLine(sourceURL, lineNumber) {
+ * @return {?SDK.SourceMapEntry}
+ */
+ firstSourceLineMapping(sourceURL, lineNumber) {
var mappings = this._reversedMappings(sourceURL);
- var startIndex = mappings.lowerBound(lineNumber, (lineNumber, mapping) => lineNumber - mapping.sourceLineNumber);
- var endIndex = startIndex;
- while (endIndex < mappings.length && mappings[endIndex].sourceLineNumber === lineNumber)
- ++endIndex;
- return mappings.slice(startIndex, endIndex);
+ var index = mappings.lowerBound(lineNumber, lineComparator);
+ if (index >= mappings.length || mappings[index].sourceLineNumber !== lineNumber)
+ return null;
+ return mappings[index];
+
+ /**
+ * @param {number} lineNumber
+ * @param {!SDK.SourceMapEntry} mapping
+ * @return {number}
+ */
+ function lineComparator(lineNumber, mapping) {
+ return lineNumber - mapping.sourceLineNumber;
+ }
}
/**

Powered by Google App Engine
This is Rietveld 408576698