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

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

Issue 2301023003: DevTools: fix disposing of main debugger script mappings (Closed)
Patch Set: main debugger mappings do not leak memory Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/bindings/DebuggerWorkspaceBinding.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/bindings/CompilerScriptMapping.js
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/CompilerScriptMapping.js b/third_party/WebKit/Source/devtools/front_end/bindings/CompilerScriptMapping.js
index ab377c846aa777dec78ebf6877ad489f397e064b..4b7d5151039140fdc5e7ddfb308632699e2dda8c 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/CompilerScriptMapping.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/CompilerScriptMapping.js
@@ -41,8 +41,6 @@ WebInspector.CompilerScriptMapping = function(debuggerModel, workspace, networkM
{
this._target = debuggerModel.target();
this._debuggerModel = debuggerModel;
- this._workspace = workspace;
- this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded, this._uiSourceCodeAddedToWorkspace, this);
this._networkMapping = networkMapping;
this._networkProject = networkProject;
this._debuggerWorkspaceBinding = debuggerWorkspaceBinding;
@@ -58,13 +56,14 @@ WebInspector.CompilerScriptMapping = function(debuggerModel, workspace, networkM
/** @type {!Map.<string, !WebInspector.UISourceCode>} */
this._stubUISourceCodes = new Map();
- this._stubProjectID = "compiler-script-project";
- this._stubProject = new WebInspector.ContentProviderBasedProject(this._workspace, this._stubProjectID, WebInspector.projectTypes.Service, "");
- debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this);
+ var projectId = WebInspector.CompilerScriptMapping.projectIdForTarget(this._target);
dgozman 2016/09/02 21:05:10 Let's have a test for sourcemaps in multiple targe
lushnikov 2016/09/08 01:32:04 Sourcemaps actually work; the stubproject works to
+ this._stubProject = new WebInspector.ContentProviderBasedProject(workspace, projectId, WebInspector.projectTypes.Service, "");
+ this._eventListeners = [
+ workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded, this._uiSourceCodeAddedToWorkspace, this),
+ debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this)
+ ];
}
-WebInspector.CompilerScriptMapping.StubProjectID = "compiler-script-project";
-
WebInspector.CompilerScriptMapping._originSymbol = Symbol("origin");
/**
@@ -389,6 +388,17 @@ WebInspector.CompilerScriptMapping.prototype = {
dispose: function()
{
- this._workspace.removeEventListener(WebInspector.Workspace.Events.UISourceCodeAdded, this._uiSourceCodeAddedToWorkspace, this);
+ WebInspector.EventTarget.removeEventListeners(this._eventListeners);
+ this._debuggerReset();
+ this._stubProject.dispose();
}
}
+
+/**
+ * @param {!WebInspector.Target} target
+ * @return {string}
+ */
+WebInspector.CompilerScriptMapping.projectIdForTarget = function(target)
+{
+ return "compiler-script-project:" + target.id();
+}
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/bindings/DebuggerWorkspaceBinding.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698