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

Unified Diff: Source/devtools/front_end/ResourceScriptMapping.js

Issue 228863002: DevTools: remove setScriptFile from UISourceCode. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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: 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
}
/**

Powered by Google App Engine
This is Rietveld 408576698