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

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

Issue 218933003: Implement view port for allocation view (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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
« no previous file with comments | « no previous file | Source/devtools/front_end/HeapSnapshotGridNodes.js » ('j') | 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 1047
1048 this.snapshot.dominatorIdsForNode(parseInt(id, 10), didGetDominators.bin d(this)); 1048 this.snapshot.dominatorIdsForNode(parseInt(id, 10), didGetDominators.bin d(this));
1049 }, 1049 },
1050 1050
1051 __proto__: WebInspector.HeapSnapshotSortableDataGrid.prototype 1051 __proto__: WebInspector.HeapSnapshotSortableDataGrid.prototype
1052 } 1052 }
1053 1053
1054 1054
1055 /** 1055 /**
1056 * @constructor 1056 * @constructor
1057 * @extends {WebInspector.DataGrid} 1057 * @extends {WebInspector.HeapSnapshotViewportDataGrid}
1058 */ 1058 */
1059 WebInspector.AllocationDataGrid = function() 1059 WebInspector.AllocationDataGrid = function()
1060 { 1060 {
1061 var columns = [ 1061 var columns = [
1062 {id: "liveCount", title: WebInspector.UIString("Live Count"), width: "72 px", sortable: true}, 1062 {id: "liveCount", title: WebInspector.UIString("Live Count"), width: "72 px", sortable: true},
1063 {id: "count", title: WebInspector.UIString("Count"), width: "72px", sort able: true}, 1063 {id: "count", title: WebInspector.UIString("Count"), width: "72px", sort able: true},
1064 {id: "liveSize", title: WebInspector.UIString("Live Size"), width: "72px ", sortable: true}, 1064 {id: "liveSize", title: WebInspector.UIString("Live Size"), width: "72px ", sortable: true},
1065 {id: "size", title: WebInspector.UIString("Size"), width: "72px", sortab le: true, sort: WebInspector.DataGrid.Order.Descending}, 1065 {id: "size", title: WebInspector.UIString("Size"), width: "72px", sortab le: true, sort: WebInspector.DataGrid.Order.Descending},
1066 {id: "name", title: WebInspector.UIString("Function"), disclosure: true, sortable: true}, 1066 {id: "name", title: WebInspector.UIString("Function"), disclosure: true, sortable: true},
1067 ]; 1067 ];
1068 WebInspector.DataGrid.call(this, columns); 1068 WebInspector.HeapSnapshotViewportDataGrid.call(this, columns);
1069 this._linkifier = new WebInspector.Linkifier(); 1069 this._linkifier = new WebInspector.Linkifier();
1070 this.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._sor tingChanged, this);
1071 } 1070 }
1072 1071
1073 WebInspector.AllocationDataGrid.prototype = { 1072 WebInspector.AllocationDataGrid.prototype = {
1074 setDataSource: function(snapshot) 1073 setDataSource: function(snapshot)
1075 { 1074 {
1076 this.snapshot = snapshot; 1075 this.snapshot = snapshot;
1077 this.snapshot.allocationTracesTops(didReceiveAllocationTracesTops.bind(t his)); 1076 this.snapshot.allocationTracesTops(didReceiveAllocationTracesTops.bind(t his));
1078 1077
1079 /** 1078 /**
1080 * @param {!Array.<!WebInspector.HeapSnapshotCommon.SerializedAllocation Node>} tops 1079 * @param {!Array.<!WebInspector.HeapSnapshotCommon.SerializedAllocation Node>} tops
1081 * @this {WebInspector.AllocationDataGrid} 1080 * @this {WebInspector.AllocationDataGrid}
1082 */ 1081 */
1083 function didReceiveAllocationTracesTops(tops) 1082 function didReceiveAllocationTracesTops(tops)
1084 { 1083 {
1085 this._topNodes = tops; 1084 this._topNodes = tops;
1086 this._populateChildren(); 1085 this._populateChildren();
1087 } 1086 }
1088 }, 1087 },
1089 1088
1090 _populateChildren: function() 1089 _populateChildren: function()
1091 { 1090 {
1091 this.removeTopLevelNodes();
1092 var root = this.rootNode(); 1092 var root = this.rootNode();
1093 var tops = this._topNodes; 1093 var tops = this._topNodes;
1094 for (var i = 0; i < tops.length; i++) 1094 for (var i = 0; i < tops.length; i++)
1095 root.appendChild(new WebInspector.AllocationGridNode(this, tops[i])) ; 1095 this.appendNode(root, new WebInspector.AllocationGridNode(this, tops [i]));
1096 this.updateVisibleNodes(true);
1096 }, 1097 },
1097 1098
1098 _sortingChanged: function() 1099 sortingChanged: function()
1099 { 1100 {
1100 this._topNodes.sort(this._createComparator()); 1101 this._topNodes.sort(this._createComparator());
1101 this.rootNode().removeChildren(); 1102 this.rootNode().removeChildren();
1102 this._populateChildren(); 1103 this._populateChildren();
1103 }, 1104 },
1104 1105
1105 1106
1106 /** 1107 /**
1107 * @return {function(!Object, !Object):number} 1108 * @return {function(!Object, !Object):number}
1108 */ 1109 */
(...skipping 10 matching lines...) Expand all
1119 { 1120 {
1120 if (a[fieldName] > b[fieldName]) 1121 if (a[fieldName] > b[fieldName])
1121 return compareResult; 1122 return compareResult;
1122 if (a[fieldName] < b[fieldName]) 1123 if (a[fieldName] < b[fieldName])
1123 return -compareResult; 1124 return -compareResult;
1124 return 0; 1125 return 0;
1125 } 1126 }
1126 return compare; 1127 return compare;
1127 }, 1128 },
1128 1129
1129 __proto__: WebInspector.DataGrid.prototype 1130 __proto__: WebInspector.HeapSnapshotViewportDataGrid.prototype
1130 } 1131 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/HeapSnapshotGridNodes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698