OLD | NEW |
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 */ | 132 */ |
133 _provider: function() | 133 _provider: function() |
134 { | 134 { |
135 if (!this._providerObject) | 135 if (!this._providerObject) |
136 this._providerObject = this.createProvider(); | 136 this._providerObject = this.createProvider(); |
137 return this._providerObject; | 137 return this._providerObject; |
138 }, | 138 }, |
139 | 139 |
140 /** | 140 /** |
141 * @override | 141 * @override |
142 * @param {string} columnIdentifier | 142 * @param {string} columnId |
143 * @return {!Element} | 143 * @return {!Element} |
144 */ | 144 */ |
145 createCell: function(columnIdentifier) | 145 createCell: function(columnId) |
146 { | 146 { |
147 var cell = WebInspector.DataGridNode.prototype.createCell.call(this, col
umnIdentifier); | 147 var cell = WebInspector.DataGridNode.prototype.createCell.call(this, col
umnId); |
148 if (this._searchMatched) | 148 if (this._searchMatched) |
149 cell.classList.add("highlight"); | 149 cell.classList.add("highlight"); |
150 return cell; | 150 return cell; |
151 }, | 151 }, |
152 | 152 |
153 /** | 153 /** |
154 * @override | 154 * @override |
155 */ | 155 */ |
156 collapse: function() | 156 collapse: function() |
157 { | 157 { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 if (range.from <= nodePosition && nodePosition < range.to) { | 238 if (range.from <= nodePosition && nodePosition < range.to) { |
239 var childIndex = indexOfFirstChildInRange + nodePosition - range
.from; | 239 var childIndex = indexOfFirstChildInRange + nodePosition - range
.from; |
240 return this.allChildren()[childIndex]; | 240 return this.allChildren()[childIndex]; |
241 } | 241 } |
242 indexOfFirstChildInRange += range.to - range.from + 1; | 242 indexOfFirstChildInRange += range.to - range.from + 1; |
243 } | 243 } |
244 return null; | 244 return null; |
245 }, | 245 }, |
246 | 246 |
247 /** | 247 /** |
248 * @param {string} columnIdentifier | 248 * @param {string} columnId |
249 * @return {!Element} | 249 * @return {!Element} |
250 */ | 250 */ |
251 _createValueCell: function(columnIdentifier) | 251 _createValueCell: function(columnId) |
252 { | 252 { |
253 var cell = createElement("td"); | 253 var cell = createElement("td"); |
254 cell.className = "numeric-column"; | 254 cell.className = "numeric-column"; |
255 if (this.dataGrid.snapshot.totalSize !== 0) { | 255 if (this.dataGrid.snapshot.totalSize !== 0) { |
256 var div = createElement("div"); | 256 var div = createElement("div"); |
257 var valueSpan = createElement("span"); | 257 var valueSpan = createElement("span"); |
258 valueSpan.textContent = this.data[columnIdentifier]; | 258 valueSpan.textContent = this.data[columnId]; |
259 div.appendChild(valueSpan); | 259 div.appendChild(valueSpan); |
260 var percentColumn = columnIdentifier + "-percent"; | 260 var percentColumn = columnId + "-percent"; |
261 if (percentColumn in this.data) { | 261 if (percentColumn in this.data) { |
262 var percentSpan = createElement("span"); | 262 var percentSpan = createElement("span"); |
263 percentSpan.className = "percent-column"; | 263 percentSpan.className = "percent-column"; |
264 percentSpan.textContent = this.data[percentColumn]; | 264 percentSpan.textContent = this.data[percentColumn]; |
265 div.appendChild(percentSpan); | 265 div.appendChild(percentSpan); |
266 div.classList.add("profile-multiple-values"); | 266 div.classList.add("profile-multiple-values"); |
267 } | 267 } |
268 cell.appendChild(div); | 268 cell.appendChild(div); |
269 } | 269 } |
270 return cell; | 270 return cell; |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 * @override | 537 * @override |
538 * @return {?{snapshot:!WebInspector.HeapSnapshotProxy, snapshotNodeIndex:nu
mber}} | 538 * @return {?{snapshot:!WebInspector.HeapSnapshotProxy, snapshotNodeIndex:nu
mber}} |
539 */ | 539 */ |
540 retainersDataSource: function() | 540 retainersDataSource: function() |
541 { | 541 { |
542 return {snapshot: this._dataGrid.snapshot, snapshotNodeIndex: this.snaps
hotNodeIndex}; | 542 return {snapshot: this._dataGrid.snapshot, snapshotNodeIndex: this.snaps
hotNodeIndex}; |
543 }, | 543 }, |
544 | 544 |
545 /** | 545 /** |
546 * @override | 546 * @override |
547 * @param {string} columnIdentifier | 547 * @param {string} columnId |
548 * @return {!Element} | 548 * @return {!Element} |
549 */ | 549 */ |
550 createCell: function(columnIdentifier) | 550 createCell: function(columnId) |
551 { | 551 { |
552 var cell = columnIdentifier !== "object" ? this._createValueCell(columnI
dentifier) : this._createObjectCell(); | 552 var cell = columnId !== "object" ? this._createValueCell(columnId) : thi
s._createObjectCell(); |
553 if (this._searchMatched) | 553 if (this._searchMatched) |
554 cell.classList.add("highlight"); | 554 cell.classList.add("highlight"); |
555 return cell; | 555 return cell; |
556 }, | 556 }, |
557 | 557 |
558 /** | 558 /** |
559 * @return {!Element} | 559 * @return {!Element} |
560 */ | 560 */ |
561 _createObjectCell: function() | 561 _createObjectCell: function() |
562 { | 562 { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 { | 773 { |
774 return childNode._edgeIndex; | 774 return childNode._edgeIndex; |
775 }, | 775 }, |
776 | 776 |
777 /** | 777 /** |
778 * @return {!WebInspector.HeapSnapshotCommon.ComparatorConfig} | 778 * @return {!WebInspector.HeapSnapshotCommon.ComparatorConfig} |
779 */ | 779 */ |
780 comparator: function() | 780 comparator: function() |
781 { | 781 { |
782 var sortAscending = this._dataGrid.isSortOrderAscending(); | 782 var sortAscending = this._dataGrid.isSortOrderAscending(); |
783 var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier(); | 783 var sortColumnId = this._dataGrid.sortColumnId(); |
784 var sortFields = { | 784 var sortFields = { |
785 object: ["!edgeName", sortAscending, "retainedSize", false], | 785 object: ["!edgeName", sortAscending, "retainedSize", false], |
786 count: ["!edgeName", true, "retainedSize", false], | 786 count: ["!edgeName", true, "retainedSize", false], |
787 shallowSize: ["selfSize", sortAscending, "!edgeName", true], | 787 shallowSize: ["selfSize", sortAscending, "!edgeName", true], |
788 retainedSize: ["retainedSize", sortAscending, "!edgeName", true], | 788 retainedSize: ["retainedSize", sortAscending, "!edgeName", true], |
789 distance: ["distance", sortAscending, "_name", true] | 789 distance: ["distance", sortAscending, "_name", true] |
790 }[sortColumnIdentifier] || ["!edgeName", true, "retainedSize", false]; | 790 }[sortColumnId] || ["!edgeName", true, "retainedSize", false]; |
791 return WebInspector.HeapSnapshotGridNode.createComparator(sortFields); | 791 return WebInspector.HeapSnapshotGridNode.createComparator(sortFields); |
792 }, | 792 }, |
793 | 793 |
794 _prefixObjectCell: function(div) | 794 _prefixObjectCell: function(div) |
795 { | 795 { |
796 var name = this._referenceName || "(empty)"; | 796 var name = this._referenceName || "(empty)"; |
797 var nameClass = "name"; | 797 var nameClass = "name"; |
798 switch (this._referenceType) { | 798 switch (this._referenceType) { |
799 case "context": | 799 case "context": |
800 nameClass = "object-value-number"; | 800 nameClass = "object-value-number"; |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 { | 991 { |
992 return childNode._edgeIndex; | 992 return childNode._edgeIndex; |
993 }, | 993 }, |
994 | 994 |
995 /** | 995 /** |
996 * @return {!WebInspector.HeapSnapshotCommon.ComparatorConfig} | 996 * @return {!WebInspector.HeapSnapshotCommon.ComparatorConfig} |
997 */ | 997 */ |
998 comparator: function() | 998 comparator: function() |
999 { | 999 { |
1000 var sortAscending = this._dataGrid.isSortOrderAscending(); | 1000 var sortAscending = this._dataGrid.isSortOrderAscending(); |
1001 var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier(); | 1001 var sortColumnId = this._dataGrid.sortColumnId(); |
1002 var sortFields = { | 1002 var sortFields = { |
1003 object: ["!edgeName", sortAscending, "retainedSize", false], | 1003 object: ["!edgeName", sortAscending, "retainedSize", false], |
1004 distance: ["distance", sortAscending, "retainedSize", false], | 1004 distance: ["distance", sortAscending, "retainedSize", false], |
1005 count: ["!edgeName", true, "retainedSize", false], | 1005 count: ["!edgeName", true, "retainedSize", false], |
1006 addedSize: ["selfSize", sortAscending, "!edgeName", true], | 1006 addedSize: ["selfSize", sortAscending, "!edgeName", true], |
1007 removedSize: ["selfSize", sortAscending, "!edgeName", true], | 1007 removedSize: ["selfSize", sortAscending, "!edgeName", true], |
1008 shallowSize: ["selfSize", sortAscending, "!edgeName", true], | 1008 shallowSize: ["selfSize", sortAscending, "!edgeName", true], |
1009 retainedSize: ["retainedSize", sortAscending, "!edgeName", true] | 1009 retainedSize: ["retainedSize", sortAscending, "!edgeName", true] |
1010 }[sortColumnIdentifier] || ["!edgeName", true, "retainedSize", false]; | 1010 }[sortColumnId] || ["!edgeName", true, "retainedSize", false]; |
1011 return WebInspector.HeapSnapshotGridNode.createComparator(sortFields); | 1011 return WebInspector.HeapSnapshotGridNode.createComparator(sortFields); |
1012 }, | 1012 }, |
1013 | 1013 |
1014 __proto__: WebInspector.HeapSnapshotGenericObjectNode.prototype | 1014 __proto__: WebInspector.HeapSnapshotGenericObjectNode.prototype |
1015 }; | 1015 }; |
1016 | 1016 |
1017 /** | 1017 /** |
1018 * @constructor | 1018 * @constructor |
1019 * @param {!WebInspector.HeapSnapshotConstructorsDataGrid} dataGrid | 1019 * @param {!WebInspector.HeapSnapshotConstructorsDataGrid} dataGrid |
1020 * @param {string} className | 1020 * @param {string} className |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 * @param {string} filterValue | 1115 * @param {string} filterValue |
1116 * @return {boolean} | 1116 * @return {boolean} |
1117 */ | 1117 */ |
1118 filteredOut: function(filterValue) | 1118 filteredOut: function(filterValue) |
1119 { | 1119 { |
1120 return this._name.toLowerCase().indexOf(filterValue) === -1; | 1120 return this._name.toLowerCase().indexOf(filterValue) === -1; |
1121 }, | 1121 }, |
1122 | 1122 |
1123 /** | 1123 /** |
1124 * @override | 1124 * @override |
1125 * @param {string} columnIdentifier | 1125 * @param {string} columnId |
1126 * @return {!Element} | 1126 * @return {!Element} |
1127 */ | 1127 */ |
1128 createCell: function(columnIdentifier) | 1128 createCell: function(columnId) |
1129 { | 1129 { |
1130 var cell = columnIdentifier !== "object" ? this._createValueCell(columnI
dentifier) : WebInspector.HeapSnapshotGridNode.prototype.createCell.call(this, c
olumnIdentifier); | 1130 var cell = columnId !== "object" ? this._createValueCell(columnId) : Web
Inspector.HeapSnapshotGridNode.prototype.createCell.call(this, columnId); |
1131 if (this._searchMatched) | 1131 if (this._searchMatched) |
1132 cell.classList.add("highlight"); | 1132 cell.classList.add("highlight"); |
1133 return cell; | 1133 return cell; |
1134 }, | 1134 }, |
1135 | 1135 |
1136 /** | 1136 /** |
1137 * @param {!WebInspector.HeapSnapshotCommon.Node} item | 1137 * @param {!WebInspector.HeapSnapshotCommon.Node} item |
1138 * @return {!WebInspector.HeapSnapshotInstanceNode} | 1138 * @return {!WebInspector.HeapSnapshotInstanceNode} |
1139 */ | 1139 */ |
1140 _createChildNode: function(item) | 1140 _createChildNode: function(item) |
1141 { | 1141 { |
1142 return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid, this._d
ataGrid.snapshot, item, false); | 1142 return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid, this._d
ataGrid.snapshot, item, false); |
1143 }, | 1143 }, |
1144 | 1144 |
1145 /** | 1145 /** |
1146 * @return {!WebInspector.HeapSnapshotCommon.ComparatorConfig} | 1146 * @return {!WebInspector.HeapSnapshotCommon.ComparatorConfig} |
1147 */ | 1147 */ |
1148 comparator: function() | 1148 comparator: function() |
1149 { | 1149 { |
1150 var sortAscending = this._dataGrid.isSortOrderAscending(); | 1150 var sortAscending = this._dataGrid.isSortOrderAscending(); |
1151 var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier(); | 1151 var sortColumnId = this._dataGrid.sortColumnId(); |
1152 var sortFields = { | 1152 var sortFields = { |
1153 object: ["name", sortAscending, "id", true], | 1153 object: ["name", sortAscending, "id", true], |
1154 distance: ["distance", sortAscending, "retainedSize", false], | 1154 distance: ["distance", sortAscending, "retainedSize", false], |
1155 count: ["name", true, "id", true], | 1155 count: ["name", true, "id", true], |
1156 shallowSize: ["selfSize", sortAscending, "id", true], | 1156 shallowSize: ["selfSize", sortAscending, "id", true], |
1157 retainedSize: ["retainedSize", sortAscending, "id", true] | 1157 retainedSize: ["retainedSize", sortAscending, "id", true] |
1158 }[sortColumnIdentifier]; | 1158 }[sortColumnId]; |
1159 return WebInspector.HeapSnapshotGridNode.createComparator(sortFields); | 1159 return WebInspector.HeapSnapshotGridNode.createComparator(sortFields); |
1160 }, | 1160 }, |
1161 | 1161 |
1162 /** | 1162 /** |
1163 * @param {!WebInspector.HeapSnapshotCommon.Node} node | 1163 * @param {!WebInspector.HeapSnapshotCommon.Node} node |
1164 * @return {number} | 1164 * @return {number} |
1165 */ | 1165 */ |
1166 _childHashForEntity: function(node) | 1166 _childHashForEntity: function(node) |
1167 { | 1167 { |
1168 return node.id; | 1168 return node.id; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 var tree = this._dataGrid; | 1344 var tree = this._dataGrid; |
1345 return new WebInspector.HeapSnapshotDiffNodesProvider( | 1345 return new WebInspector.HeapSnapshotDiffNodesProvider( |
1346 tree.snapshot.createAddedNodesProvider(tree.baseSnapshot.uid, this._
name), | 1346 tree.snapshot.createAddedNodesProvider(tree.baseSnapshot.uid, this._
name), |
1347 tree.baseSnapshot.createDeletedNodesProvider(this._deletedIndexes), | 1347 tree.baseSnapshot.createDeletedNodesProvider(this._deletedIndexes), |
1348 this._addedCount, | 1348 this._addedCount, |
1349 this._removedCount); | 1349 this._removedCount); |
1350 }, | 1350 }, |
1351 | 1351 |
1352 /** | 1352 /** |
1353 * @override | 1353 * @override |
1354 * @param {string} columnIdentifier | 1354 * @param {string} columnId |
1355 * @return {!Element} | 1355 * @return {!Element} |
1356 */ | 1356 */ |
1357 createCell: function(columnIdentifier) | 1357 createCell: function(columnId) |
1358 { | 1358 { |
1359 var cell = WebInspector.HeapSnapshotGridNode.prototype.createCell.call(t
his, columnIdentifier); | 1359 var cell = WebInspector.HeapSnapshotGridNode.prototype.createCell.call(t
his, columnId); |
1360 if (columnIdentifier !== "object") | 1360 if (columnId !== "object") |
1361 cell.classList.add("numeric-column"); | 1361 cell.classList.add("numeric-column"); |
1362 return cell; | 1362 return cell; |
1363 }, | 1363 }, |
1364 | 1364 |
1365 /** | 1365 /** |
1366 * @param {!WebInspector.HeapSnapshotCommon.Node} item | 1366 * @param {!WebInspector.HeapSnapshotCommon.Node} item |
1367 * @return {!WebInspector.HeapSnapshotInstanceNode} | 1367 * @return {!WebInspector.HeapSnapshotInstanceNode} |
1368 */ | 1368 */ |
1369 _createChildNode: function(item) | 1369 _createChildNode: function(item) |
1370 { | 1370 { |
(...skipping 20 matching lines...) Expand all Loading... |
1391 { | 1391 { |
1392 return childNode.snapshotNodeId; | 1392 return childNode.snapshotNodeId; |
1393 }, | 1393 }, |
1394 | 1394 |
1395 /** | 1395 /** |
1396 * @return {!WebInspector.HeapSnapshotCommon.ComparatorConfig} | 1396 * @return {!WebInspector.HeapSnapshotCommon.ComparatorConfig} |
1397 */ | 1397 */ |
1398 comparator: function() | 1398 comparator: function() |
1399 { | 1399 { |
1400 var sortAscending = this._dataGrid.isSortOrderAscending(); | 1400 var sortAscending = this._dataGrid.isSortOrderAscending(); |
1401 var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier(); | 1401 var sortColumnId = this._dataGrid.sortColumnId(); |
1402 var sortFields = { | 1402 var sortFields = { |
1403 object: ["name", sortAscending, "id", true], | 1403 object: ["name", sortAscending, "id", true], |
1404 addedCount: ["name", true, "id", true], | 1404 addedCount: ["name", true, "id", true], |
1405 removedCount: ["name", true, "id", true], | 1405 removedCount: ["name", true, "id", true], |
1406 countDelta: ["name", true, "id", true], | 1406 countDelta: ["name", true, "id", true], |
1407 addedSize: ["selfSize", sortAscending, "id", true], | 1407 addedSize: ["selfSize", sortAscending, "id", true], |
1408 removedSize: ["selfSize", sortAscending, "id", true], | 1408 removedSize: ["selfSize", sortAscending, "id", true], |
1409 sizeDelta: ["selfSize", sortAscending, "id", true] | 1409 sizeDelta: ["selfSize", sortAscending, "id", true] |
1410 }[sortColumnIdentifier]; | 1410 }[sortColumnId]; |
1411 return WebInspector.HeapSnapshotGridNode.createComparator(sortFields); | 1411 return WebInspector.HeapSnapshotGridNode.createComparator(sortFields); |
1412 }, | 1412 }, |
1413 | 1413 |
1414 /** | 1414 /** |
1415 * @param {string} filterValue | 1415 * @param {string} filterValue |
1416 * @return {boolean} | 1416 * @return {boolean} |
1417 */ | 1417 */ |
1418 filteredOut: function(filterValue) | 1418 filteredOut: function(filterValue) |
1419 { | 1419 { |
1420 return this._name.toLowerCase().indexOf(filterValue) === -1; | 1420 return this._name.toLowerCase().indexOf(filterValue) === -1; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 */ | 1493 */ |
1494 expand: function() | 1494 expand: function() |
1495 { | 1495 { |
1496 WebInspector.HeapSnapshotGridNode.prototype.expand.call(this); | 1496 WebInspector.HeapSnapshotGridNode.prototype.expand.call(this); |
1497 if (this.children.length === 1) | 1497 if (this.children.length === 1) |
1498 this.children[0].expand(); | 1498 this.children[0].expand(); |
1499 }, | 1499 }, |
1500 | 1500 |
1501 /** | 1501 /** |
1502 * @override | 1502 * @override |
1503 * @param {string} columnIdentifier | 1503 * @param {string} columnId |
1504 * @return {!Element} | 1504 * @return {!Element} |
1505 */ | 1505 */ |
1506 createCell: function(columnIdentifier) | 1506 createCell: function(columnId) |
1507 { | 1507 { |
1508 if (columnIdentifier !== "name") | 1508 if (columnId !== "name") |
1509 return this._createValueCell(columnIdentifier); | 1509 return this._createValueCell(columnId); |
1510 | 1510 |
1511 var cell = WebInspector.HeapSnapshotGridNode.prototype.createCell.call(t
his, columnIdentifier); | 1511 var cell = WebInspector.HeapSnapshotGridNode.prototype.createCell.call(t
his, columnId); |
1512 var allocationNode = this._allocationNode; | 1512 var allocationNode = this._allocationNode; |
1513 var target = this._dataGrid.target(); | 1513 var target = this._dataGrid.target(); |
1514 if (allocationNode.scriptId) { | 1514 if (allocationNode.scriptId) { |
1515 var linkifier = this._dataGrid._linkifier; | 1515 var linkifier = this._dataGrid._linkifier; |
1516 var urlElement = linkifier.linkifyScriptLocation(target, String(allo
cationNode.scriptId), allocationNode.scriptName, allocationNode.line - 1, alloca
tionNode.column - 1, "profile-node-file"); | 1516 var urlElement = linkifier.linkifyScriptLocation(target, String(allo
cationNode.scriptId), allocationNode.scriptName, allocationNode.line - 1, alloca
tionNode.column - 1, "profile-node-file"); |
1517 urlElement.style.maxWidth = "75%"; | 1517 urlElement.style.maxWidth = "75%"; |
1518 cell.insertBefore(urlElement, cell.firstChild); | 1518 cell.insertBefore(urlElement, cell.firstChild); |
1519 } | 1519 } |
1520 return cell; | 1520 return cell; |
1521 }, | 1521 }, |
1522 | 1522 |
1523 /** | 1523 /** |
1524 * @return {number} | 1524 * @return {number} |
1525 */ | 1525 */ |
1526 allocationNodeId: function() | 1526 allocationNodeId: function() |
1527 { | 1527 { |
1528 return this._allocationNode.id; | 1528 return this._allocationNode.id; |
1529 }, | 1529 }, |
1530 | 1530 |
1531 __proto__: WebInspector.HeapSnapshotGridNode.prototype | 1531 __proto__: WebInspector.HeapSnapshotGridNode.prototype |
1532 }; | 1532 }; |
OLD | NEW |