Commit cc80e1cb authored by yurys@chromium.org's avatar yurys@chromium.org

Fix HeapSnapshotView leaks

HeapSnapshotView should be unsubscribed from events it has been subscribed to, otherwise it will leak when corresponding profile is removed.

BUG=None

Review URL: https://codereview.chromium.org/208053003

git-svn-id: svn://svn.chromium.org/blink/trunk@169738 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 0fdb79a5
......@@ -39,7 +39,7 @@ WebInspector.HeapSnapshotView = function(profile)
this.element.classList.add("heap-snapshot-view");
profile.profileType().addEventListener(WebInspector.HeapSnapshotProfileType.SnapshotReceived, this._onReceivSnapshot, this);
profile.profileType().addEventListener(WebInspector.HeapSnapshotProfileType.SnapshotReceived, this._onReceiveSnapshot, this);
profile.profileType().addEventListener(WebInspector.ProfileType.Events.RemoveProfileHeader, this._onProfileHeaderRemoved, this);
if (profile._profileType.id === WebInspector.TrackingHeapSnapshotProfileType.TypeId) {
......@@ -977,7 +977,7 @@ WebInspector.HeapSnapshotView.prototype = {
/**
* @param {!WebInspector.Event} event
*/
_onReceivSnapshot: function(event)
_onReceiveSnapshot: function(event)
{
this._updateControls();
},
......@@ -990,7 +990,7 @@ WebInspector.HeapSnapshotView.prototype = {
var profile = event.data;
if (this._profile === profile) {
this.detach();
this._profile.profileType().removeEventListener(WebInspector.ProfileType.Events.AddProfileHeader, this._onReceivSnapshot, this);
this._profile.profileType().removeEventListener(WebInspector.HeapSnapshotProfileType.SnapshotReceived, this._onReceiveSnapshot, this);
this._profile.profileType().removeEventListener(WebInspector.ProfileType.Events.RemoveProfileHeader, this._onProfileHeaderRemoved, this);
} else {
this._updateControls();
......
......@@ -42,8 +42,6 @@ WebInspector.SplitView = function(isVertical, secondIsSidebar, settingName, defa
this.registerRequiredCSS("splitView.css");
this.element.classList.add("split-view");
WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.ZoomChanged, this._onZoomChanged, this);
this._mainView = new WebInspector.VBox();
this._mainView.makeLayoutBoundary();
this._mainElement = this._mainView.element;
......@@ -572,7 +570,13 @@ WebInspector.SplitView.prototype = {
wasShown: function()
{
this._updateLayout();
this._forceUpdateLayout();
WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.ZoomChanged, this._onZoomChanged, this);
},
willHide: function()
{
WebInspector.zoomManager.removeEventListener(WebInspector.ZoomManager.Events.ZoomChanged, this._onZoomChanged, this);
},
onResize: function()
......@@ -779,15 +783,19 @@ WebInspector.SplitView.prototype = {
setting.set(state);
},
_forceUpdateLayout: function()
{
// Force layout even if sidebar size does not change.
this._sidebarSize = -1;
this._updateLayout();
},
/**
* @param {!WebInspector.Event} event
*/
_onZoomChanged: function(event)
{
// Force layout even if sidebar size does not change.
this._sidebarSize = -1;
if (this.isShowing())
this._updateLayout();
this._forceUpdateLayout();
},
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment