Index: Source/devtools/front_end/ResourceScriptMapping.js |
diff --git a/Source/devtools/front_end/ResourceScriptMapping.js b/Source/devtools/front_end/ResourceScriptMapping.js |
index f46ef0eb328351d471bc61c52755c2a24dad7bf0..508b165103fa6742b353997d43a6c96bd81c3aaa 100644 |
--- a/Source/devtools/front_end/ResourceScriptMapping.js |
+++ b/Source/devtools/front_end/ResourceScriptMapping.js |
@@ -30,16 +30,39 @@ |
/** |
* @constructor |
- * @implements {WebInspector.ScriptSourceMapping} |
+ */ |
+WebInspector.SourceMappingWithScriptFile = function() |
+{ |
+} |
+ |
+WebInspector.SourceMappingWithScriptFile.prototype = { |
+ /** |
+ * @param {!WebInspector.UISourceCode} uiSourceCode |
+ * @return {?WebInspector.ScriptFile} |
+ */ |
+ scriptFile: function(uiSourceCode) |
+ { |
+ return null; |
+ } |
+} |
+ |
+/** |
+ * @constructor |
+ * @extends {WebInspector.SourceMappingWithScriptFile} |
+ * @implements {WebInspector.SourceMapping} |
* @param {!WebInspector.DebuggerModel} debuggerModel |
* @param {!WebInspector.Workspace} workspace |
*/ |
WebInspector.ResourceScriptMapping = function(debuggerModel, workspace) |
{ |
+ WebInspector.SourceMappingWithScriptFile.call(this); |
+ |
this._debuggerModel = debuggerModel; |
this._workspace = workspace; |
this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded, this._uiSourceCodeAddedToWorkspace, this); |
this._boundURLs = new StringSet(); |
+ /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.ResourceScriptFile>} */ |
+ this._scriptFiles = new Map(); |
debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this); |
} |
@@ -56,7 +79,7 @@ WebInspector.ResourceScriptMapping.prototype = { |
var uiSourceCode = this._workspaceUISourceCodeForScript(script); |
if (!uiSourceCode) |
return null; |
- var scriptFile = uiSourceCode.scriptFile(); |
+ var scriptFile = /** @type {?WebInspector.ResourceScriptFile} */ (this._scriptFiles.get(uiSourceCode)); |
if (scriptFile && ((scriptFile.hasDivergedFromVM() && !scriptFile.isMergingToVM()) || scriptFile.isDivergingFromVM())) |
return null; |
return new WebInspector.UILocation(uiSourceCode, debuggerModelLocation.lineNumber, debuggerModelLocation.columnNumber || 0); |
@@ -167,8 +190,7 @@ WebInspector.ResourceScriptMapping.prototype = { |
_bindUISourceCodeToScripts: function(uiSourceCode, scripts) |
{ |
console.assert(scripts.length); |
- var scriptFile = new WebInspector.ResourceScriptFile(this, uiSourceCode, scripts); |
- uiSourceCode.setScriptFile(scriptFile); |
+ this._scriptFiles.put(uiSourceCode, new WebInspector.ResourceScriptFile(this, uiSourceCode, scripts)); |
for (var i = 0; i < scripts.length; ++i) |
scripts[i].updateLocations(); |
uiSourceCode.setSourceMapping(this); |
@@ -180,10 +202,10 @@ WebInspector.ResourceScriptMapping.prototype = { |
*/ |
_unbindUISourceCode: function(uiSourceCode) |
{ |
- var scriptFile = /** @type {!WebInspector.ResourceScriptFile} */ (uiSourceCode.scriptFile()); |
+ var scriptFile = /** @type {?WebInspector.ResourceScriptFile} */ (this._scriptFiles.get(uiSourceCode)); |
if (scriptFile) { |
scriptFile.dispose(); |
- uiSourceCode.setScriptFile(null); |
+ this._scriptFiles.remove(uiSourceCode); |
} |
uiSourceCode.setSourceMapping(null); |
}, |
@@ -199,7 +221,19 @@ WebInspector.ResourceScriptMapping.prototype = { |
this._unbindUISourceCode(uiSourceCode); |
} |
this._boundURLs.clear(); |
+ this._scriptFiles.clear(); |
+ }, |
+ |
+ /** |
+ * @param {!WebInspector.UISourceCode} uiSourceCode |
+ * @return {?WebInspector.ResourceScriptFile} |
+ */ |
+ scriptFile: function(uiSourceCode) |
+ { |
+ return this._scriptFiles.get(uiSourceCode) || null; |
vsevik
2014/04/09 10:39:42
|| null is redundant
|
}, |
+ |
+ __proto__: WebInspector.SourceMappingWithScriptFile.prototype |
} |
/** |