Web Inspector: small memory leak in scripts panel.
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Oct 2011 09:54:02 +0000 (09:54 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Oct 2011 09:54:02 +0000 (09:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=69744

Scripts panel doesn't clean the list of child views.

Reviewed by Yury Semikhatsky.

* inspector/front-end/DebuggerPresentationModel.js:
(WebInspector.DebuggerPresentationModel.prototype._debuggerReset):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._uiSourceCodeRemoved):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@97050 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/DebuggerPresentationModel.js
Source/WebCore/inspector/front-end/ScriptsPanel.js

index fc328eab40046ca7b03e0707244b9482f5dadaa9..5a6ecfd764d9ab569644e7f02fdd1ba1bfe0c294 100644 (file)
@@ -1,3 +1,17 @@
+2011-10-10  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: small memory leak in scripts panel.
+        https://bugs.webkit.org/show_bug.cgi?id=69744
+
+        Scripts panel doesn't clean the list of child views.
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/DebuggerPresentationModel.js:
+        (WebInspector.DebuggerPresentationModel.prototype._debuggerReset):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype._uiSourceCodeRemoved):
+
 2011-10-07  Yury Semikhatsky  <yurys@chromium.org>
 
         Web Inspector: allow to start WorkerContext paused
index 25302d0a01bdcbc8e7146fc168ac2b14101552f9..a728e98f0e44d9d5dd08feb052dee08f0fe5793c 100644 (file)
@@ -56,6 +56,7 @@ WebInspector.DebuggerPresentationModel = function()
 WebInspector.DebuggerPresentationModel.Events = {
     UISourceCodeAdded: "source-file-added",
     UISourceCodeReplaced: "source-file-replaced",
+    UISourceCodeRemoved: "source-file-removed",
     ConsoleMessageAdded: "console-message-added",
     ConsoleMessagesCleared: "console-messages-cleared",
     BreakpointAdded: "breakpoint-added",
@@ -430,8 +431,10 @@ WebInspector.DebuggerPresentationModel.prototype = {
 
     _debuggerReset: function()
     {
-        for (var id in this._rawSourceCode)
+        for (var id in this._rawSourceCode) {
+            this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeRemoved, this._rawSourceCode[id].sourceMapping.uiSourceCode);
             this._rawSourceCode[id].removeAllListeners();
+        }
         this._rawSourceCode = {};
         this._presentationCallFrames = [];
         this._selectedCallFrame = null;
index 637079dbe8f525157e5d75159136d2fe028ca380..8a0a0fec793fd9387231149236eb3ffbc879ba0d 100644 (file)
@@ -171,6 +171,7 @@ WebInspector.ScriptsPanel = function(presentationModel)
 
     this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.UISourceCodeAdded, this._uiSourceCodeAdded, this)
     this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.UISourceCodeReplaced, this._uiSourceCodeReplaced, this);
+    this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this);
     this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.ConsoleMessageAdded, this._consoleMessageAdded, this);
     this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.ConsoleMessagesCleared, this._consoleMessagesCleared, this);
     this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.BreakpointAdded, this._breakpointAdded, this);
@@ -253,6 +254,13 @@ WebInspector.ScriptsPanel.prototype = {
             this._showSourceFrameAndAddToHistory(uiSourceCode);
     },
 
+    _uiSourceCodeRemoved: function(event)
+    {
+        var uiSourceCode = event.data;
+        if (uiSourceCode._sourceFrame)
+            this.removeChildView(uiSourceCode._sourceFrame);
+    },
+
     _showScriptFoldersSettingChanged: function()
     {
         var selectedOption = this._filesSelectElement[this._filesSelectElement.selectedIndex];