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

Unified Diff: Source/devtools/front_end/bindings/CompilerScriptMapping.js

Issue 1328843002: DevTools: introduce WI.SourceMap.Entry structure and cleanup WI.SourceMap API. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix test Created 5 years, 3 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: Source/devtools/front_end/bindings/CompilerScriptMapping.js
diff --git a/Source/devtools/front_end/bindings/CompilerScriptMapping.js b/Source/devtools/front_end/bindings/CompilerScriptMapping.js
index bc8f8a7d6a42ba83d9de22fc5726854a0b68ca8b..20684e49d8598efad540f84995a2f7b559933768 100644
--- a/Source/devtools/front_end/bindings/CompilerScriptMapping.js
+++ b/Source/devtools/front_end/bindings/CompilerScriptMapping.js
@@ -97,13 +97,12 @@ WebInspector.CompilerScriptMapping.prototype = {
var lineNumber = debuggerModelLocation.lineNumber;
var columnNumber = debuggerModelLocation.columnNumber || 0;
var entry = sourceMap.findEntry(lineNumber, columnNumber);
- if (!entry || entry.length === 2)
+ if (!entry || !entry.sourceURL)
return null;
- var url = /** @type {string} */ (entry[2]);
- var uiSourceCode = this._networkMapping.uiSourceCodeForURL(url, this._target);
+ var uiSourceCode = this._networkMapping.uiSourceCodeForURL(/** @type {string} */ (entry.sourceURL), this._target);
if (!uiSourceCode)
return null;
- return uiSourceCode.uiLocation(/** @type {number} */ (entry[3]), /** @type {number} */ (entry[4]));
+ return uiSourceCode.uiLocation(/** @type {number} */ (entry.sourceLineNumber), /** @type {number} */ (entry.sourceColumnNumber));
},
/**
@@ -125,12 +124,13 @@ WebInspector.CompilerScriptMapping.prototype = {
return null;
var script = /** @type {!WebInspector.Script} */ (this._scriptForSourceMap.get(sourceMap));
console.assert(script);
+ var entry = null;
var mappingSearchLinesCount = 5;
pfeldman 2015/09/04 01:38:36 Lets remove this.
lushnikov 2015/09/04 17:46:45 Done.
- // We do not require precise (breakpoint) location but limit the number of lines to search or mapping.
- var entry = sourceMap.findEntryReversed(networkURL, lineNumber, mappingSearchLinesCount);
+ for (var i = 0; i < mappingSearchLinesCount && !entry; ++i)
+ entry = sourceMap.firstSourceLineMapping(networkURL, lineNumber + i);
if (!entry)
return null;
- return this._debuggerModel.createRawLocation(script, /** @type {number} */ (entry[0]), /** @type {number} */ (entry[1]));
+ return this._debuggerModel.createRawLocation(script, entry.lineNumber, entry.columnNumber);
},
/**
@@ -252,7 +252,7 @@ WebInspector.CompilerScriptMapping.prototype = {
var sourceMap = this._sourceMapForURL.get(networkURL);
if (!sourceMap)
return true;
- return !!sourceMap.findEntryReversed(networkURL, lineNumber, 0);
+ return !!sourceMap.firstSourceLineMapping(networkURL, lineNumber);
},
/**

Powered by Google App Engine
This is Rietveld 408576698