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

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

Issue 2290323003: DevTools: use eventListener arrays to avoid memory leaks in dispose methods (Closed)
Patch Set: Created 4 years, 4 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/NetworkMapping.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/FileSystemWorkspaceBinding.js
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/FileSystemWorkspaceBinding.js b/third_party/WebKit/Source/devtools/front_end/bindings/FileSystemWorkspaceBinding.js
index 957a49a939a3e7e016bde6288d5ede3f7c4f187a..352a45300b7f4fdc57623a4ab629a738959f6f0b 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/FileSystemWorkspaceBinding.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/FileSystemWorkspaceBinding.js
@@ -37,9 +37,11 @@ WebInspector.FileSystemWorkspaceBinding = function(isolatedFileSystemManager, wo
{
this._isolatedFileSystemManager = isolatedFileSystemManager;
this._workspace = workspace;
- this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded, this._fileSystemAdded, this);
- this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, this._fileSystemRemoved, this);
- this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemFilesChanged, this._fileSystemFilesChanged, this);
+ this._eventListeners = [
+ this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded, this._fileSystemAdded, this),
+ this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, this._fileSystemRemoved, this),
+ this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemFilesChanged, this._fileSystemFilesChanged, this)
+ ];
/** @type {!Map.<string, !WebInspector.FileSystemWorkspaceBinding.FileSystem>} */
this._boundFileSystems = new Map();
}
@@ -153,9 +155,7 @@ WebInspector.FileSystemWorkspaceBinding.prototype = {
dispose: function()
{
- this._isolatedFileSystemManager.removeEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded, this._fileSystemAdded, this);
- this._isolatedFileSystemManager.removeEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, this._fileSystemRemoved, this);
- this._isolatedFileSystemManager.dispose();
+ WebInspector.EventTarget.removeEventListeners(this._eventListeners);
for (var fileSystem of this._boundFileSystems.values()) {
fileSystem.dispose();
this._boundFileSystems.remove(fileSystem._fileSystem.path());
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/bindings/NetworkMapping.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698