Diff
Modified: trunk/LayoutTests/ChangeLog (117050 => 117051)
--- trunk/LayoutTests/ChangeLog 2012-05-15 11:10:22 UTC (rev 117050)
+++ trunk/LayoutTests/ChangeLog 2012-05-15 11:18:07 UTC (rev 117051)
@@ -1,3 +1,23 @@
+2012-05-15 Yury Semikhatsky <[email protected]>
+
+ Web Inspector: implement "Reveal in Dominators view" context menu action
+ https://bugs.webkit.org/show_bug.cgi?id=86455
+
+ Reviewed by Pavel Feldman.
+
+ Test that an object can be revealed in the heap snapshot dominators view
+ by its heap snapshot object id.
+
+ * inspector/profiler/heap-snapshot-reveal-in-dominators-view-expected.txt: Added.
+ * inspector/profiler/heap-snapshot-reveal-in-dominators-view.html: Added.
+ * inspector/profiler/heap-snapshot-test.js:
+ (initialize_HeapSnapshotTest):
+ (initialize_HeapSnapshotTest.):
+ * platform/mac/Skipped:
+ * platform/qt/Skipped:
+ * platform/win/Skipped:
+ * platform/wincairo/Skipped:
+
2012-05-15 Zan Dobersek <[email protected]>
Unreviewed, marking plugins/npruntime/delete-plugin-within-getProperty.html
Added: trunk/LayoutTests/inspector/profiler/heap-snapshot-reveal-in-dominators-view-expected.txt (0 => 117051)
--- trunk/LayoutTests/inspector/profiler/heap-snapshot-reveal-in-dominators-view-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/profiler/heap-snapshot-reveal-in-dominators-view-expected.txt 2012-05-15 11:18:07 UTC (rev 117051)
@@ -0,0 +1,11 @@
+Tests that an object can be revealed in the Dominators view of detailed heap snapshots.
+
+Profiler was enabled.
+Detailed heap profiles were enabled.
+
+Running: testShowAll
+Revealing node...
+Node revealed.
+
+Profiler was disabled.
+
Property changes on: trunk/LayoutTests/inspector/profiler/heap-snapshot-reveal-in-dominators-view-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/inspector/profiler/heap-snapshot-reveal-in-dominators-view.html (0 => 117051)
--- trunk/LayoutTests/inspector/profiler/heap-snapshot-reveal-in-dominators-view.html (rev 0)
+++ trunk/LayoutTests/inspector/profiler/heap-snapshot-reveal-in-dominators-view.html 2012-05-15 11:18:07 UTC (rev 117051)
@@ -0,0 +1,45 @@
+<html>
+<head>
+ <script src=""
+ <script src=""
+<script>
+
+function test()
+{
+ var instanceCount = 25;
+ function createHeapSnapshot()
+ {
+ return InspectorTest.createHeapSnapshot(instanceCount);
+ }
+
+ InspectorTest.runHeapSnapshotTestSuite([
+ function testShowAll(next)
+ {
+ InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1);
+ var nodeAHeapSnapshotObjectId = 5 + 2*15 ; // Id of the 16th A node.
+
+ function step1()
+ {
+ InspectorTest.addSniffer(WebInspector.HeapSnapshotDominatorsDataGrid.prototype, "highlightNode", didHighlightNode);
+ WebInspector.panels.profiles.showObject(nodeAHeapSnapshotObjectId, "Dominators");
+ InspectorTest.addResult("Revealing node...");
+ }
+
+ function didHighlightNode(node)
+ {
+ InspectorTest.assertEquals(nodeAHeapSnapshotObjectId, node.snapshotNodeId, "Unxpected node highlighted.");
+ InspectorTest.addResult("Node revealed.");
+ next();
+ }
+ }
+ ]);
+}
+
+</script>
+</head>
+<body _onload_="runTest()">
+<p>
+Tests that an object can be revealed in the Dominators view of detailed heap snapshots.
+</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/profiler/heap-snapshot-reveal-in-dominators-view.html
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js (117050 => 117051)
--- trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js 2012-05-15 11:10:22 UTC (rev 117050)
+++ trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js 2012-05-15 11:18:07 UTC (rev 117051)
@@ -425,7 +425,8 @@
},
"nodes": nodes,
"edges": edges,
- "strings": ["", "A", "B", "a", "(GC roots)"]
+ "strings": ["", "A", "B", "a", "(GC roots)"],
+ maxJSObjectId: nextId - 1
};
result.snapshot.node_count = result.nodes.length / result.snapshot.meta.node_fields.length;
result.snapshot.edge_count = result.edges.length / result.snapshot.meta.edge_fields.length;
@@ -511,10 +512,11 @@
{
callback = InspectorTest.safeWrap(callback);
var uid = InspectorTest._nextUid++;
- var profile = { typeId: WebInspector.HeapSnapshotProfileType.TypeId, uid: uid, title: UserInitiatedProfileName + "." + uid };
+ var snapshot = generator();
+ var profile = "" WebInspector.HeapProfileHeader(UserInitiatedProfileName + "." + uid, uid, snapshot.maxJSObjectId);
+ delete snapshot.maxJSObjectId;
function pushGeneratedSnapshot(typeId, uid)
{
- var snapshot = generator();
snapshot.snapshot.typeId = profile.typeId;
snapshot.snapshot.title = profile.title;
snapshot.snapshot.uid = profile.uid;
Modified: trunk/LayoutTests/platform/mac/Skipped (117050 => 117051)
--- trunk/LayoutTests/platform/mac/Skipped 2012-05-15 11:10:22 UTC (rev 117050)
+++ trunk/LayoutTests/platform/mac/Skipped 2012-05-15 11:18:07 UTC (rev 117051)
@@ -281,6 +281,7 @@
# https://bugs.webkit.org/show_bug.cgi?id=50485
inspector/profiler/heap-snapshot-inspect-dom-wrapper.html
inspector/profiler/heap-snapshot-comparison-dom-groups-change.html
+inspector/profiler/heap-snapshot-reveal-in-dominators-view.html
inspector/profiler/heap-snapshot-summary-show-ranges.html
# Skipping newly added tests while I'm finding out what is wrong.
Modified: trunk/LayoutTests/platform/qt/Skipped (117050 => 117051)
--- trunk/LayoutTests/platform/qt/Skipped 2012-05-15 11:10:22 UTC (rev 117050)
+++ trunk/LayoutTests/platform/qt/Skipped 2012-05-15 11:18:07 UTC (rev 117051)
@@ -268,6 +268,7 @@
# https://bugs.webkit.org/show_bug.cgi?id=50485
inspector/profiler/heap-snapshot-inspect-dom-wrapper.html
inspector/profiler/heap-snapshot-comparison-dom-groups-change.html
+inspector/profiler/heap-snapshot-reveal-in-dominators-view.html
inspector/profiler/heap-snapshot-summary-show-ranges.html
# https://bugs.webkit.org/show_bug.cgi?id=40300
Modified: trunk/LayoutTests/platform/win/Skipped (117050 => 117051)
--- trunk/LayoutTests/platform/win/Skipped 2012-05-15 11:10:22 UTC (rev 117050)
+++ trunk/LayoutTests/platform/win/Skipped 2012-05-15 11:18:07 UTC (rev 117051)
@@ -1256,6 +1256,7 @@
# https://bugs.webkit.org/show_bug.cgi?id=50485
inspector/profiler/heap-snapshot-inspect-dom-wrapper.html
inspector/profiler/heap-snapshot-comparison-dom-groups-change.html
+inspector/profiler/heap-snapshot-reveal-in-dominators-view.html
inspector/profiler/heap-snapshot-summary-show-ranges.html
# https://bugs.webkit.org/show_bug.cgi?id=40300
Modified: trunk/LayoutTests/platform/wincairo/Skipped (117050 => 117051)
--- trunk/LayoutTests/platform/wincairo/Skipped 2012-05-15 11:10:22 UTC (rev 117050)
+++ trunk/LayoutTests/platform/wincairo/Skipped 2012-05-15 11:18:07 UTC (rev 117051)
@@ -1768,6 +1768,7 @@
# https://bugs.webkit.org/show_bug.cgi?id=50485
inspector/profiler/heap-snapshot-inspect-dom-wrapper.html
inspector/profiler/heap-snapshot-comparison-dom-groups-change.html
+inspector/profiler/heap-snapshot-reveal-in-dominators-view.html
inspector/profiler/heap-snapshot-summary-show-ranges.html
# https://bugs.webkit.org/show_bug.cgi?id=40300
Modified: trunk/Source/WebCore/ChangeLog (117050 => 117051)
--- trunk/Source/WebCore/ChangeLog 2012-05-15 11:10:22 UTC (rev 117050)
+++ trunk/Source/WebCore/ChangeLog 2012-05-15 11:18:07 UTC (rev 117051)
@@ -1,5 +1,45 @@
2012-05-15 Yury Semikhatsky <[email protected]>
+ Web Inspector: implement "Reveal in Dominators view" context menu action
+ https://bugs.webkit.org/show_bug.cgi?id=86455
+
+ Reviewed by Pavel Feldman.
+
+ Implemented "Reveal in Dominators view" context menu action for objects
+ in the console.
+
+ Test: inspector/profiler/heap-snapshot-reveal-in-dominators-view.html
+
+ * English.lproj/localizedStrings.js:
+ * inspector/front-end/HeapSnapshot.js:
+ (WebInspector.HeapSnapshot.prototype._nodeForSnapshotObjectId):
+ (WebInspector.HeapSnapshot.prototype.nodeClassName):
+ (WebInspector.HeapSnapshot.prototype.dominatorIdsForNode):
+ * inspector/front-end/HeapSnapshotDataGrids.js:
+ (WebInspector.HeapSnapshotDominatorsDataGrid):
+ (WebInspector.HeapSnapshotDominatorsDataGrid.prototype.setDataSource):
+ (WebInspector.HeapSnapshotDominatorsDataGrid.prototype.sortingChanged):
+ (WebInspector.HeapSnapshotDominatorsDataGrid.prototype.highlightObjectByHeapSnapshotId.didGetDominators):
+ (WebInspector.HeapSnapshotDominatorsDataGrid.prototype.highlightObjectByHeapSnapshotId.expandNextDominator):
+ (WebInspector.HeapSnapshotDominatorsDataGrid.prototype.highlightObjectByHeapSnapshotId):
+ * inspector/front-end/HeapSnapshotGridNodes.js:
+ (WebInspector.HeapSnapshotGridNode.prototype.childForPosition):
+ (WebInspector.HeapSnapshotGridNode.prototype.expandWithoutPopulate):
+ (WebInspector.HeapSnapshotGridNode.prototype._populateChildren.childrenRetrieved):
+ (WebInspector.HeapSnapshotGridNode.prototype._populateChildren):
+ (WebInspector.HeapSnapshotGridNode.prototype.sort):
+ (WebInspector.HeapSnapshotDominatorObjectNode.prototype.retrieveChildBySnapshotObjectId):
+ (WebInspector.HeapSnapshotDominatorObjectNode.prototype.retrieveChildBySnapshotObjectId.didGetNodePosition):
+ (WebInspector.HeapSnapshotDominatorObjectNode.prototype.retrieveChildBySnapshotObjectId.didPopulateChildren):
+ * inspector/front-end/HeapSnapshotProxy.js:
+ (WebInspector.HeapSnapshotProxy.prototype.dominatorIdsForNode):
+ * inspector/front-end/ProfilesPanel.js:
+ (WebInspector.RevealInHeapSnapshotContextMenuProvider.prototype.populateContextMenu.revealInSummaryView):
+ (WebInspector.RevealInHeapSnapshotContextMenuProvider.prototype.populateContextMenu.didReceiveHeapObjectId):
+ (WebInspector.RevealInHeapSnapshotContextMenuProvider.prototype.populateContextMenu):
+
+2012-05-15 Yury Semikhatsky <[email protected]>
+
Web Inspector: exception when switching to heap profiler comparison view
https://bugs.webkit.org/show_bug.cgi?id=86224
Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js
(Binary files differ)
Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js (117050 => 117051)
--- trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js 2012-05-15 11:10:22 UTC (rev 117050)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js 2012-05-15 11:18:07 UTC (rev 117051)
@@ -1286,15 +1286,36 @@
return diff;
},
- nodeClassName: function(snapshotObjectId)
+ _nodeForSnapshotObjectId: function(snapshotObjectId)
{
for (var it = this._allNodes; it.hasNext(); it.next()) {
if (it.node.id === snapshotObjectId)
- return it.node.className;
+ return it.node;
}
return null;
},
+ nodeClassName: function(snapshotObjectId)
+ {
+ var node = this._nodeForSnapshotObjectId(snapshotObjectId);
+ if (node)
+ return node.className;
+ return null;
+ },
+
+ dominatorIdsForNode: function(snapshotObjectId)
+ {
+ var node = this._nodeForSnapshotObjectId(snapshotObjectId);
+ if (!node)
+ return null;
+ var result = [];
+ while (!node.isRoot) {
+ result.push(node.id);
+ node.nodeIndex = node.dominatorIndex;
+ }
+ return result;
+ },
+
_parseFilter: function(filter)
{
if (!filter)
Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js (117050 => 117051)
--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js 2012-05-15 11:10:22 UTC (rev 117050)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js 2012-05-15 11:18:07 UTC (rev 117051)
@@ -615,6 +615,7 @@
retainedSize: { title: WebInspector.UIString("Retained Size"), width: "120px", sort: "descending", sortable: true }
};
WebInspector.HeapSnapshotSortableDataGrid.call(this, columns);
+ this._objectIdToSelect = null;
}
WebInspector.HeapSnapshotDominatorsDataGrid.prototype = {
@@ -635,11 +636,55 @@
var fakeNode = { nodeIndex: this.snapshot.rootNodeIndex };
this.setRootNode(new WebInspector.HeapSnapshotDominatorObjectNode(this, fakeNode));
this.rootNode().sort();
+
+ if (this._objectIdToSelect) {
+ this.highlightObjectByHeapSnapshotId(this._objectIdToSelect);
+ this._objectIdToSelect = null;
+ }
},
sortingChanged: function()
{
this.rootNode().sort();
+ },
+
+ /**
+ * @override
+ * @param {ProfilerAgent.HeapSnapshotObjectId} id
+ */
+ highlightObjectByHeapSnapshotId: function(id)
+ {
+ if (!this.snapshot) {
+ this._objectIdToSelect = id;
+ return;
+ }
+
+ function didGetDominators(dominatorIds)
+ {
+ if (!dominatorIds) {
+ WebInspector.log(WebInspector.UIString("Cannot find corresponding heap snapshot node"));
+ return;
+ }
+ var dominatorNode = this.rootNode();
+ expandNextDominator.call(this, dominatorIds, dominatorNode);
+ }
+
+ function expandNextDominator(dominatorIds, dominatorNode)
+ {
+ if (!dominatorNode) {
+ console.error("Cannot find dominator node");
+ return;
+ }
+ if (!dominatorIds.length) {
+ this.highlightNode(dominatorNode);
+ dominatorNode.element.scrollIntoViewIfNeeded(true);
+ return;
+ }
+ var snapshotObjectId = dominatorIds.pop();
+ dominatorNode.retrieveChildBySnapshotObjectId(snapshotObjectId, expandNextDominator.bind(this, dominatorIds));
+ }
+
+ this.snapshot.dominatorIdsForNode(parseInt(id, 10), didGetDominators.bind(this));
}
};
Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js (117050 => 117051)
--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js 2012-05-15 11:10:22 UTC (rev 117050)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js 2012-05-15 11:18:07 UTC (rev 117051)
@@ -97,6 +97,23 @@
return num.toFixed(0) + "\u2009%"; // \u2009 is a thin space.
},
+ /**
+ * @param {number} nodePosition
+ */
+ childForPosition: function(nodePosition)
+ {
+ var indexOfFirsChildInRange = 0;
+ for (var i = 0; i < this._retrievedChildrenRanges.length; i++) {
+ var range = this._retrievedChildrenRanges[i];
+ if (range.from <= nodePosition && nodePosition < range.to) {
+ var childIndex = indexOfFirsChildInRange + nodePosition - range.from;
+ return this.children[childIndex];
+ }
+ indexOfFirsChildInRange += range.to - range.from + 1;
+ }
+ return null;
+ },
+
_createValueCell: function(columnIdentifier)
{
var cell = document.createElement("td");
@@ -128,6 +145,14 @@
this._provider.sortAndRewind(this.comparator(), sorted.bind(this));
},
+ expandWithoutPopulate: function(callback)
+ {
+ // Make sure default _populate won't be invoked.
+ this.removeEventListener("populate", this._populate, this);
+ this.expand();
+ this._provider.sortAndRewind(this.comparator(), callback);
+ },
+
/**
* @param {?number} fromPosition
* @param {?number} toPosition
@@ -170,7 +195,7 @@
if (!this._retrievedChildrenRanges.length) {
if (items.startPosition > 0) {
this._retrievedChildrenRanges.push({from: 0, to: 0});
- insertShowMoreButton.call(this, 0, items.startPosition, insertionIndex);
+ insertShowMoreButton.call(this, 0, items.startPosition, insertionIndex++);
}
this._retrievedChildrenRanges.push({from: items.startPosition, to: items.endPosition});
for (var i = 0, l = items.length; i < l; ++i)
@@ -291,6 +316,7 @@
this._instanceCount = 0;
this._populateChildren(0, instanceCount, afterPopulate.bind(this));
}
+
this._provider.sortAndRewind(this.comparator(), afterSort.bind(this));
}
};
@@ -970,6 +996,35 @@
};
WebInspector.HeapSnapshotDominatorObjectNode.prototype = {
+ /**
+ * @param {number} snapshotObjectId
+ * @param {function(?WebInspector.HeapSnapshotDominatorObjectNode)} callback
+ */
+ retrieveChildBySnapshotObjectId: function(snapshotObjectId, callback)
+ {
+ function didExpand()
+ {
+ this._provider.nodePosition(snapshotObjectId, didGetNodePosition.bind(this));
+ }
+
+ function didGetNodePosition(nodePosition)
+ {
+ if (nodePosition === -1) {
+ this.collapse();
+ callback(null);
+ } else
+ this._populateChildren(nodePosition, null, didPopulateChildren.bind(this, nodePosition));
+ }
+
+ function didPopulateChildren(nodePosition)
+ {
+ var child = this.childForPosition(nodePosition);
+ callback(child);
+ }
+
+ this.expandWithoutPopulate(didExpand.bind(this));
+ },
+
_createChildNode: function(item)
{
return new WebInspector.HeapSnapshotDominatorObjectNode(this._dataGrid, item);
Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js (117050 => 117051)
--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js 2012-05-15 11:10:22 UTC (rev 117050)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js 2012-05-15 11:18:07 UTC (rev 117051)
@@ -427,6 +427,11 @@
this.callMethod(callback, "nodeClassName", snapshotObjectId);
},
+ dominatorIdsForNode: function(nodeIndex, callback)
+ {
+ this.callMethod(callback, "dominatorIdsForNode", nodeIndex);
+ },
+
createEdgesProvider: function(nodeIndex, filter)
{
return this.callFactoryMethod(null, "createEdgesProvider", "WebInspector.HeapSnapshotProviderProxy", nodeIndex, filter);
Modified: trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js (117050 => 117051)
--- trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2012-05-15 11:10:22 UTC (rev 117050)
+++ trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2012-05-15 11:18:07 UTC (rev 117051)
@@ -585,8 +585,9 @@
/**
* @param {ProfilerAgent.HeapSnapshotObjectId} snapshotObjectId
+ * @param {string} viewName
*/
- showObject: function(snapshotObjectId)
+ showObject: function(snapshotObjectId, viewName)
{
var heapProfiles = this.getProfiles(WebInspector.HeapSnapshotProfileType.TypeId);
for (var i = 0; i < heapProfiles.length; i++) {
@@ -594,9 +595,7 @@
// TODO: allow to choose snapshot if there are several options.
if (profile.maxJSObjectId >= snapshotObjectId) {
this.showProfile(profile);
- profile._profileView.changeView("Summary", function() {
- if (profile._profileView.dataGrid !== profile._profileView.constructorsDataGrid)
- return;
+ profile._profileView.changeView(viewName, function() {
profile._profileView.dataGrid.highlightObjectByHeapSnapshotId(snapshotObjectId);
});
break;
@@ -1098,20 +1097,21 @@
if (!heapProfiles.length)
return;
- function revealInSummaryView()
+ function revealInView(viewName)
{
- ProfilerAgent.getHeapObjectId(objectId, didReceiveHeapObjectId.bind(this));
+ ProfilerAgent.getHeapObjectId(objectId, didReceiveHeapObjectId.bind(this, viewName));
}
- function didReceiveHeapObjectId(error, result)
+ function didReceiveHeapObjectId(viewName, error, result)
{
if (WebInspector.inspectorView.currentPanel() !== WebInspector.panels.profiles)
return;
if (!error)
- WebInspector.panels.profiles.showObject(result);
+ WebInspector.panels.profiles.showObject(result, viewName);
}
- contextMenu.appendItem(WebInspector.UIString("Reveal in Summary View"), revealInSummaryView.bind(this));
+ contextMenu.appendItem(WebInspector.UIString("Reveal in Dominators View"), revealInView.bind(this, "Dominators"));
+ contextMenu.appendItem(WebInspector.UIString("Reveal in Summary View"), revealInView.bind(this, "Summary"));
}
}