Web Inspector: implement "Reveal in Dominators view" context menu action
authoryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 May 2012 11:18:07 +0000 (11:18 +0000)
committeryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 May 2012 11:18:07 +0000 (11:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=86455

Reviewed by Pavel Feldman.

Source/WebCore:

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):

LayoutTests:

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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@117051 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/profiler/heap-snapshot-reveal-in-dominators-view-expected.txt [new file with mode: 0644]
LayoutTests/inspector/profiler/heap-snapshot-reveal-in-dominators-view.html [new file with mode: 0644]
LayoutTests/inspector/profiler/heap-snapshot-test.js
LayoutTests/platform/mac/Skipped
LayoutTests/platform/qt/Skipped
LayoutTests/platform/win/Skipped
LayoutTests/platform/wincairo/Skipped
Source/WebCore/ChangeLog
Source/WebCore/English.lproj/localizedStrings.js
Source/WebCore/inspector/front-end/HeapSnapshot.js
Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js
Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js
Source/WebCore/inspector/front-end/HeapSnapshotProxy.js
Source/WebCore/inspector/front-end/ProfilesPanel.js

index 15f8855..2f22be8 100644 (file)
@@ -1,3 +1,23 @@
+2012-05-15  Yury Semikhatsky  <yurys@chromium.org>
+
+        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  <zandobersek@gmail.com>
 
         Unreviewed, marking plugins/npruntime/delete-plugin-within-getProperty.html
diff --git a/LayoutTests/inspector/profiler/heap-snapshot-reveal-in-dominators-view-expected.txt b/LayoutTests/inspector/profiler/heap-snapshot-reveal-in-dominators-view-expected.txt
new file mode 100644 (file)
index 0000000..936e443
--- /dev/null
@@ -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.
+
diff --git a/LayoutTests/inspector/profiler/heap-snapshot-reveal-in-dominators-view.html b/LayoutTests/inspector/profiler/heap-snapshot-reveal-in-dominators-view.html
new file mode 100644 (file)
index 0000000..107bf94
--- /dev/null
@@ -0,0 +1,45 @@
+<html>
+<head>
+  <script src="../../http/tests/inspector/inspector-test.js"></script>
+  <script src="heap-snapshot-test.js"></script>
+<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>
index f749d21..f988e41 100644 (file)
@@ -425,7 +425,8 @@ InspectorTest.createHeapSnapshot = function(instanceCount, firstId)
         },
         "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 @@ InspectorTest.takeAndOpenSnapshot = function(generator, callback)
 {
     callback = InspectorTest.safeWrap(callback);
     var uid = InspectorTest._nextUid++;
-    var profile = { typeId: WebInspector.HeapSnapshotProfileType.TypeId, uid: uid, title: UserInitiatedProfileName + "." + uid };
+    var snapshot = generator();
+    var profile = new 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;
index 2438796..790d2e1 100644 (file)
@@ -281,6 +281,7 @@ inspector/debugger/xhr-breakpoints.html
 # 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.
index bdd8861..d080268 100644 (file)
@@ -268,6 +268,7 @@ inspector/debugger/xhr-breakpoints.html
 # 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
index 9b49efa..04d77d9 100644 (file)
@@ -1256,6 +1256,7 @@ inspector/debugger/xhr-breakpoints.html
 # 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
index 06d4887..52596a9 100644 (file)
@@ -1768,6 +1768,7 @@ inspector/debugger/xhr-breakpoints.html
 # 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
index ef4cffb..ac580a1 100644 (file)
@@ -1,5 +1,45 @@
 2012-05-15  Yury Semikhatsky  <yurys@chromium.org>
 
+        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  <yurys@chromium.org>
+
         Web Inspector: exception when switching to heap profiler comparison view
         https://bugs.webkit.org/show_bug.cgi?id=86224
 
index e186d8d..ff1a09f 100644 (file)
Binary files a/Source/WebCore/English.lproj/localizedStrings.js and b/Source/WebCore/English.lproj/localizedStrings.js differ
index 16b3307..5c57ec5 100644 (file)
@@ -1286,15 +1286,36 @@ WebInspector.HeapSnapshot.prototype = {
         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)
index b2e1251..b779e6e 100644 (file)
@@ -615,6 +615,7 @@ WebInspector.HeapSnapshotDominatorsDataGrid = function()
         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 @@ WebInspector.HeapSnapshotDominatorsDataGrid.prototype = {
         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));
     }
 };
 
index 540cc9b..efff3b3 100644 (file)
@@ -97,6 +97,23 @@ WebInspector.HeapSnapshotGridNode.prototype = {
         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 @@ WebInspector.HeapSnapshotGridNode.prototype = {
         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 @@ WebInspector.HeapSnapshotGridNode.prototype = {
             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 @@ WebInspector.HeapSnapshotGridNode.prototype = {
             this._instanceCount = 0;
             this._populateChildren(0, instanceCount, afterPopulate.bind(this));
         }
+
         this._provider.sortAndRewind(this.comparator(), afterSort.bind(this));
     }
 };
@@ -970,6 +996,35 @@ WebInspector.HeapSnapshotDominatorObjectNode = function(tree, node)
 };
 
 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);
index 17d1b62..6264ee7 100644 (file)
@@ -427,6 +427,11 @@ WebInspector.HeapSnapshotProxy.prototype = {
         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);
index f457417..e9cb243 100644 (file)
@@ -585,8 +585,9 @@ WebInspector.ProfilesPanel.prototype = {
 
     /**
      * @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 @@ WebInspector.ProfilesPanel.prototype = {
             // 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 @@ WebInspector.RevealInHeapSnapshotContextMenuProvider.prototype = {
         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"));
     }
 }