Commit af19d4de authored by alph@chromium.org's avatar alph@chromium.org

DevTools: Do not switch to other profile when revealing a node

When a node to reveal exists in the current profile show it right there
rather than switching to another profile.

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

git-svn-id: svn://svn.chromium.org/blink/trunk@181708 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent dc25e54e
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
/** /**
* @constructor * @constructor
* @implements {WebInspector.ProfileType.DataDisplayDelegate}
* @extends {WebInspector.VBox} * @extends {WebInspector.VBox}
* @param {!WebInspector.ProfileType.DataDisplayDelegate} dataDisplayDelegate * @param {!WebInspector.ProfileType.DataDisplayDelegate} dataDisplayDelegate
* @param {!WebInspector.HeapProfileHeader} profile * @param {!WebInspector.HeapProfileHeader} profile
...@@ -48,12 +49,14 @@ WebInspector.HeapSnapshotView = function(dataDisplayDelegate, profile) ...@@ -48,12 +49,14 @@ WebInspector.HeapSnapshotView = function(dataDisplayDelegate, profile)
this._trackingOverviewGrid.addEventListener(WebInspector.HeapTrackingOverviewGrid.IdsRangeChanged, this._onIdsRangeChanged.bind(this)); this._trackingOverviewGrid.addEventListener(WebInspector.HeapTrackingOverviewGrid.IdsRangeChanged, this._onIdsRangeChanged.bind(this));
} }
this._parentDataDisplayDelegate = dataDisplayDelegate;
this._splitView = new WebInspector.SplitView(false, true, "heapSnapshotSplitViewState", 200, 200); this._splitView = new WebInspector.SplitView(false, true, "heapSnapshotSplitViewState", 200, 200);
this._splitView.show(this.element); this._splitView.show(this.element);
this._containmentView = new WebInspector.VBox(); this._containmentView = new WebInspector.VBox();
this._containmentView.setMinimumSize(50, 25); this._containmentView.setMinimumSize(50, 25);
this._containmentDataGrid = new WebInspector.HeapSnapshotContainmentDataGrid(dataDisplayDelegate); this._containmentDataGrid = new WebInspector.HeapSnapshotContainmentDataGrid(this);
this._containmentDataGrid.show(this._containmentView.element); this._containmentDataGrid.show(this._containmentView.element);
this._containmentDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._selectionChanged, this); this._containmentDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._selectionChanged, this);
...@@ -62,21 +65,21 @@ WebInspector.HeapSnapshotView = function(dataDisplayDelegate, profile) ...@@ -62,21 +65,21 @@ WebInspector.HeapSnapshotView = function(dataDisplayDelegate, profile)
this._constructorsView = new WebInspector.VBox(); this._constructorsView = new WebInspector.VBox();
this._constructorsView.setMinimumSize(50, 25); this._constructorsView.setMinimumSize(50, 25);
this._constructorsDataGrid = new WebInspector.HeapSnapshotConstructorsDataGrid(dataDisplayDelegate); this._constructorsDataGrid = new WebInspector.HeapSnapshotConstructorsDataGrid(this);
this._constructorsDataGrid.show(this._constructorsView.element); this._constructorsDataGrid.show(this._constructorsView.element);
this._constructorsDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._selectionChanged, this); this._constructorsDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._selectionChanged, this);
this._diffView = new WebInspector.VBox(); this._diffView = new WebInspector.VBox();
this._diffView.setMinimumSize(50, 25); this._diffView.setMinimumSize(50, 25);
this._diffDataGrid = new WebInspector.HeapSnapshotDiffDataGrid(dataDisplayDelegate); this._diffDataGrid = new WebInspector.HeapSnapshotDiffDataGrid(this);
this._diffDataGrid.show(this._diffView.element); this._diffDataGrid.show(this._diffView.element);
this._diffDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._selectionChanged, this); this._diffDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._selectionChanged, this);
if (profile._hasAllocationStacks) { if (profile._hasAllocationStacks) {
this._allocationView = new WebInspector.VBox(); this._allocationView = new WebInspector.VBox();
this._allocationView.setMinimumSize(50, 25); this._allocationView.setMinimumSize(50, 25);
this._allocationDataGrid = new WebInspector.AllocationDataGrid(profile.target() , dataDisplayDelegate); this._allocationDataGrid = new WebInspector.AllocationDataGrid(profile.target() , this);
this._allocationDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._onSelectAllocationNode, this); this._allocationDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._onSelectAllocationNode, this);
this._allocationDataGrid.show(this._allocationView.element); this._allocationDataGrid.show(this._allocationView.element);
...@@ -116,7 +119,7 @@ WebInspector.HeapSnapshotView = function(dataDisplayDelegate, profile) ...@@ -116,7 +119,7 @@ WebInspector.HeapSnapshotView = function(dataDisplayDelegate, profile)
this._splitView.hideDefaultResizer(); this._splitView.hideDefaultResizer();
this._splitView.installResizer(splitViewResizer); this._splitView.installResizer(splitViewResizer);
this._retainmentDataGrid = new WebInspector.HeapSnapshotRetainmentDataGrid(dataDisplayDelegate); this._retainmentDataGrid = new WebInspector.HeapSnapshotRetainmentDataGrid(this);
this._retainmentDataGrid.show(this._retainmentView.element); this._retainmentDataGrid.show(this._retainmentView.element);
this._retainmentDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._inspectedObjectChanged, this); this._retainmentDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._inspectedObjectChanged, this);
this._retainmentDataGrid.reset(); this._retainmentDataGrid.reset();
...@@ -443,6 +446,29 @@ WebInspector.HeapSnapshotView.StatisticsPerspective.prototype = { ...@@ -443,6 +446,29 @@ WebInspector.HeapSnapshotView.StatisticsPerspective.prototype = {
WebInspector.HeapSnapshotView.prototype = { WebInspector.HeapSnapshotView.prototype = {
/**
* @override
* @param {?WebInspector.ProfileHeader} profile
* @return {?WebInspector.View}
*/
showProfile: function(profile)
{
return this._parentDataDisplayDelegate.showProfile(profile);
},
/**
* @override
* @param {!HeapProfilerAgent.HeapSnapshotObjectId} snapshotObjectId
* @param {string} perspectiveName
*/
showObject: function(snapshotObjectId, perspectiveName)
{
if (snapshotObjectId <= this._profile.maxJSObjectId)
this.highlightLiveObject(perspectiveName, snapshotObjectId);
else
this._parentDataDisplayDelegate.showObject(snapshotObjectId, perspectiveName);
},
_refreshView: function() _refreshView: function()
{ {
this._profile.load(profileCallback.bind(this)); this._profile.load(profileCallback.bind(this));
...@@ -466,7 +492,8 @@ WebInspector.HeapSnapshotView.prototype = { ...@@ -466,7 +492,8 @@ WebInspector.HeapSnapshotView.prototype = {
/** /**
* @param {!WebInspector.HeapSnapshotCommon.Statistics} statistics * @param {!WebInspector.HeapSnapshotCommon.Statistics} statistics
*/ */
_gotStatistics: function(statistics) { _gotStatistics: function(statistics)
{
this._statisticsView.setTotal(statistics.total); this._statisticsView.setTotal(statistics.total);
this._statisticsView.addRecord(statistics.code, WebInspector.UIString("Code"), "#f77"); this._statisticsView.addRecord(statistics.code, WebInspector.UIString("Code"), "#f77");
this._statisticsView.addRecord(statistics.strings, WebInspector.UIString("Strings"), "#5e5"); this._statisticsView.addRecord(statistics.strings, WebInspector.UIString("Strings"), "#5e5");
...@@ -855,6 +882,9 @@ WebInspector.HeapSnapshotView.prototype = { ...@@ -855,6 +882,9 @@ WebInspector.HeapSnapshotView.prototype = {
{ {
}, },
/**
* @param {number} selectedIndex
*/
_changePerspective: function(selectedIndex) _changePerspective: function(selectedIndex)
{ {
if (selectedIndex === this._currentPerspectiveIndex) if (selectedIndex === this._currentPerspectiveIndex)
...@@ -886,7 +916,7 @@ WebInspector.HeapSnapshotView.prototype = { ...@@ -886,7 +916,7 @@ WebInspector.HeapSnapshotView.prototype = {
/** /**
* @param {string} perspectiveName * @param {string} perspectiveName
* @param {number} snapshotObjectId * @param {!HeapProfilerAgent.HeapSnapshotObjectId} snapshotObjectId
*/ */
highlightLiveObject: function(perspectiveName, snapshotObjectId) highlightLiveObject: function(perspectiveName, snapshotObjectId)
{ {
......
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