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

Unified Diff: third_party/WebKit/Source/devtools/front_end/bindings/DefaultScriptMapping.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
Index: third_party/WebKit/Source/devtools/front_end/bindings/DefaultScriptMapping.js
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/DefaultScriptMapping.js b/third_party/WebKit/Source/devtools/front_end/bindings/DefaultScriptMapping.js
index 8a6d5f67d23182a26063300bb94368ea4a4d59bd..14b82d36ab6f0043f15c2c71162c83f58682e982 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/DefaultScriptMapping.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/DefaultScriptMapping.js
@@ -39,11 +39,15 @@ WebInspector.DefaultScriptMapping = function(debuggerModel, workspace, debuggerW
{
this._debuggerModel = debuggerModel;
this._debuggerWorkspaceBinding = debuggerWorkspaceBinding;
- this._workspace = workspace;
- this._projectId = WebInspector.DefaultScriptMapping.projectIdForTarget(debuggerModel.target());
- this._project = new WebInspector.ContentProviderBasedProject(this._workspace, this._projectId, WebInspector.projectTypes.Debugger, "");
- debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this);
- this._debuggerReset();
+ var projectId = WebInspector.DefaultScriptMapping.projectIdForTarget(debuggerModel.target());
+ this._project = new WebInspector.ContentProviderBasedProject(workspace, projectId, WebInspector.projectTypes.Debugger, "");
+ /** @type {!Map.<string, !WebInspector.UISourceCode>} */
+ this._uiSourceCodeForScriptId = new Map();
+ /** @type {!Map.<!WebInspector.UISourceCode, string>} */
+ this._scriptIdForUISourceCode = new Map();
+ this._eventListeners = [
+ debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this)
+ ];
}
WebInspector.DefaultScriptMapping._scriptSymbol = Symbol("symbol");
@@ -131,14 +135,15 @@ WebInspector.DefaultScriptMapping.prototype = {
_debuggerReset: function()
{
- /** @type {!Map.<string, !WebInspector.UISourceCode>} */
- this._uiSourceCodeForScriptId = new Map();
- this._scriptIdForUISourceCode = new Map();
+ this._uiSourceCodeForScriptId.clear();
+ this._scriptIdForUISourceCode.clear();
this._project.reset();
},
dispose: function()
{
+ WebInspector.EventTarget.removeEventListeners(this._eventListeners);
+ this._debuggerReset();
this._project.dispose();
}
}

Powered by Google App Engine
This is Rietveld 408576698