Commit 941a8737 authored by Alexei Filippov's avatar Alexei Filippov Committed by Commit Bot

DevTools: Fix reveal node in Summary view context menu on memory panel.

It had been broken in
https://chromium.googlesource.com/chromium/src/+/e17afc530a565d3d1c66f316750c817af60cb3ff

Change-Id: Ia78f1592a284d3a7acc9cc33cb54a2a677d1f743
Reviewed-on: https://chromium-review.googlesource.com/980808Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Alexei Filippov <alph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546223}
parent efa536ef
...@@ -125,16 +125,9 @@ Profiler.HeapSnapshotSortableDataGrid = class extends DataGrid.DataGrid { ...@@ -125,16 +125,9 @@ Profiler.HeapSnapshotSortableDataGrid = class extends DataGrid.DataGrid {
if (!td) if (!td)
return; return;
const node = td.heapSnapshotNode; const node = td.heapSnapshotNode;
contextMenu.revealSection().appendItem(ls`Reveal in Summary view`, () => {
/** this._dataDisplayDelegate.showObject(node.snapshotNodeId, ls`Summary`);
* @this {Profiler.HeapSnapshotSortableDataGrid} });
*/
function revealInSummaryView() {
this._dataDisplayDelegate.showObject(node.snapshotNodeId, 'Summary');
}
if (node instanceof Profiler.HeapSnapshotRetainingObjectNode)
contextMenu.revealSection().appendItem(Common.UIString('Reveal in Summary view'), revealInSummaryView.bind(this));
} }
resetSortingCache() { resetSortingCache() {
......
...@@ -167,6 +167,8 @@ Profiler.HeapSnapshotView = class extends UI.SimpleView { ...@@ -167,6 +167,8 @@ Profiler.HeapSnapshotView = class extends UI.SimpleView {
this._populate(); this._populate();
this._searchThrottler = new Common.Throttler(0); this._searchThrottler = new Common.Throttler(0);
this.element.addEventListener('contextmenu', this._handleContextMenuEvent.bind(this), true);
for (const existingProfile of this._profiles()) for (const existingProfile of this._profiles())
existingProfile.addEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateControls, this); existingProfile.addEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateControls, this);
} }
...@@ -297,6 +299,16 @@ Profiler.HeapSnapshotView = class extends UI.SimpleView { ...@@ -297,6 +299,16 @@ Profiler.HeapSnapshotView = class extends UI.SimpleView {
node.select(); node.select();
} }
/**
* @param {!Event} event
*/
_handleContextMenuEvent(event) {
const contextMenu = new UI.ContextMenu(event);
if (this._dataGrid)
this._dataGrid.populateContextMenu(contextMenu, event);
contextMenu.show();
}
/** /**
* @override * @override
* @param {!UI.SearchableView.SearchConfig} searchConfig * @param {!UI.SearchableView.SearchConfig} searchConfig
...@@ -427,15 +439,6 @@ Profiler.HeapSnapshotView = class extends UI.SimpleView { ...@@ -427,15 +439,6 @@ Profiler.HeapSnapshotView = class extends UI.SimpleView {
return this._profile.profileType().getProfiles(); return this._profile.profileType().getProfiles();
} }
/**
* @param {!UI.ContextMenu} contextMenu
* @param {!Event} event
*/
populateContextMenu(contextMenu, event) {
if (this._dataGrid)
this._dataGrid.populateContextMenu(contextMenu, event);
}
/** /**
* @param {!Common.Event} event * @param {!Common.Event} event
*/ */
......
...@@ -295,9 +295,6 @@ Profiler.ProfilesPanel = class extends UI.PanelWithSidebar { ...@@ -295,9 +295,6 @@ Profiler.ProfilesPanel = class extends UI.PanelWithSidebar {
*/ */
_handleContextMenuEvent(event) { _handleContextMenuEvent(event) {
const contextMenu = new UI.ContextMenu(event); const contextMenu = new UI.ContextMenu(event);
if (this.visibleView instanceof Profiler.HeapSnapshotView)
this.visibleView.populateContextMenu(contextMenu, event);
if (this.panelSidebarElement().isSelfOrAncestor(event.srcElement)) { if (this.panelSidebarElement().isSelfOrAncestor(event.srcElement)) {
contextMenu.defaultSection().appendItem( contextMenu.defaultSection().appendItem(
Common.UIString('Load\u2026'), this._fileSelectorElement.click.bind(this._fileSelectorElement)); Common.UIString('Load\u2026'), this._fileSelectorElement.click.bind(this._fileSelectorElement));
......
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