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

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

Issue 268293003: DevTools: Get rid of WebInspector.panels (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments Created 6 years, 7 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 13 matching lines...) Expand all
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 * @extends {WebInspector.VBox} 33 * @extends {WebInspector.VBox}
34 * @param {!WebInspector.ProfilesPanel} panel
34 * @param {!WebInspector.HeapProfileHeader} profile 35 * @param {!WebInspector.HeapProfileHeader} profile
35 */ 36 */
36 WebInspector.HeapSnapshotView = function(profile) 37 WebInspector.HeapSnapshotView = function(panel, profile)
37 { 38 {
38 WebInspector.VBox.call(this); 39 WebInspector.VBox.call(this);
39 40
40 this.element.classList.add("heap-snapshot-view"); 41 this.element.classList.add("heap-snapshot-view");
41 42
42 profile.profileType().addEventListener(WebInspector.HeapSnapshotProfileType. SnapshotReceived, this._onReceiveSnapshot, this); 43 profile.profileType().addEventListener(WebInspector.HeapSnapshotProfileType. SnapshotReceived, this._onReceiveSnapshot, this);
43 profile.profileType().addEventListener(WebInspector.ProfileType.Events.Remov eProfileHeader, this._onProfileHeaderRemoved, this); 44 profile.profileType().addEventListener(WebInspector.ProfileType.Events.Remov eProfileHeader, this._onProfileHeaderRemoved, this);
44 45
45 if (profile._profileType.id === WebInspector.TrackingHeapSnapshotProfileType .TypeId) { 46 if (profile._profileType.id === WebInspector.TrackingHeapSnapshotProfileType .TypeId) {
46 this._trackingOverviewGrid = new WebInspector.HeapTrackingOverviewGrid(p rofile); 47 this._trackingOverviewGrid = new WebInspector.HeapTrackingOverviewGrid(p rofile);
47 this._trackingOverviewGrid.addEventListener(WebInspector.HeapTrackingOve rviewGrid.IdsRangeChanged, this._onIdsRangeChanged.bind(this)); 48 this._trackingOverviewGrid.addEventListener(WebInspector.HeapTrackingOve rviewGrid.IdsRangeChanged, this._onIdsRangeChanged.bind(this));
48 } 49 }
49 50
50 this._splitView = new WebInspector.SplitView(false, true, "heapSnapshotSplit ViewState", 200, 200); 51 this._splitView = new WebInspector.SplitView(false, true, "heapSnapshotSplit ViewState", 200, 200);
51 this._splitView.show(this.element); 52 this._splitView.show(this.element);
52 53
53 this._containmentView = new WebInspector.VBox(); 54 this._containmentView = new WebInspector.VBox();
54 this._containmentView.setMinimumSize(50, 25); 55 this._containmentView.setMinimumSize(50, 25);
55 this._containmentDataGrid = new WebInspector.HeapSnapshotContainmentDataGrid (); 56 this._containmentDataGrid = new WebInspector.HeapSnapshotContainmentDataGrid (panel);
56 this._containmentDataGrid.show(this._containmentView.element); 57 this._containmentDataGrid.show(this._containmentView.element);
57 this._containmentDataGrid.addEventListener(WebInspector.DataGrid.Events.Sele ctedNode, this._selectionChanged, this); 58 this._containmentDataGrid.addEventListener(WebInspector.DataGrid.Events.Sele ctedNode, this._selectionChanged, this);
58 59
59 this._statisticsView = new WebInspector.HeapSnapshotStatisticsView(); 60 this._statisticsView = new WebInspector.HeapSnapshotStatisticsView();
60 61
61 this._constructorsView = new WebInspector.VBox(); 62 this._constructorsView = new WebInspector.VBox();
62 this._constructorsView.setMinimumSize(50, 25); 63 this._constructorsView.setMinimumSize(50, 25);
63 64
64 this._constructorsDataGrid = new WebInspector.HeapSnapshotConstructorsDataGr id(); 65 this._constructorsDataGrid = new WebInspector.HeapSnapshotConstructorsDataGr id(panel);
65 this._constructorsDataGrid.show(this._constructorsView.element); 66 this._constructorsDataGrid.show(this._constructorsView.element);
66 this._constructorsDataGrid.addEventListener(WebInspector.DataGrid.Events.Sel ectedNode, this._selectionChanged, this); 67 this._constructorsDataGrid.addEventListener(WebInspector.DataGrid.Events.Sel ectedNode, this._selectionChanged, this);
67 68
68 this._diffView = new WebInspector.VBox(); 69 this._diffView = new WebInspector.VBox();
69 this._diffView.setMinimumSize(50, 25); 70 this._diffView.setMinimumSize(50, 25);
70 71
71 this._diffDataGrid = new WebInspector.HeapSnapshotDiffDataGrid(); 72 this._diffDataGrid = new WebInspector.HeapSnapshotDiffDataGrid(panel);
72 this._diffDataGrid.show(this._diffView.element); 73 this._diffDataGrid.show(this._diffView.element);
73 this._diffDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNod e, this._selectionChanged, this); 74 this._diffDataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNod e, this._selectionChanged, this);
74 75
75 this._dominatorView = new WebInspector.VBox(); 76 this._dominatorView = new WebInspector.VBox();
76 this._dominatorView.setMinimumSize(50, 25); 77 this._dominatorView.setMinimumSize(50, 25);
77 this._dominatorDataGrid = new WebInspector.HeapSnapshotDominatorsDataGrid(); 78 this._dominatorDataGrid = new WebInspector.HeapSnapshotDominatorsDataGrid(pa nel);
78 this._dominatorDataGrid.show(this._dominatorView.element); 79 this._dominatorDataGrid.show(this._dominatorView.element);
79 this._dominatorDataGrid.addEventListener(WebInspector.DataGrid.Events.Select edNode, this._selectionChanged, this); 80 this._dominatorDataGrid.addEventListener(WebInspector.DataGrid.Events.Select edNode, this._selectionChanged, this);
80 81
81 if (WebInspector.experimentsSettings.allocationProfiler.isEnabled() && profi le.profileType() === WebInspector.ProfileTypeRegistry.instance.trackingHeapSnaps hotProfileType) { 82 if (WebInspector.experimentsSettings.allocationProfiler.isEnabled() && profi le.profileType() === WebInspector.ProfileTypeRegistry.instance.trackingHeapSnaps hotProfileType) {
82 this._allocationView = new WebInspector.VBox(); 83 this._allocationView = new WebInspector.VBox();
83 this._allocationView.setMinimumSize(50, 25); 84 this._allocationView.setMinimumSize(50, 25);
84 this._allocationDataGrid = new WebInspector.AllocationDataGrid(); 85 this._allocationDataGrid = new WebInspector.AllocationDataGrid(panel);
85 this._allocationDataGrid.addEventListener(WebInspector.DataGrid.Events.S electedNode, this._onSelectAllocationNode, this); 86 this._allocationDataGrid.addEventListener(WebInspector.DataGrid.Events.S electedNode, this._onSelectAllocationNode, this);
86 this._allocationDataGrid.show(this._allocationView.element); 87 this._allocationDataGrid.show(this._allocationView.element);
87 88
88 this._allocationStackView = new WebInspector.HeapAllocationStackView(); 89 this._allocationStackView = new WebInspector.HeapAllocationStackView();
89 this._allocationStackView.setMinimumSize(50, 25); 90 this._allocationStackView.setMinimumSize(50, 25);
90 91
91 this._tabbedPane = new WebInspector.TabbedPane(); 92 this._tabbedPane = new WebInspector.TabbedPane();
92 this._tabbedPane.closeableTabs = false; 93 this._tabbedPane.closeableTabs = false;
93 this._tabbedPane.headerElement().classList.add("heap-object-details-head er"); 94 this._tabbedPane.headerElement().classList.add("heap-object-details-head er");
94 } 95 }
(...skipping 19 matching lines...) Expand all
114 var retainingPathsTitle = retainingPathsTitleDiv.createChild("span"); 115 var retainingPathsTitle = retainingPathsTitleDiv.createChild("span");
115 retainingPathsTitle.textContent = WebInspector.UIString("Retainers"); 116 retainingPathsTitle.textContent = WebInspector.UIString("Retainers");
116 this._retainmentView.element.appendChild(retainmentViewHeader); 117 this._retainmentView.element.appendChild(retainmentViewHeader);
117 118
118 splitViewResizer = retainmentViewHeader; 119 splitViewResizer = retainmentViewHeader;
119 this._objectDetailsView = this._retainmentView; 120 this._objectDetailsView = this._retainmentView;
120 } 121 }
121 this._splitView.hideDefaultResizer(); 122 this._splitView.hideDefaultResizer();
122 this._splitView.installResizer(splitViewResizer); 123 this._splitView.installResizer(splitViewResizer);
123 124
124 this._retainmentDataGrid = new WebInspector.HeapSnapshotRetainmentDataGrid() ; 125 this._retainmentDataGrid = new WebInspector.HeapSnapshotRetainmentDataGrid(p anel);
125 this._retainmentDataGrid.show(this._retainmentView.element); 126 this._retainmentDataGrid.show(this._retainmentView.element);
126 this._retainmentDataGrid.addEventListener(WebInspector.DataGrid.Events.Selec tedNode, this._inspectedObjectChanged, this); 127 this._retainmentDataGrid.addEventListener(WebInspector.DataGrid.Events.Selec tedNode, this._inspectedObjectChanged, this);
127 this._retainmentDataGrid.reset(); 128 this._retainmentDataGrid.reset();
128 129
129 this._perspectives = []; 130 this._perspectives = [];
130 this._perspectives.push(new WebInspector.HeapSnapshotView.SummaryPerspective ()); 131 this._perspectives.push(new WebInspector.HeapSnapshotView.SummaryPerspective ());
131 if (profile.profileType() !== WebInspector.ProfileTypeRegistry.instance.trac kingHeapSnapshotProfileType) 132 if (profile.profileType() !== WebInspector.ProfileTypeRegistry.instance.trac kingHeapSnapshotProfileType)
132 this._perspectives.push(new WebInspector.HeapSnapshotView.ComparisonPers pective()); 133 this._perspectives.push(new WebInspector.HeapSnapshotView.ComparisonPers pective());
133 this._perspectives.push(new WebInspector.HeapSnapshotView.ContainmentPerspec tive()); 134 this._perspectives.push(new WebInspector.HeapSnapshotView.ContainmentPerspec tive());
134 if (WebInspector.settings.showAdvancedHeapSnapshotProperties.get()) 135 if (WebInspector.settings.showAdvancedHeapSnapshotProperties.get())
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 /** 1219 /**
1219 * @param {?string} error 1220 * @param {?string} error
1220 * @this {WebInspector.HeapSnapshotProfileType} 1221 * @this {WebInspector.HeapSnapshotProfileType}
1221 */ 1222 */
1222 function didTakeHeapSnapshot(error) 1223 function didTakeHeapSnapshot(error)
1223 { 1224 {
1224 var profile = this._profileBeingRecorded; 1225 var profile = this._profileBeingRecorded;
1225 profile.title = WebInspector.UIString("Snapshot %d", profile.uid); 1226 profile.title = WebInspector.UIString("Snapshot %d", profile.uid);
1226 profile._finishLoad(); 1227 profile._finishLoad();
1227 this._profileBeingRecorded = null; 1228 this._profileBeingRecorded = null;
1228 WebInspector.panels.profiles.showProfile(profile); 1229 WebInspector.Revealer.reveal(profile);
yurys 2014/05/07 14:43:41 We could implement this as an event on correspondi
apavlov 2014/05/07 15:54:23 Done.
1229 callback(); 1230 callback();
1230 } 1231 }
1231 HeapProfilerAgent.takeHeapSnapshot(true, didTakeHeapSnapshot.bind(this)) ; 1232 HeapProfilerAgent.takeHeapSnapshot(true, didTakeHeapSnapshot.bind(this)) ;
1232 }, 1233 },
1233 1234
1234 /** 1235 /**
1235 * @override 1236 * @override
1236 * @param {string} chunk 1237 * @param {string} chunk
1237 */ 1238 */
1238 addHeapSnapshotChunk: function(chunk) 1239 addHeapSnapshotChunk: function(chunk)
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 function didTakeHeapSnapshot(error) 1408 function didTakeHeapSnapshot(error)
1408 { 1409 {
1409 var target = /** @type {!WebInspector.Target} */ (WebInspector.targe tManager.activeTarget()); 1410 var target = /** @type {!WebInspector.Target} */ (WebInspector.targe tManager.activeTarget());
1410 target.profilingLock.release(); 1411 target.profilingLock.release();
1411 var profile = this._profileBeingRecorded; 1412 var profile = this._profileBeingRecorded;
1412 if (!profile) 1413 if (!profile)
1413 return; 1414 return;
1414 profile._finishLoad(); 1415 profile._finishLoad();
1415 this._profileSamples = null; 1416 this._profileSamples = null;
1416 this._profileBeingRecorded = null; 1417 this._profileBeingRecorded = null;
1417 WebInspector.panels.profiles.showProfile(profile); 1418 WebInspector.Revealer.reveal(profile);
1418 } 1419 }
1419 1420
1420 HeapProfilerAgent.stopTrackingHeapObjects(true, didTakeHeapSnapshot.bind (this)); 1421 HeapProfilerAgent.stopTrackingHeapObjects(true, didTakeHeapSnapshot.bind (this));
1421 this._recording = false; 1422 this._recording = false;
1422 this.dispatchEventToListeners(WebInspector.TrackingHeapSnapshotProfileTy pe.TrackingStopped); 1423 this.dispatchEventToListeners(WebInspector.TrackingHeapSnapshotProfileTy pe.TrackingStopped);
1423 }, 1424 },
1424 1425
1425 _toggleRecording: function() 1426 _toggleRecording: function()
1426 { 1427 {
1427 if (this._recording) 1428 if (this._recording)
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 * @override 1505 * @override
1505 * @return {!WebInspector.ProfileSidebarTreeElement} 1506 * @return {!WebInspector.ProfileSidebarTreeElement}
1506 */ 1507 */
1507 createSidebarTreeElement: function() 1508 createSidebarTreeElement: function()
1508 { 1509 {
1509 return new WebInspector.ProfileSidebarTreeElement(this, "heap-snapshot-s idebar-tree-item"); 1510 return new WebInspector.ProfileSidebarTreeElement(this, "heap-snapshot-s idebar-tree-item");
1510 }, 1511 },
1511 1512
1512 /** 1513 /**
1513 * @override 1514 * @override
1515 * @param {!WebInspector.ProfilesPanel} panel
1514 * @return {!WebInspector.HeapSnapshotView} 1516 * @return {!WebInspector.HeapSnapshotView}
1515 */ 1517 */
1516 createView: function() 1518 createView: function(panel)
1517 { 1519 {
1518 return new WebInspector.HeapSnapshotView(this); 1520 return new WebInspector.HeapSnapshotView(panel, this);
1519 }, 1521 },
1520 1522
1521 /** 1523 /**
1522 * @override 1524 * @override
1523 * @param {function(!WebInspector.HeapSnapshotProxy):void} callback 1525 * @param {function(!WebInspector.HeapSnapshotProxy):void} callback
1524 */ 1526 */
1525 load: function(callback) 1527 load: function(callback)
1526 { 1528 {
1527 if (this.uid === -1) 1529 if (this.uid === -1)
1528 return; 1530 return;
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
2270 urlElement = this._linkifier.linkifyRawLocation(rawLocation) ; 2272 urlElement = this._linkifier.linkifyRawLocation(rawLocation) ;
2271 if (!urlElement) 2273 if (!urlElement)
2272 urlElement = this._linkifier.linkifyLocation(this._target, f rame.scriptName, frame.line - 1, frame.column - 1); 2274 urlElement = this._linkifier.linkifyLocation(this._target, f rame.scriptName, frame.line - 1, frame.column - 1);
2273 frameDiv.appendChild(urlElement); 2275 frameDiv.appendChild(urlElement);
2274 } 2276 }
2275 } 2277 }
2276 }, 2278 },
2277 2279
2278 __proto__: WebInspector.View.prototype 2280 __proto__: WebInspector.View.prototype
2279 } 2281 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698