Changeset 117051 in webkit
- Timestamp:
- May 15, 2012 4:18:07 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r117047 r117051 1 2012-05-15 Yury Semikhatsky <yurys@chromium.org> 2 3 Web Inspector: implement "Reveal in Dominators view" context menu action 4 https://bugs.webkit.org/show_bug.cgi?id=86455 5 6 Reviewed by Pavel Feldman. 7 8 Test that an object can be revealed in the heap snapshot dominators view 9 by its heap snapshot object id. 10 11 * inspector/profiler/heap-snapshot-reveal-in-dominators-view-expected.txt: Added. 12 * inspector/profiler/heap-snapshot-reveal-in-dominators-view.html: Added. 13 * inspector/profiler/heap-snapshot-test.js: 14 (initialize_HeapSnapshotTest): 15 (initialize_HeapSnapshotTest.): 16 * platform/mac/Skipped: 17 * platform/qt/Skipped: 18 * platform/win/Skipped: 19 * platform/wincairo/Skipped: 20 1 21 2012-05-15 Zan Dobersek <zandobersek@gmail.com> 2 22 -
trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js
r116771 r117051 426 426 "nodes": nodes, 427 427 "edges": edges, 428 "strings": ["", "A", "B", "a", "(GC roots)"] 428 "strings": ["", "A", "B", "a", "(GC roots)"], 429 maxJSObjectId: nextId - 1 429 430 }; 430 431 result.snapshot.node_count = result.nodes.length / result.snapshot.meta.node_fields.length; … … 512 513 callback = InspectorTest.safeWrap(callback); 513 514 var uid = InspectorTest._nextUid++; 514 var profile = { typeId: WebInspector.HeapSnapshotProfileType.TypeId, uid: uid, title: UserInitiatedProfileName + "." + uid }; 515 var snapshot = generator(); 516 var profile = new WebInspector.HeapProfileHeader(UserInitiatedProfileName + "." + uid, uid, snapshot.maxJSObjectId); 517 delete snapshot.maxJSObjectId; 515 518 function pushGeneratedSnapshot(typeId, uid) 516 519 { 517 var snapshot = generator();518 520 snapshot.snapshot.typeId = profile.typeId; 519 521 snapshot.snapshot.title = profile.title; -
trunk/LayoutTests/platform/mac/Skipped
r117029 r117051 282 282 inspector/profiler/heap-snapshot-inspect-dom-wrapper.html 283 283 inspector/profiler/heap-snapshot-comparison-dom-groups-change.html 284 inspector/profiler/heap-snapshot-reveal-in-dominators-view.html 284 285 inspector/profiler/heap-snapshot-summary-show-ranges.html 285 286 -
trunk/LayoutTests/platform/qt/Skipped
r117040 r117051 269 269 inspector/profiler/heap-snapshot-inspect-dom-wrapper.html 270 270 inspector/profiler/heap-snapshot-comparison-dom-groups-change.html 271 inspector/profiler/heap-snapshot-reveal-in-dominators-view.html 271 272 inspector/profiler/heap-snapshot-summary-show-ranges.html 272 273 -
trunk/LayoutTests/platform/win/Skipped
r117029 r117051 1257 1257 inspector/profiler/heap-snapshot-inspect-dom-wrapper.html 1258 1258 inspector/profiler/heap-snapshot-comparison-dom-groups-change.html 1259 inspector/profiler/heap-snapshot-reveal-in-dominators-view.html 1259 1260 inspector/profiler/heap-snapshot-summary-show-ranges.html 1260 1261 -
trunk/LayoutTests/platform/wincairo/Skipped
r117029 r117051 1769 1769 inspector/profiler/heap-snapshot-inspect-dom-wrapper.html 1770 1770 inspector/profiler/heap-snapshot-comparison-dom-groups-change.html 1771 inspector/profiler/heap-snapshot-reveal-in-dominators-view.html 1771 1772 inspector/profiler/heap-snapshot-summary-show-ranges.html 1772 1773 -
trunk/Source/WebCore/ChangeLog
r117050 r117051 1 2012-05-15 Yury Semikhatsky <yurys@chromium.org> 2 3 Web Inspector: implement "Reveal in Dominators view" context menu action 4 https://bugs.webkit.org/show_bug.cgi?id=86455 5 6 Reviewed by Pavel Feldman. 7 8 Implemented "Reveal in Dominators view" context menu action for objects 9 in the console. 10 11 Test: inspector/profiler/heap-snapshot-reveal-in-dominators-view.html 12 13 * English.lproj/localizedStrings.js: 14 * inspector/front-end/HeapSnapshot.js: 15 (WebInspector.HeapSnapshot.prototype._nodeForSnapshotObjectId): 16 (WebInspector.HeapSnapshot.prototype.nodeClassName): 17 (WebInspector.HeapSnapshot.prototype.dominatorIdsForNode): 18 * inspector/front-end/HeapSnapshotDataGrids.js: 19 (WebInspector.HeapSnapshotDominatorsDataGrid): 20 (WebInspector.HeapSnapshotDominatorsDataGrid.prototype.setDataSource): 21 (WebInspector.HeapSnapshotDominatorsDataGrid.prototype.sortingChanged): 22 (WebInspector.HeapSnapshotDominatorsDataGrid.prototype.highlightObjectByHeapSnapshotId.didGetDominators): 23 (WebInspector.HeapSnapshotDominatorsDataGrid.prototype.highlightObjectByHeapSnapshotId.expandNextDominator): 24 (WebInspector.HeapSnapshotDominatorsDataGrid.prototype.highlightObjectByHeapSnapshotId): 25 * inspector/front-end/HeapSnapshotGridNodes.js: 26 (WebInspector.HeapSnapshotGridNode.prototype.childForPosition): 27 (WebInspector.HeapSnapshotGridNode.prototype.expandWithoutPopulate): 28 (WebInspector.HeapSnapshotGridNode.prototype._populateChildren.childrenRetrieved): 29 (WebInspector.HeapSnapshotGridNode.prototype._populateChildren): 30 (WebInspector.HeapSnapshotGridNode.prototype.sort): 31 (WebInspector.HeapSnapshotDominatorObjectNode.prototype.retrieveChildBySnapshotObjectId): 32 (WebInspector.HeapSnapshotDominatorObjectNode.prototype.retrieveChildBySnapshotObjectId.didGetNodePosition): 33 (WebInspector.HeapSnapshotDominatorObjectNode.prototype.retrieveChildBySnapshotObjectId.didPopulateChildren): 34 * inspector/front-end/HeapSnapshotProxy.js: 35 (WebInspector.HeapSnapshotProxy.prototype.dominatorIdsForNode): 36 * inspector/front-end/ProfilesPanel.js: 37 (WebInspector.RevealInHeapSnapshotContextMenuProvider.prototype.populateContextMenu.revealInSummaryView): 38 (WebInspector.RevealInHeapSnapshotContextMenuProvider.prototype.populateContextMenu.didReceiveHeapObjectId): 39 (WebInspector.RevealInHeapSnapshotContextMenuProvider.prototype.populateContextMenu): 40 1 41 2012-05-15 Yury Semikhatsky <yurys@chromium.org> 2 42 -
trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js
r116857 r117051 1287 1287 }, 1288 1288 1289 nodeClassName: function(snapshotObjectId)1289 _nodeForSnapshotObjectId: function(snapshotObjectId) 1290 1290 { 1291 1291 for (var it = this._allNodes; it.hasNext(); it.next()) { 1292 1292 if (it.node.id === snapshotObjectId) 1293 return it.node .className;1293 return it.node; 1294 1294 } 1295 1295 return null; 1296 }, 1297 1298 nodeClassName: function(snapshotObjectId) 1299 { 1300 var node = this._nodeForSnapshotObjectId(snapshotObjectId); 1301 if (node) 1302 return node.className; 1303 return null; 1304 }, 1305 1306 dominatorIdsForNode: function(snapshotObjectId) 1307 { 1308 var node = this._nodeForSnapshotObjectId(snapshotObjectId); 1309 if (!node) 1310 return null; 1311 var result = []; 1312 while (!node.isRoot) { 1313 result.push(node.id); 1314 node.nodeIndex = node.dominatorIndex; 1315 } 1316 return result; 1296 1317 }, 1297 1318 -
trunk/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js
r116857 r117051 616 616 }; 617 617 WebInspector.HeapSnapshotSortableDataGrid.call(this, columns); 618 this._objectIdToSelect = null; 618 619 } 619 620 … … 636 637 this.setRootNode(new WebInspector.HeapSnapshotDominatorObjectNode(this, fakeNode)); 637 638 this.rootNode().sort(); 639 640 if (this._objectIdToSelect) { 641 this.highlightObjectByHeapSnapshotId(this._objectIdToSelect); 642 this._objectIdToSelect = null; 643 } 638 644 }, 639 645 … … 641 647 { 642 648 this.rootNode().sort(); 649 }, 650 651 /** 652 * @override 653 * @param {ProfilerAgent.HeapSnapshotObjectId} id 654 */ 655 highlightObjectByHeapSnapshotId: function(id) 656 { 657 if (!this.snapshot) { 658 this._objectIdToSelect = id; 659 return; 660 } 661 662 function didGetDominators(dominatorIds) 663 { 664 if (!dominatorIds) { 665 WebInspector.log(WebInspector.UIString("Cannot find corresponding heap snapshot node")); 666 return; 667 } 668 var dominatorNode = this.rootNode(); 669 expandNextDominator.call(this, dominatorIds, dominatorNode); 670 } 671 672 function expandNextDominator(dominatorIds, dominatorNode) 673 { 674 if (!dominatorNode) { 675 console.error("Cannot find dominator node"); 676 return; 677 } 678 if (!dominatorIds.length) { 679 this.highlightNode(dominatorNode); 680 dominatorNode.element.scrollIntoViewIfNeeded(true); 681 return; 682 } 683 var snapshotObjectId = dominatorIds.pop(); 684 dominatorNode.retrieveChildBySnapshotObjectId(snapshotObjectId, expandNextDominator.bind(this, dominatorIds)); 685 } 686 687 this.snapshot.dominatorIdsForNode(parseInt(id, 10), didGetDominators.bind(this)); 643 688 } 644 689 }; -
trunk/Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js
r116857 r117051 98 98 }, 99 99 100 /** 101 * @param {number} nodePosition 102 */ 103 childForPosition: function(nodePosition) 104 { 105 var indexOfFirsChildInRange = 0; 106 for (var i = 0; i < this._retrievedChildrenRanges.length; i++) { 107 var range = this._retrievedChildrenRanges[i]; 108 if (range.from <= nodePosition && nodePosition < range.to) { 109 var childIndex = indexOfFirsChildInRange + nodePosition - range.from; 110 return this.children[childIndex]; 111 } 112 indexOfFirsChildInRange += range.to - range.from + 1; 113 } 114 return null; 115 }, 116 100 117 _createValueCell: function(columnIdentifier) 101 118 { … … 129 146 }, 130 147 148 expandWithoutPopulate: function(callback) 149 { 150 // Make sure default _populate won't be invoked. 151 this.removeEventListener("populate", this._populate, this); 152 this.expand(); 153 this._provider.sortAndRewind(this.comparator(), callback); 154 }, 155 131 156 /** 132 157 * @param {?number} fromPosition … … 171 196 if (items.startPosition > 0) { 172 197 this._retrievedChildrenRanges.push({from: 0, to: 0}); 173 insertShowMoreButton.call(this, 0, items.startPosition, insertionIndex );198 insertShowMoreButton.call(this, 0, items.startPosition, insertionIndex++); 174 199 } 175 200 this._retrievedChildrenRanges.push({from: items.startPosition, to: items.endPosition}); … … 292 317 this._populateChildren(0, instanceCount, afterPopulate.bind(this)); 293 318 } 319 294 320 this._provider.sortAndRewind(this.comparator(), afterSort.bind(this)); 295 321 } … … 971 997 972 998 WebInspector.HeapSnapshotDominatorObjectNode.prototype = { 999 /** 1000 * @param {number} snapshotObjectId 1001 * @param {function(?WebInspector.HeapSnapshotDominatorObjectNode)} callback 1002 */ 1003 retrieveChildBySnapshotObjectId: function(snapshotObjectId, callback) 1004 { 1005 function didExpand() 1006 { 1007 this._provider.nodePosition(snapshotObjectId, didGetNodePosition.bind(this)); 1008 } 1009 1010 function didGetNodePosition(nodePosition) 1011 { 1012 if (nodePosition === -1) { 1013 this.collapse(); 1014 callback(null); 1015 } else 1016 this._populateChildren(nodePosition, null, didPopulateChildren.bind(this, nodePosition)); 1017 } 1018 1019 function didPopulateChildren(nodePosition) 1020 { 1021 var child = this.childForPosition(nodePosition); 1022 callback(child); 1023 } 1024 1025 this.expandWithoutPopulate(didExpand.bind(this)); 1026 }, 1027 973 1028 _createChildNode: function(item) 974 1029 { -
trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js
r117050 r117051 428 428 }, 429 429 430 dominatorIdsForNode: function(nodeIndex, callback) 431 { 432 this.callMethod(callback, "dominatorIdsForNode", nodeIndex); 433 }, 434 430 435 createEdgesProvider: function(nodeIndex, filter) 431 436 { -
trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js
r116959 r117051 586 586 /** 587 587 * @param {ProfilerAgent.HeapSnapshotObjectId} snapshotObjectId 588 */ 589 showObject: function(snapshotObjectId) 588 * @param {string} viewName 589 */ 590 showObject: function(snapshotObjectId, viewName) 590 591 { 591 592 var heapProfiles = this.getProfiles(WebInspector.HeapSnapshotProfileType.TypeId); … … 595 596 if (profile.maxJSObjectId >= snapshotObjectId) { 596 597 this.showProfile(profile); 597 profile._profileView.changeView("Summary", function() { 598 if (profile._profileView.dataGrid !== profile._profileView.constructorsDataGrid) 599 return; 598 profile._profileView.changeView(viewName, function() { 600 599 profile._profileView.dataGrid.highlightObjectByHeapSnapshotId(snapshotObjectId); 601 600 }); … … 1099 1098 return; 1100 1099 1101 function revealIn SummaryView()1100 function revealInView(viewName) 1102 1101 { 1103 ProfilerAgent.getHeapObjectId(objectId, didReceiveHeapObjectId.bind(this ));1104 } 1105 1106 function didReceiveHeapObjectId( error, result)1102 ProfilerAgent.getHeapObjectId(objectId, didReceiveHeapObjectId.bind(this, viewName)); 1103 } 1104 1105 function didReceiveHeapObjectId(viewName, error, result) 1107 1106 { 1108 1107 if (WebInspector.inspectorView.currentPanel() !== WebInspector.panels.profiles) 1109 1108 return; 1110 1109 if (!error) 1111 WebInspector.panels.profiles.showObject(result); 1112 } 1113 1114 contextMenu.appendItem(WebInspector.UIString("Reveal in Summary View"), revealInSummaryView.bind(this)); 1110 WebInspector.panels.profiles.showObject(result, viewName); 1111 } 1112 1113 contextMenu.appendItem(WebInspector.UIString("Reveal in Dominators View"), revealInView.bind(this, "Dominators")); 1114 contextMenu.appendItem(WebInspector.UIString("Reveal in Summary View"), revealInView.bind(this, "Summary")); 1115 1115 } 1116 1116 }
Note: See TracChangeset
for help on using the changeset viewer.