https://bugs.webkit.org/show_bug.cgi?id=87098
Reviewed by Vsevolod Vlasov.
Added 2 context menu actions: 1) to jump from a node in the heap snapshot summary
view to the same node in the dominators view; 2) to jump from a node in the dominators
view to the same node in the summary view.
* inspector/front-end/HeapSnapshotDataGrids.js:
(WebInspector.HeapSnapshotSortableDataGrid): "sorting complete" event is only dispatched on
when the data grid is populated. If we switch to already populated data grid the event is not
dispatched. However when switching between different views of a heap snapshot we want to track
the moment when the data grid is shown and populated. I added
WebInspector.HeapSnapshotSortableDataGrid.Events.ContentShown for such cases. The event will always
be dispatched after the data grid is shown and its content is populated.
(WebInspector.HeapSnapshotSortableDataGrid.prototype.wasShown):
(WebInspector.HeapSnapshotSortableDataGrid.prototype._sortingComplete):
(WebInspector.HeapSnapshotSortableDataGrid.prototype.populateContextMenu.revealInDominatorsView):
(WebInspector.HeapSnapshotSortableDataGrid.prototype.populateContextMenu.else.revealInSummaryView):
(WebInspector.HeapSnapshotSortableDataGrid.prototype.populateContextMenu):
(WebInspector.HeapSnapshotSortableDataGrid.prototype._performSorting):
* inspector/front-end/HeapSnapshotGridNodes.js:
(WebInspector.HeapSnapshotGenericObjectNode.prototype._createObjectCell):
(WebInspector.HeapSnapshotDominatorObjectNode.prototype.retrieveChildBySnapshotObjectId):
* inspector/front-end/HeapSnapshotView.js:
(WebInspector.HeapSnapshotView.prototype.populateContextMenu):
(WebInspector.HeapSnapshotView.prototype.changeView.dataGridContentShown):
(WebInspector.HeapSnapshotView.prototype.changeView):
(WebInspector.HeapSnapshotView.prototype._onSelectedViewChanged):
(WebInspector.HeapSnapshotView.prototype._changeView):
* inspector/front-end/ProfilesPanel.js:
(WebInspector.ProfilesPanel.prototype._handleContextMenuEvent):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117940
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
2012-05-22 Yury Semikhatsky <yurys@chromium.org>
+ Web Inspector: allow showing selected object in another heap profiler view
+ https://bugs.webkit.org/show_bug.cgi?id=87098
+
+ Reviewed by Vsevolod Vlasov.
+
+ Added 2 context menu actions: 1) to jump from a node in the heap snapshot summary
+ view to the same node in the dominators view; 2) to jump from a node in the dominators
+ view to the same node in the summary view.
+
+ * inspector/front-end/HeapSnapshotDataGrids.js:
+ (WebInspector.HeapSnapshotSortableDataGrid): "sorting complete" event is only dispatched on
+ when the data grid is populated. If we switch to already populated data grid the event is not
+ dispatched. However when switching between different views of a heap snapshot we want to track
+ the moment when the data grid is shown and populated. I added
+ WebInspector.HeapSnapshotSortableDataGrid.Events.ContentShown for such cases. The event will always
+ be dispatched after the data grid is shown and its content is populated.
+ (WebInspector.HeapSnapshotSortableDataGrid.prototype.wasShown):
+ (WebInspector.HeapSnapshotSortableDataGrid.prototype._sortingComplete):
+ (WebInspector.HeapSnapshotSortableDataGrid.prototype.populateContextMenu.revealInDominatorsView):
+ (WebInspector.HeapSnapshotSortableDataGrid.prototype.populateContextMenu.else.revealInSummaryView):
+ (WebInspector.HeapSnapshotSortableDataGrid.prototype.populateContextMenu):
+ (WebInspector.HeapSnapshotSortableDataGrid.prototype._performSorting):
+ * inspector/front-end/HeapSnapshotGridNodes.js:
+ (WebInspector.HeapSnapshotGenericObjectNode.prototype._createObjectCell):
+ (WebInspector.HeapSnapshotDominatorObjectNode.prototype.retrieveChildBySnapshotObjectId):
+ * inspector/front-end/HeapSnapshotView.js:
+ (WebInspector.HeapSnapshotView.prototype.populateContextMenu):
+ (WebInspector.HeapSnapshotView.prototype.changeView.dataGridContentShown):
+ (WebInspector.HeapSnapshotView.prototype.changeView):
+ (WebInspector.HeapSnapshotView.prototype._onSelectedViewChanged):
+ (WebInspector.HeapSnapshotView.prototype._changeView):
+ * inspector/front-end/ProfilesPanel.js:
+ (WebInspector.ProfilesPanel.prototype._handleContextMenuEvent):
+
+2012-05-22 Yury Semikhatsky <yurys@chromium.org>
+
Web Inspector: show more button node should have height multiple of row height
https://bugs.webkit.org/show_bug.cgi?id=87104
* @type {WebInspector.HeapSnapshotGridNode}
*/
this._highlightedNode = null;
+ /**
+ * @type {boolean}
+ */
+ this._populatedAndSorted = false;
+ this.addEventListener("sorting complete", this._sortingComplete, this);
this.addEventListener("sorting changed", this.sortingChanged, this);
}
+WebInspector.HeapSnapshotSortableDataGrid.Events = {
+ ContentShown: "ContentShown"
+}
+
WebInspector.HeapSnapshotSortableDataGrid.prototype = {
/**
* @return {number}
children[i].dispose();
},
+ /**
+ * @override
+ */
+ wasShown: function()
+ {
+ if (this._populatedAndSorted)
+ this.dispatchEventToListeners(WebInspector.HeapSnapshotSortableDataGrid.Events.ContentShown, this);
+ },
+
+ _sortingComplete: function()
+ {
+ this.removeEventListener("sorting complete", this._sortingComplete, this);
+ this._populatedAndSorted = true;
+ this.dispatchEventToListeners(WebInspector.HeapSnapshotSortableDataGrid.Events.ContentShown, this);
+ },
+
+ /**
+ * @override
+ */
+ willHide: function()
+ {
+ this._clearCurrentHighlight();
+ },
+
+ /**
+ * @param {WebInspector.ContextMenu} contextMenu
+ */
+ populateContextMenu: function(contextMenu, event)
+ {
+ var td = event.target.enclosingNodeOrSelfWithNodeName("td");
+ if (!td)
+ return;
+ var node = td.heapSnapshotNode;
+ if (node instanceof WebInspector.HeapSnapshotInstanceNode || node instanceof WebInspector.HeapSnapshotObjectNode) {
+ function revealInDominatorsView()
+ {
+ WebInspector.panels.profiles.showObject(node.snapshotNodeId, "Dominators");
+ }
+ contextMenu.appendItem(WebInspector.UIString("Reveal in Dominators View"), revealInDominatorsView.bind(this));
+ } else if (node instanceof WebInspector.HeapSnapshotDominatorObjectNode) {
+ function revealInSummaryView()
+ {
+ WebInspector.panels.profiles.showObject(node.snapshotNodeId, "Summary");
+ }
+ contextMenu.appendItem(WebInspector.UIString("Reveal in Summary View"), revealInSummaryView.bind(this));
+ }
+ },
+
resetSortingCache: function()
{
delete this._lastSortColumnIdentifier;
if (child.expanded)
child.sort();
}
- this.recursiveSortingLeave();
this.updateVisibleNodes();
+ this.recursiveSortingLeave();
},
appendChildAfterSorting: function(child)
cell.addStyleClass("disclosure");
if (this.depth)
cell.style.setProperty("padding-left", (this.depth * this.dataGrid.indentWidth) + "px");
+ cell.heapSnapshotNode = this;
return cell;
},
callback(child);
}
+ // Make sure hasChildren flag is updated before expanding this node as updateHasChildren response
+ // may not have been received yet.
+ this.hasChildren = true;
this.expandWithoutPopulate(didExpand.bind(this));
},
this.viewSelectElement = document.createElement("select");
this.viewSelectElement.className = "status-bar-item";
- this.viewSelectElement.addEventListener("change", this._changeView.bind(this), false);
+ this.viewSelectElement.addEventListener("change", this._onSelectedViewChanged.bind(this), false);
this.views = [{title: "Summary", view: this.constructorsView, grid: this.constructorsDataGrid},
{title: "Comparison", view: this.diffView, grid: this.diffDataGrid},
profile.sidebarElement.subtitle = Number.bytesToString(s.totalSize);
},
+ /**
+ * @param {WebInspector.ContextMenu} contextMenu
+ */
+ populateContextMenu: function(contextMenu, event)
+ {
+ this.dataGrid.populateContextMenu(contextMenu, event);
+ },
+
_selectionChanged: function(event)
{
var selectedNode = event.target.selectedNode;
setTimeout(callback, 0);
return;
}
- var grid = this.views[viewIndex].grid;
- function sortingComplete()
+
+ function dataGridContentShown(event)
{
- grid.removeEventListener("sorting complete", sortingComplete, this);
- setTimeout(callback, 0);
+ var dataGrid = event.data;
+ dataGrid.removeEventListener(WebInspector.HeapSnapshotSortableDataGrid.Events.ContentShown, dataGridContentShown, this);
+ if (dataGrid === this.dataGrid)
+ callback();
}
- this.views[viewIndex].grid.addEventListener("sorting complete", sortingComplete, this);
+ this.views[viewIndex].grid.addEventListener(WebInspector.HeapSnapshotSortableDataGrid.Events.ContentShown, dataGridContentShown, this);
+
this.viewSelectElement.selectedIndex = viewIndex;
- this._changeView({target: {selectedIndex: viewIndex}});
+ this._changeView(viewIndex);
},
_updateDataSourceAndView: function()
}
},
- _changeView: function(event)
+ _onSelectedViewChanged: function(event)
{
- if (!event || !this._profileUid)
- return;
- if (event.target.selectedIndex === this.views.current)
+ this._changeView(event.target.selectedIndex);
+ },
+
+ _changeView: function(selectedIndex)
+ {
+ if (selectedIndex === this.views.current)
return;
- this.views.current = event.target.selectedIndex;
+ this.views.current = selectedIndex;
this.currentView.detach();
var view = this.views[this.views.current];
this.currentView = view.view;
return;
}
var contextMenu = new WebInspector.ContextMenu();
+ if (this.visibleView instanceof WebInspector.HeapSnapshotView)
+ this.visibleView.populateContextMenu(contextMenu, event);
contextMenu.appendItem(WebInspector.UIString("Load profile\u2026"), this._fileSelectorElement.click.bind(this._fileSelectorElement));
contextMenu.show(event);
},
}
@-webkit-keyframes row_highlight {
- from {background-color: rgb(255, 255, 120); }
- to { background-color: white; }
+ from {background-color: rgba(255, 255, 120, 1); }
+ to { background-color: rgba(255, 255, 120, 0); }
}