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

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

Issue 553063002: DevTools: Do not switch to other profile when revealing a node (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @implements {WebInspector.ProfileType.DataDisplayDelegate}
33 * @extends {WebInspector.VBox} 34 * @extends {WebInspector.VBox}
34 * @param {!WebInspector.ProfileType.DataDisplayDelegate} dataDisplayDelegate 35 * @param {!WebInspector.ProfileType.DataDisplayDelegate} dataDisplayDelegate
35 * @param {!WebInspector.HeapProfileHeader} profile 36 * @param {!WebInspector.HeapProfileHeader} profile
36 */ 37 */
37 WebInspector.HeapSnapshotView = function(dataDisplayDelegate, profile) 38 WebInspector.HeapSnapshotView = function(dataDisplayDelegate, profile)
38 { 39 {
39 WebInspector.VBox.call(this); 40 WebInspector.VBox.call(this);
40 41
41 this.element.classList.add("heap-snapshot-view"); 42 this.element.classList.add("heap-snapshot-view");
42 43
43 profile.profileType().addEventListener(WebInspector.HeapSnapshotProfileType. SnapshotReceived, this._onReceiveSnapshot, this); 44 profile.profileType().addEventListener(WebInspector.HeapSnapshotProfileType. SnapshotReceived, this._onReceiveSnapshot, this);
44 profile.profileType().addEventListener(WebInspector.ProfileType.Events.Remov eProfileHeader, this._onProfileHeaderRemoved, this); 45 profile.profileType().addEventListener(WebInspector.ProfileType.Events.Remov eProfileHeader, this._onProfileHeaderRemoved, this);
45 46
46 if (profile.profileType().id === WebInspector.TrackingHeapSnapshotProfileTyp e.TypeId) { 47 if (profile.profileType().id === WebInspector.TrackingHeapSnapshotProfileTyp e.TypeId) {
47 this._trackingOverviewGrid = new WebInspector.HeapTrackingOverviewGrid(p rofile); 48 this._trackingOverviewGrid = new WebInspector.HeapTrackingOverviewGrid(p rofile);
48 this._trackingOverviewGrid.addEventListener(WebInspector.HeapTrackingOve rviewGrid.IdsRangeChanged, this._onIdsRangeChanged.bind(this)); 49 this._trackingOverviewGrid.addEventListener(WebInspector.HeapTrackingOve rviewGrid.IdsRangeChanged, this._onIdsRangeChanged.bind(this));
49 } 50 }
50 51
52 this._parentDataDisplayDelegate = dataDisplayDelegate;
53
51 this._splitView = new WebInspector.SplitView(false, true, "heapSnapshotSplit ViewState", 200, 200); 54 this._splitView = new WebInspector.SplitView(false, true, "heapSnapshotSplit ViewState", 200, 200);
52 this._splitView.show(this.element); 55 this._splitView.show(this.element);
53 56
54 this._containmentView = new WebInspector.VBox(); 57 this._containmentView = new WebInspector.VBox();
55 this._containmentView.setMinimumSize(50, 25); 58 this._containmentView.setMinimumSize(50, 25);
56 this._containmentDataGrid = new WebInspector.HeapSnapshotContainmentDataGrid (dataDisplayDelegate); 59 this._containmentDataGrid = new WebInspector.HeapSnapshotContainmentDataGrid (this);
57 this._containmentDataGrid.show(this._containmentView.element); 60 this._containmentDataGrid.show(this._containmentView.element);
58 this._containmentDataGrid.addEventListener(WebInspector.DataGrid.Events.Sele ctedNode, this._selectionChanged, this); 61 this._containmentDataGrid.addEventListener(WebInspector.DataGrid.Events.Sele ctedNode, this._selectionChanged, this);
59 62
60 this._statisticsView = new WebInspector.HeapSnapshotStatisticsView(); 63 this._statisticsView = new WebInspector.HeapSnapshotStatisticsView();
61 64
62 this._constructorsView = new WebInspector.VBox(); 65 this._constructorsView = new WebInspector.VBox();
63 this._constructorsView.setMinimumSize(50, 25); 66 this._constructorsView.setMinimumSize(50, 25);
64 67
65 this._constructorsDataGrid = new WebInspector.HeapSnapshotConstructorsDataGr id(dataDisplayDelegate); 68 this._constructorsDataGrid = new WebInspector.HeapSnapshotConstructorsDataGr id(this);
66 this._constructorsDataGrid.show(this._constructorsView.element); 69 this._constructorsDataGrid.show(this._constructorsView.element);
67 this._constructorsDataGrid.addEventListener(WebInspector.DataGrid.Events.Sel ectedNode, this._selectionChanged, this); 70 this._constructorsDataGrid.addEventListener(WebInspector.DataGrid.Events.Sel ectedNode, this._selectionChanged, this);
68 71
69 this._diffView = new WebInspector.VBox(); 72 this._diffView = new WebInspector.VBox();
70 this._diffView.setMinimumSize(50, 25); 73 this._diffView.setMinimumSize(50, 25);
71 74
72 this._diffDataGrid = new WebInspector.HeapSnapshotDiffDataGrid(dataDisplayDe legate); 75 this._diffDataGrid = new WebInspector.HeapSnapshotDiffDataGrid(this);
73 this._diffDataGrid.show(this._diffView.element); 76 this._diffDataGrid.show(this._diffView.element);
74 this._diffDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNod e, this._selectionChanged, this); 77 this._diffDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNod e, this._selectionChanged, this);
75 78
76 if (profile._hasAllocationStacks) { 79 if (profile._hasAllocationStacks) {
77 this._allocationView = new WebInspector.VBox(); 80 this._allocationView = new WebInspector.VBox();
78 this._allocationView.setMinimumSize(50, 25); 81 this._allocationView.setMinimumSize(50, 25);
79 this._allocationDataGrid = new WebInspector.AllocationDataGrid(profile.t arget() , dataDisplayDelegate); 82 this._allocationDataGrid = new WebInspector.AllocationDataGrid(profile.t arget() , this);
80 this._allocationDataGrid.addEventListener(WebInspector.DataGrid.Events.S electedNode, this._onSelectAllocationNode, this); 83 this._allocationDataGrid.addEventListener(WebInspector.DataGrid.Events.S electedNode, this._onSelectAllocationNode, this);
81 this._allocationDataGrid.show(this._allocationView.element); 84 this._allocationDataGrid.show(this._allocationView.element);
82 85
83 this._allocationStackView = new WebInspector.HeapAllocationStackView(pro file.target()); 86 this._allocationStackView = new WebInspector.HeapAllocationStackView(pro file.target());
84 this._allocationStackView.setMinimumSize(50, 25); 87 this._allocationStackView.setMinimumSize(50, 25);
85 88
86 this._tabbedPane = new WebInspector.TabbedPane(); 89 this._tabbedPane = new WebInspector.TabbedPane();
87 this._tabbedPane.closeableTabs = false; 90 this._tabbedPane.closeableTabs = false;
88 this._tabbedPane.headerElement().classList.add("heap-object-details-head er"); 91 this._tabbedPane.headerElement().classList.add("heap-object-details-head er");
89 } 92 }
(...skipping 19 matching lines...) Expand all
109 var retainingPathsTitle = retainingPathsTitleDiv.createChild("span"); 112 var retainingPathsTitle = retainingPathsTitleDiv.createChild("span");
110 retainingPathsTitle.textContent = WebInspector.UIString("Retainers"); 113 retainingPathsTitle.textContent = WebInspector.UIString("Retainers");
111 this._retainmentView.element.appendChild(retainmentViewHeader); 114 this._retainmentView.element.appendChild(retainmentViewHeader);
112 115
113 splitViewResizer = retainmentViewHeader; 116 splitViewResizer = retainmentViewHeader;
114 this._objectDetailsView = this._retainmentView; 117 this._objectDetailsView = this._retainmentView;
115 } 118 }
116 this._splitView.hideDefaultResizer(); 119 this._splitView.hideDefaultResizer();
117 this._splitView.installResizer(splitViewResizer); 120 this._splitView.installResizer(splitViewResizer);
118 121
119 this._retainmentDataGrid = new WebInspector.HeapSnapshotRetainmentDataGrid(d ataDisplayDelegate); 122 this._retainmentDataGrid = new WebInspector.HeapSnapshotRetainmentDataGrid(t his);
120 this._retainmentDataGrid.show(this._retainmentView.element); 123 this._retainmentDataGrid.show(this._retainmentView.element);
121 this._retainmentDataGrid.addEventListener(WebInspector.DataGrid.Events.Selec tedNode, this._inspectedObjectChanged, this); 124 this._retainmentDataGrid.addEventListener(WebInspector.DataGrid.Events.Selec tedNode, this._inspectedObjectChanged, this);
122 this._retainmentDataGrid.reset(); 125 this._retainmentDataGrid.reset();
123 126
124 this._perspectives = []; 127 this._perspectives = [];
125 this._perspectives.push(new WebInspector.HeapSnapshotView.SummaryPerspective ()); 128 this._perspectives.push(new WebInspector.HeapSnapshotView.SummaryPerspective ());
126 if (profile.profileType() !== WebInspector.ProfileTypeRegistry.instance.trac kingHeapSnapshotProfileType) 129 if (profile.profileType() !== WebInspector.ProfileTypeRegistry.instance.trac kingHeapSnapshotProfileType)
127 this._perspectives.push(new WebInspector.HeapSnapshotView.ComparisonPers pective()); 130 this._perspectives.push(new WebInspector.HeapSnapshotView.ComparisonPers pective());
128 this._perspectives.push(new WebInspector.HeapSnapshotView.ContainmentPerspec tive()); 131 this._perspectives.push(new WebInspector.HeapSnapshotView.ContainmentPerspec tive());
129 if (this._allocationView) 132 if (this._allocationView)
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 masterGrid: function(heapSnapshotView) 439 masterGrid: function(heapSnapshotView)
437 { 440 {
438 return null; 441 return null;
439 }, 442 },
440 443
441 __proto__: WebInspector.HeapSnapshotView.Perspective.prototype 444 __proto__: WebInspector.HeapSnapshotView.Perspective.prototype
442 } 445 }
443 446
444 447
445 WebInspector.HeapSnapshotView.prototype = { 448 WebInspector.HeapSnapshotView.prototype = {
449 /**
450 * @override
451 * @param {?WebInspector.ProfileHeader} profile
452 * @return {?WebInspector.View}
453 */
454 showProfile: function(profile)
455 {
456 return this._parentDataDisplayDelegate.showProfile(profile);
457 },
458
459 /**
460 * @override
461 * @param {!HeapProfilerAgent.HeapSnapshotObjectId} snapshotObjectId
462 * @param {string} perspectiveName
463 */
464 showObject: function(snapshotObjectId, perspectiveName)
465 {
466 if (snapshotObjectId <= this._profile.maxJSObjectId)
467 this.highlightLiveObject(perspectiveName, snapshotObjectId);
468 else
469 this._parentDataDisplayDelegate.showObject(snapshotObjectId, perspec tiveName);
470 },
471
446 _refreshView: function() 472 _refreshView: function()
447 { 473 {
448 this._profile.load(profileCallback.bind(this)); 474 this._profile.load(profileCallback.bind(this));
449 475
450 /** 476 /**
451 * @param {!WebInspector.HeapSnapshotProxy} heapSnapshotProxy 477 * @param {!WebInspector.HeapSnapshotProxy} heapSnapshotProxy
452 * @this {WebInspector.HeapSnapshotView} 478 * @this {WebInspector.HeapSnapshotView}
453 */ 479 */
454 function profileCallback(heapSnapshotProxy) 480 function profileCallback(heapSnapshotProxy)
455 { 481 {
456 heapSnapshotProxy.getStatistics(this._gotStatistics.bind(this)); 482 heapSnapshotProxy.getStatistics(this._gotStatistics.bind(this));
457 var list = this._profiles(); 483 var list = this._profiles();
458 var profileIndex = list.indexOf(this._profile); 484 var profileIndex = list.indexOf(this._profile);
459 this._baseSelect.setSelectedIndex(Math.max(0, profileIndex - 1)); 485 this._baseSelect.setSelectedIndex(Math.max(0, profileIndex - 1));
460 this._dataGrid.setDataSource(heapSnapshotProxy); 486 this._dataGrid.setDataSource(heapSnapshotProxy);
461 if (this._trackingOverviewGrid) 487 if (this._trackingOverviewGrid)
462 this._trackingOverviewGrid._updateGrid(); 488 this._trackingOverviewGrid._updateGrid();
463 } 489 }
464 }, 490 },
465 491
466 /** 492 /**
467 * @param {!WebInspector.HeapSnapshotCommon.Statistics} statistics 493 * @param {!WebInspector.HeapSnapshotCommon.Statistics} statistics
468 */ 494 */
469 _gotStatistics: function(statistics) { 495 _gotStatistics: function(statistics)
496 {
470 this._statisticsView.setTotal(statistics.total); 497 this._statisticsView.setTotal(statistics.total);
471 this._statisticsView.addRecord(statistics.code, WebInspector.UIString("C ode"), "#f77"); 498 this._statisticsView.addRecord(statistics.code, WebInspector.UIString("C ode"), "#f77");
472 this._statisticsView.addRecord(statistics.strings, WebInspector.UIString ("Strings"), "#5e5"); 499 this._statisticsView.addRecord(statistics.strings, WebInspector.UIString ("Strings"), "#5e5");
473 this._statisticsView.addRecord(statistics.jsArrays, WebInspector.UIStrin g("JS Arrays"), "#7af"); 500 this._statisticsView.addRecord(statistics.jsArrays, WebInspector.UIStrin g("JS Arrays"), "#7af");
474 this._statisticsView.addRecord(statistics.native, WebInspector.UIString( "Typed Arrays"), "#fc5"); 501 this._statisticsView.addRecord(statistics.native, WebInspector.UIString( "Typed Arrays"), "#fc5");
475 this._statisticsView.addRecord(statistics.total, WebInspector.UIString(" Total")); 502 this._statisticsView.addRecord(statistics.total, WebInspector.UIString(" Total"));
476 }, 503 },
477 504
478 _onIdsRangeChanged: function(event) 505 _onIdsRangeChanged: function(event)
479 { 506 {
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 { 875 {
849 this._changePerspective(event.target.selectedIndex); 876 this._changePerspective(event.target.selectedIndex);
850 // FIXME: This is needed by CodeSchool extension. 877 // FIXME: This is needed by CodeSchool extension.
851 this._onSelectedViewChanged(event); 878 this._onSelectedViewChanged(event);
852 }, 879 },
853 880
854 _onSelectedViewChanged: function(event) 881 _onSelectedViewChanged: function(event)
855 { 882 {
856 }, 883 },
857 884
885 /**
886 * @param {number} selectedIndex
887 */
858 _changePerspective: function(selectedIndex) 888 _changePerspective: function(selectedIndex)
859 { 889 {
860 if (selectedIndex === this._currentPerspectiveIndex) 890 if (selectedIndex === this._currentPerspectiveIndex)
861 return; 891 return;
862 892
863 this._currentPerspectiveIndex = selectedIndex; 893 this._currentPerspectiveIndex = selectedIndex;
864 894
865 this._currentPerspective.deactivate(this); 895 this._currentPerspective.deactivate(this);
866 var perspective = this._perspectives[selectedIndex]; 896 var perspective = this._perspectives[selectedIndex];
867 this._currentPerspective = perspective; 897 this._currentPerspective = perspective;
(...skipping 11 matching lines...) Expand all
879 909
880 // The current search needs to be performed again. First negate out prev ious match 910 // The current search needs to be performed again. First negate out prev ious match
881 // count by calling the search finished callback with a negative number of matches. 911 // count by calling the search finished callback with a negative number of matches.
882 // Then perform the search again the with same query and callback. 912 // Then perform the search again the with same query and callback.
883 this._searchFinishedCallback(this, -this._searchResults.length); 913 this._searchFinishedCallback(this, -this._searchResults.length);
884 this.performSearch(this.currentQuery, this._searchFinishedCallback); 914 this.performSearch(this.currentQuery, this._searchFinishedCallback);
885 }, 915 },
886 916
887 /** 917 /**
888 * @param {string} perspectiveName 918 * @param {string} perspectiveName
889 * @param {number} snapshotObjectId 919 * @param {!HeapProfilerAgent.HeapSnapshotObjectId} snapshotObjectId
890 */ 920 */
891 highlightLiveObject: function(perspectiveName, snapshotObjectId) 921 highlightLiveObject: function(perspectiveName, snapshotObjectId)
892 { 922 {
893 this._changePerspectiveAndWait(perspectiveName, didChangePerspective.bin d(this)); 923 this._changePerspectiveAndWait(perspectiveName, didChangePerspective.bin d(this));
894 924
895 /** 925 /**
896 * @this {WebInspector.HeapSnapshotView} 926 * @this {WebInspector.HeapSnapshotView}
897 */ 927 */
898 function didChangePerspective() 928 function didChangePerspective()
899 { 929 {
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 name.textContent = frame.functionName; 2207 name.textContent = frame.functionName;
2178 if (frame.scriptId) { 2208 if (frame.scriptId) {
2179 var urlElement = this._linkifier.linkifyScriptLocation(this._tar get, String(frame.scriptId), frame.scriptName, frame.line - 1, frame.column - 1) ; 2209 var urlElement = this._linkifier.linkifyScriptLocation(this._tar get, String(frame.scriptId), frame.scriptName, frame.line - 1, frame.column - 1) ;
2180 frameDiv.appendChild(urlElement); 2210 frameDiv.appendChild(urlElement);
2181 } 2211 }
2182 } 2212 }
2183 }, 2213 },
2184 2214
2185 __proto__: WebInspector.View.prototype 2215 __proto__: WebInspector.View.prototype
2186 } 2216 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698