Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: Source/devtools/front_end/HeapSnapshotView.js

Issue 203403002: Show live objects with given allocation call stack (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 this._diffDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNod e, this._selectionChanged, this); 72 this._diffDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNod e, this._selectionChanged, this);
73 73
74 this._dominatorView = new WebInspector.VBox(); 74 this._dominatorView = new WebInspector.VBox();
75 this._dominatorDataGrid = new WebInspector.HeapSnapshotDominatorsDataGrid(); 75 this._dominatorDataGrid = new WebInspector.HeapSnapshotDominatorsDataGrid();
76 this._dominatorDataGrid.show(this._dominatorView.element); 76 this._dominatorDataGrid.show(this._dominatorView.element);
77 this._dominatorDataGrid.addEventListener(WebInspector.DataGrid.Events.Select edNode, this._selectionChanged, this); 77 this._dominatorDataGrid.addEventListener(WebInspector.DataGrid.Events.Select edNode, this._selectionChanged, this);
78 78
79 if (WebInspector.experimentsSettings.allocationProfiler.isEnabled() && profi le.profileType() === WebInspector.ProfileTypeRegistry.instance.trackingHeapSnaps hotProfileType) { 79 if (WebInspector.experimentsSettings.allocationProfiler.isEnabled() && profi le.profileType() === WebInspector.ProfileTypeRegistry.instance.trackingHeapSnaps hotProfileType) {
80 this._allocationView = new WebInspector.VBox(); 80 this._allocationView = new WebInspector.VBox();
81 this._allocationDataGrid = new WebInspector.AllocationDataGrid(); 81 this._allocationDataGrid = new WebInspector.AllocationDataGrid();
82 this._allocationDataGrid.addEventListener(WebInspector.DataGrid.Events.S electedNode, this._onSelectAllocationNode, this);
82 this._allocationDataGrid.show(this._allocationView.element); 83 this._allocationDataGrid.show(this._allocationView.element);
83 } 84 }
84 85
85 this._retainmentViewHeader = document.createElementWithClass("div", "retaine rs-view-header"); 86 this._retainmentViewHeader = document.createElementWithClass("div", "retaine rs-view-header");
86 var retainingPathsTitleDiv = this._retainmentViewHeader.createChild("div", " title"); 87 var retainingPathsTitleDiv = this._retainmentViewHeader.createChild("div", " title");
87 var retainingPathsTitle = retainingPathsTitleDiv.createChild("span"); 88 var retainingPathsTitle = retainingPathsTitleDiv.createChild("span");
88 retainingPathsTitle.textContent = WebInspector.UIString("Object's retaining tree"); 89 retainingPathsTitle.textContent = WebInspector.UIString("Object's retaining tree");
89 this._splitView.hideDefaultResizer(); 90 this._splitView.hideDefaultResizer();
90 this._splitView.installResizer(this._retainmentViewHeader); 91 this._splitView.installResizer(this._retainmentViewHeader);
91 92
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 __proto__: WebInspector.HeapSnapshotView.Perspective.prototype 362 __proto__: WebInspector.HeapSnapshotView.Perspective.prototype
362 } 363 }
363 364
364 /** 365 /**
365 * @constructor 366 * @constructor
366 * @extends {WebInspector.HeapSnapshotView.Perspective} 367 * @extends {WebInspector.HeapSnapshotView.Perspective}
367 */ 368 */
368 WebInspector.HeapSnapshotView.AllocationPerspective = function() 369 WebInspector.HeapSnapshotView.AllocationPerspective = function()
369 { 370 {
370 WebInspector.HeapSnapshotView.Perspective.call(this, WebInspector.UIString( "Allocation")); 371 WebInspector.HeapSnapshotView.Perspective.call(this, WebInspector.UIString( "Allocation"));
372 this._allocationSplitView = new WebInspector.SplitView(false, true, "heapSna pshotAllocationSplitViewState", 200, 200);
373 this._allocationSplitView.setMainElementConstraints(50, 100);
374 this._allocationSplitView.setSidebarElementConstraints(50, 100);
371 } 375 }
372 376
373 WebInspector.HeapSnapshotView.AllocationPerspective.prototype = { 377 WebInspector.HeapSnapshotView.AllocationPerspective.prototype = {
374 /** 378 /**
375 * @override 379 * @override
376 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView 380 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView
377 */ 381 */
378 activate: function(heapSnapshotView) 382 activate: function(heapSnapshotView)
379 { 383 {
380 heapSnapshotView._allocationView.show(heapSnapshotView.element); 384 heapSnapshotView._allocationView.show(this._allocationSplitView.mainElem ent());
385 heapSnapshotView._constructorsView.show(heapSnapshotView._splitView.main Element());
386 heapSnapshotView._retainmentView.show(heapSnapshotView._splitView.sideba rElement());
387 heapSnapshotView._splitView.show(this._allocationSplitView.sidebarElemen t());
388 this._allocationSplitView.show(heapSnapshotView.element);
381 }, 389 },
382 390
383 /** 391 /**
392 * @override
393 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView
394 */
395 deactivate: function(heapSnapshotView)
396 {
397 this._allocationSplitView.detach();
398 WebInspector.HeapSnapshotView.Perspective.prototype.deactivate.call(this , heapSnapshotView);
399 },
400
401 /**
384 * @override 402 * @override
385 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView 403 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView
386 * @return {?WebInspector.DataGrid} 404 * @return {?WebInspector.DataGrid}
387 */ 405 */
388 masterGrid: function(heapSnapshotView) 406 masterGrid: function(heapSnapshotView)
389 { 407 {
390 return heapSnapshotView._allocationDataGrid; 408 return heapSnapshotView._allocationDataGrid;
391 }, 409 },
392 410
393 __proto__: WebInspector.HeapSnapshotView.Perspective.prototype 411 __proto__: WebInspector.HeapSnapshotView.Perspective.prototype
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 this._dataGrid.populateContextMenu(contextMenu, event); 752 this._dataGrid.populateContextMenu(contextMenu, event);
735 }, 753 },
736 754
737 _selectionChanged: function(event) 755 _selectionChanged: function(event)
738 { 756 {
739 var selectedNode = event.target.selectedNode; 757 var selectedNode = event.target.selectedNode;
740 this._setRetainmentDataGridSource(selectedNode); 758 this._setRetainmentDataGridSource(selectedNode);
741 this._inspectedObjectChanged(event); 759 this._inspectedObjectChanged(event);
742 }, 760 },
743 761
762 _onSelectAllocationNode: function(event)
763 {
764 var selectedNode = event.target.selectedNode;
765 this._constructorsDataGrid.setAllocationNodeId(selectedNode.allocationNo deId());
766 },
767
744 _inspectedObjectChanged: function(event) 768 _inspectedObjectChanged: function(event)
745 { 769 {
746 var selectedNode = event.target.selectedNode; 770 var selectedNode = event.target.selectedNode;
747 if (!this._profile.fromFile() && selectedNode instanceof WebInspector.He apSnapshotGenericObjectNode) 771 if (!this._profile.fromFile() && selectedNode instanceof WebInspector.He apSnapshotGenericObjectNode)
748 ConsoleAgent.addInspectedHeapObject(selectedNode.snapshotNodeId); 772 ConsoleAgent.addInspectedHeapObject(selectedNode.snapshotNodeId);
749 }, 773 },
750 774
751 _setRetainmentDataGridSource: function(nodeItem) 775 _setRetainmentDataGridSource: function(nodeItem)
752 { 776 {
753 if (nodeItem && nodeItem.snapshotNodeIndex) 777 if (nodeItem && nodeItem.snapshotNodeIndex)
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after
2128 if (color) 2152 if (color)
2129 swatchDiv.style.backgroundColor = color; 2153 swatchDiv.style.backgroundColor = color;
2130 else 2154 else
2131 swatchDiv.classList.add("heap-snapshot-stats-empty-swatch"); 2155 swatchDiv.classList.add("heap-snapshot-stats-empty-swatch");
2132 nameDiv.textContent = name; 2156 nameDiv.textContent = name;
2133 sizeDiv.textContent = WebInspector.UIString("%s KB", Number.withThousand sSeparator(Math.round(value / 1024))); 2157 sizeDiv.textContent = WebInspector.UIString("%s KB", Number.withThousand sSeparator(Math.round(value / 1024)));
2134 }, 2158 },
2135 2159
2136 __proto__: WebInspector.VBox.prototype 2160 __proto__: WebInspector.VBox.prototype
2137 } 2161 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698