| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 /** | 51 /** |
| 52 * @type {?Profiler.HeapSnapshotGridNode.ChildrenProvider} | 52 * @type {?Profiler.HeapSnapshotGridNode.ChildrenProvider} |
| 53 */ | 53 */ |
| 54 this._providerObject = null; | 54 this._providerObject = null; |
| 55 this._reachableFromWindow = false; | 55 this._reachableFromWindow = false; |
| 56 } | 56 } |
| 57 | 57 |
| 58 /** | 58 /** |
| 59 * @param {!Array.<string>} fieldNames | 59 * @param {!Array.<string>} fieldNames |
| 60 * @return {!Profiler.HeapSnapshotCommon.ComparatorConfig} | 60 * @return {!HeapSnapshotModel.ComparatorConfig} |
| 61 */ | 61 */ |
| 62 static createComparator(fieldNames) { | 62 static createComparator(fieldNames) { |
| 63 return /** @type {!Profiler.HeapSnapshotCommon.ComparatorConfig} */ ( | 63 return /** @type {!HeapSnapshotModel.ComparatorConfig} */ ( |
| 64 {fieldName1: fieldNames[0], ascending1: fieldNames[1], fieldName2: field
Names[2], ascending2: fieldNames[3]}); | 64 {fieldName1: fieldNames[0], ascending1: fieldNames[1], fieldName2: field
Names[2], ascending2: fieldNames[3]}); |
| 65 } | 65 } |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 * @return {!Profiler.HeapSnapshotSortableDataGrid} | 68 * @return {!Profiler.HeapSnapshotSortableDataGrid} |
| 69 */ | 69 */ |
| 70 heapSnapshotDataGrid() { | 70 heapSnapshotDataGrid() { |
| 71 return this._dataGrid; | 71 return this._dataGrid; |
| 72 } | 72 } |
| 73 | 73 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 */ | 152 */ |
| 153 _toPercentString(num) { | 153 _toPercentString(num) { |
| 154 return num.toFixed(0) + '\u2009%'; // \u2009 is a thin space. | 154 return num.toFixed(0) + '\u2009%'; // \u2009 is a thin space. |
| 155 } | 155 } |
| 156 | 156 |
| 157 /** | 157 /** |
| 158 * @param {number} distance | 158 * @param {number} distance |
| 159 * @return {string} | 159 * @return {string} |
| 160 */ | 160 */ |
| 161 _toUIDistance(distance) { | 161 _toUIDistance(distance) { |
| 162 var baseSystemDistance = Profiler.HeapSnapshotCommon.baseSystemDistance; | 162 var baseSystemDistance = HeapSnapshotModel.baseSystemDistance; |
| 163 return distance >= 0 && distance < baseSystemDistance ? Common.UIString('%d'
, distance) : Common.UIString('\u2212'); | 163 return distance >= 0 && distance < baseSystemDistance ? Common.UIString('%d'
, distance) : Common.UIString('\u2212'); |
| 164 } | 164 } |
| 165 | 165 |
| 166 /** | 166 /** |
| 167 * @return {!Array.<!DataGrid.DataGridNode>} | 167 * @return {!Array.<!DataGrid.DataGridNode>} |
| 168 */ | 168 */ |
| 169 allChildren() { | 169 allChildren() { |
| 170 return this._dataGrid.allChildren(this); | 170 return this._dataGrid.allChildren(this); |
| 171 } | 171 } |
| 172 | 172 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 /** | 277 /** |
| 278 * @this {Profiler.HeapSnapshotGridNode} | 278 * @this {Profiler.HeapSnapshotGridNode} |
| 279 */ | 279 */ |
| 280 function insertShowMoreButton(from, to, insertionIndex) { | 280 function insertShowMoreButton(from, to, insertionIndex) { |
| 281 var button = new DataGrid.ShowMoreDataGridNode( | 281 var button = new DataGrid.ShowMoreDataGridNode( |
| 282 this._populateChildren.bind(this), from, to, this._dataGrid.defaultPop
ulateCount()); | 282 this._populateChildren.bind(this), from, to, this._dataGrid.defaultPop
ulateCount()); |
| 283 this._dataGrid.insertChild(this, button, insertionIndex); | 283 this._dataGrid.insertChild(this, button, insertionIndex); |
| 284 } | 284 } |
| 285 | 285 |
| 286 /** | 286 /** |
| 287 * @param {!Profiler.HeapSnapshotCommon.ItemsRange} itemsRange | 287 * @param {!HeapSnapshotModel.ItemsRange} itemsRange |
| 288 * @this {Profiler.HeapSnapshotGridNode} | 288 * @this {Profiler.HeapSnapshotGridNode} |
| 289 */ | 289 */ |
| 290 function childrenRetrieved(itemsRange) { | 290 function childrenRetrieved(itemsRange) { |
| 291 var itemIndex = 0; | 291 var itemIndex = 0; |
| 292 var itemPosition = itemsRange.startPosition; | 292 var itemPosition = itemsRange.startPosition; |
| 293 var items = itemsRange.items; | 293 var items = itemsRange.items; |
| 294 var insertionIndex = 0; | 294 var insertionIndex = 0; |
| 295 | 295 |
| 296 if (!this._retrievedChildrenRanges.length) { | 296 if (!this._retrievedChildrenRanges.length) { |
| 297 if (itemsRange.startPosition > 0) { | 297 if (itemsRange.startPosition > 0) { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 nodePosition(snapshotObjectId) {}, | 452 nodePosition(snapshotObjectId) {}, |
| 453 | 453 |
| 454 /** | 454 /** |
| 455 * @param {function(boolean)} callback | 455 * @param {function(boolean)} callback |
| 456 */ | 456 */ |
| 457 isEmpty(callback) {}, | 457 isEmpty(callback) {}, |
| 458 | 458 |
| 459 /** | 459 /** |
| 460 * @param {number} startPosition | 460 * @param {number} startPosition |
| 461 * @param {number} endPosition | 461 * @param {number} endPosition |
| 462 * @param {function(!Profiler.HeapSnapshotCommon.ItemsRange)} callback | 462 * @param {function(!HeapSnapshotModel.ItemsRange)} callback |
| 463 */ | 463 */ |
| 464 serializeItemsRange(startPosition, endPosition, callback) {}, | 464 serializeItemsRange(startPosition, endPosition, callback) {}, |
| 465 | 465 |
| 466 /** | 466 /** |
| 467 * @param {!Profiler.HeapSnapshotCommon.ComparatorConfig} comparator | 467 * @param {!HeapSnapshotModel.ComparatorConfig} comparator |
| 468 * @return {!Promise<?>} | 468 * @return {!Promise<?>} |
| 469 */ | 469 */ |
| 470 sortAndRewind(comparator) {} | 470 sortAndRewind(comparator) {} |
| 471 }; | 471 }; |
| 472 | 472 |
| 473 /** | 473 /** |
| 474 * @unrestricted | 474 * @unrestricted |
| 475 */ | 475 */ |
| 476 Profiler.HeapSnapshotGenericObjectNode = class extends Profiler.HeapSnapshotGrid
Node { | 476 Profiler.HeapSnapshotGenericObjectNode = class extends Profiler.HeapSnapshotGrid
Node { |
| 477 /** | 477 /** |
| 478 * @param {!Profiler.HeapSnapshotSortableDataGrid} dataGrid | 478 * @param {!Profiler.HeapSnapshotSortableDataGrid} dataGrid |
| 479 * @param {!Profiler.HeapSnapshotCommon.Node} node | 479 * @param {!HeapSnapshotModel.Node} node |
| 480 */ | 480 */ |
| 481 constructor(dataGrid, node) { | 481 constructor(dataGrid, node) { |
| 482 super(dataGrid, false); | 482 super(dataGrid, false); |
| 483 // node is null for DataGrid root nodes. | 483 // node is null for DataGrid root nodes. |
| 484 if (!node) | 484 if (!node) |
| 485 return; | 485 return; |
| 486 this._name = node.name; | 486 this._name = node.name; |
| 487 this._type = node.type; | 487 this._type = node.type; |
| 488 this._distance = node.distance; | 488 this._distance = node.distance; |
| 489 this._shallowSize = node.selfSize; | 489 this._shallowSize = node.selfSize; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 } | 656 } |
| 657 }; | 657 }; |
| 658 | 658 |
| 659 /** | 659 /** |
| 660 * @unrestricted | 660 * @unrestricted |
| 661 */ | 661 */ |
| 662 Profiler.HeapSnapshotObjectNode = class extends Profiler.HeapSnapshotGenericObje
ctNode { | 662 Profiler.HeapSnapshotObjectNode = class extends Profiler.HeapSnapshotGenericObje
ctNode { |
| 663 /** | 663 /** |
| 664 * @param {!Profiler.HeapSnapshotSortableDataGrid} dataGrid | 664 * @param {!Profiler.HeapSnapshotSortableDataGrid} dataGrid |
| 665 * @param {!Profiler.HeapSnapshotProxy} snapshot | 665 * @param {!Profiler.HeapSnapshotProxy} snapshot |
| 666 * @param {!Profiler.HeapSnapshotCommon.Edge} edge | 666 * @param {!HeapSnapshotModel.Edge} edge |
| 667 * @param {?Profiler.HeapSnapshotObjectNode} parentObjectNode | 667 * @param {?Profiler.HeapSnapshotObjectNode} parentObjectNode |
| 668 */ | 668 */ |
| 669 constructor(dataGrid, snapshot, edge, parentObjectNode) { | 669 constructor(dataGrid, snapshot, edge, parentObjectNode) { |
| 670 super(dataGrid, edge.node); | 670 super(dataGrid, edge.node); |
| 671 this._referenceName = edge.name; | 671 this._referenceName = edge.name; |
| 672 this._referenceType = edge.type; | 672 this._referenceType = edge.type; |
| 673 this._edgeIndex = edge.edgeIndex; | 673 this._edgeIndex = edge.edgeIndex; |
| 674 this._snapshot = snapshot; | 674 this._snapshot = snapshot; |
| 675 | 675 |
| 676 this._parentObjectNode = parentObjectNode; | 676 this._parentObjectNode = parentObjectNode; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 var ancestor = this._parentObjectNode; | 708 var ancestor = this._parentObjectNode; |
| 709 while (ancestor) { | 709 while (ancestor) { |
| 710 if (ancestor.snapshotNodeId === this.snapshotNodeId) | 710 if (ancestor.snapshotNodeId === this.snapshotNodeId) |
| 711 return ancestor; | 711 return ancestor; |
| 712 ancestor = ancestor._parentObjectNode; | 712 ancestor = ancestor._parentObjectNode; |
| 713 } | 713 } |
| 714 return null; | 714 return null; |
| 715 } | 715 } |
| 716 | 716 |
| 717 /** | 717 /** |
| 718 * @param {!Profiler.HeapSnapshotCommon.Edge} item | 718 * @param {!HeapSnapshotModel.Edge} item |
| 719 * @return {!Profiler.HeapSnapshotObjectNode} | 719 * @return {!Profiler.HeapSnapshotObjectNode} |
| 720 */ | 720 */ |
| 721 _createChildNode(item) { | 721 _createChildNode(item) { |
| 722 return new Profiler.HeapSnapshotObjectNode(this._dataGrid, this._snapshot, i
tem, this); | 722 return new Profiler.HeapSnapshotObjectNode(this._dataGrid, this._snapshot, i
tem, this); |
| 723 } | 723 } |
| 724 | 724 |
| 725 /** | 725 /** |
| 726 * @param {!Profiler.HeapSnapshotCommon.Edge} edge | 726 * @param {!HeapSnapshotModel.Edge} edge |
| 727 * @return {number} | 727 * @return {number} |
| 728 */ | 728 */ |
| 729 _childHashForEntity(edge) { | 729 _childHashForEntity(edge) { |
| 730 return edge.edgeIndex; | 730 return edge.edgeIndex; |
| 731 } | 731 } |
| 732 | 732 |
| 733 /** | 733 /** |
| 734 * @param {!Profiler.HeapSnapshotObjectNode} childNode | 734 * @param {!Profiler.HeapSnapshotObjectNode} childNode |
| 735 * @return {number} | 735 * @return {number} |
| 736 */ | 736 */ |
| 737 _childHashForNode(childNode) { | 737 _childHashForNode(childNode) { |
| 738 return childNode._edgeIndex; | 738 return childNode._edgeIndex; |
| 739 } | 739 } |
| 740 | 740 |
| 741 /** | 741 /** |
| 742 * @return {!Profiler.HeapSnapshotCommon.ComparatorConfig} | 742 * @return {!HeapSnapshotModel.ComparatorConfig} |
| 743 */ | 743 */ |
| 744 comparator() { | 744 comparator() { |
| 745 var sortAscending = this._dataGrid.isSortOrderAscending(); | 745 var sortAscending = this._dataGrid.isSortOrderAscending(); |
| 746 var sortColumnId = this._dataGrid.sortColumnId(); | 746 var sortColumnId = this._dataGrid.sortColumnId(); |
| 747 var sortFields = { | 747 var sortFields = { |
| 748 object: ['!edgeName', sortAscending, 'retainedSize', false], | 748 object: ['!edgeName', sortAscending, 'retainedSize', false], |
| 749 count: ['!edgeName', true, 'retainedSize', false], | 749 count: ['!edgeName', true, 'retainedSize', false], |
| 750 shallowSize: ['selfSize', sortAscending, '!edgeName', true], | 750 shallowSize: ['selfSize', sortAscending, '!edgeName', true], |
| 751 retainedSize: ['retainedSize', sortAscending, '!edgeName', true], | 751 retainedSize: ['retainedSize', sortAscending, '!edgeName', true], |
| 752 distance: ['distance', sortAscending, '_name', true] | 752 distance: ['distance', sortAscending, '_name', true] |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 } | 797 } |
| 798 }; | 798 }; |
| 799 | 799 |
| 800 /** | 800 /** |
| 801 * @unrestricted | 801 * @unrestricted |
| 802 */ | 802 */ |
| 803 Profiler.HeapSnapshotRetainingObjectNode = class extends Profiler.HeapSnapshotOb
jectNode { | 803 Profiler.HeapSnapshotRetainingObjectNode = class extends Profiler.HeapSnapshotOb
jectNode { |
| 804 /** | 804 /** |
| 805 * @param {!Profiler.HeapSnapshotSortableDataGrid} dataGrid | 805 * @param {!Profiler.HeapSnapshotSortableDataGrid} dataGrid |
| 806 * @param {!Profiler.HeapSnapshotProxy} snapshot | 806 * @param {!Profiler.HeapSnapshotProxy} snapshot |
| 807 * @param {!Profiler.HeapSnapshotCommon.Edge} edge | 807 * @param {!HeapSnapshotModel.Edge} edge |
| 808 * @param {?Profiler.HeapSnapshotRetainingObjectNode} parentRetainingObjectNod
e | 808 * @param {?Profiler.HeapSnapshotRetainingObjectNode} parentRetainingObjectNod
e |
| 809 */ | 809 */ |
| 810 constructor(dataGrid, snapshot, edge, parentRetainingObjectNode) { | 810 constructor(dataGrid, snapshot, edge, parentRetainingObjectNode) { |
| 811 super(dataGrid, snapshot, edge, parentRetainingObjectNode); | 811 super(dataGrid, snapshot, edge, parentRetainingObjectNode); |
| 812 } | 812 } |
| 813 | 813 |
| 814 /** | 814 /** |
| 815 * @override | 815 * @override |
| 816 * @return {!Profiler.HeapSnapshotProviderProxy} | 816 * @return {!Profiler.HeapSnapshotProviderProxy} |
| 817 */ | 817 */ |
| 818 createProvider() { | 818 createProvider() { |
| 819 return this._snapshot.createRetainingEdgesProvider(this.snapshotNodeIndex); | 819 return this._snapshot.createRetainingEdgesProvider(this.snapshotNodeIndex); |
| 820 } | 820 } |
| 821 | 821 |
| 822 /** | 822 /** |
| 823 * @override | 823 * @override |
| 824 * @param {!Profiler.HeapSnapshotCommon.Edge} item | 824 * @param {!HeapSnapshotModel.Edge} item |
| 825 * @return {!Profiler.HeapSnapshotRetainingObjectNode} | 825 * @return {!Profiler.HeapSnapshotRetainingObjectNode} |
| 826 */ | 826 */ |
| 827 _createChildNode(item) { | 827 _createChildNode(item) { |
| 828 return new Profiler.HeapSnapshotRetainingObjectNode(this._dataGrid, this._sn
apshot, item, this); | 828 return new Profiler.HeapSnapshotRetainingObjectNode(this._dataGrid, this._sn
apshot, item, this); |
| 829 } | 829 } |
| 830 | 830 |
| 831 /** | 831 /** |
| 832 * @override | 832 * @override |
| 833 * @return {string} | 833 * @return {string} |
| 834 */ | 834 */ |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 } | 872 } |
| 873 }; | 873 }; |
| 874 | 874 |
| 875 /** | 875 /** |
| 876 * @unrestricted | 876 * @unrestricted |
| 877 */ | 877 */ |
| 878 Profiler.HeapSnapshotInstanceNode = class extends Profiler.HeapSnapshotGenericOb
jectNode { | 878 Profiler.HeapSnapshotInstanceNode = class extends Profiler.HeapSnapshotGenericOb
jectNode { |
| 879 /** | 879 /** |
| 880 * @param {!Profiler.HeapSnapshotSortableDataGrid} dataGrid | 880 * @param {!Profiler.HeapSnapshotSortableDataGrid} dataGrid |
| 881 * @param {!Profiler.HeapSnapshotProxy} snapshot | 881 * @param {!Profiler.HeapSnapshotProxy} snapshot |
| 882 * @param {!Profiler.HeapSnapshotCommon.Node} node | 882 * @param {!HeapSnapshotModel.Node} node |
| 883 * @param {boolean} isDeletedNode | 883 * @param {boolean} isDeletedNode |
| 884 */ | 884 */ |
| 885 constructor(dataGrid, snapshot, node, isDeletedNode) { | 885 constructor(dataGrid, snapshot, node, isDeletedNode) { |
| 886 super(dataGrid, node); | 886 super(dataGrid, node); |
| 887 this._baseSnapshotOrSnapshot = snapshot; | 887 this._baseSnapshotOrSnapshot = snapshot; |
| 888 this._isDeletedNode = isDeletedNode; | 888 this._isDeletedNode = isDeletedNode; |
| 889 this.updateHasChildren(); | 889 this.updateHasChildren(); |
| 890 | 890 |
| 891 var data = this.data; | 891 var data = this.data; |
| 892 data['count'] = ''; | 892 data['count'] = ''; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 915 | 915 |
| 916 /** | 916 /** |
| 917 * @override | 917 * @override |
| 918 * @return {!Profiler.HeapSnapshotProviderProxy} | 918 * @return {!Profiler.HeapSnapshotProviderProxy} |
| 919 */ | 919 */ |
| 920 createProvider() { | 920 createProvider() { |
| 921 return this._baseSnapshotOrSnapshot.createEdgesProvider(this.snapshotNodeInd
ex); | 921 return this._baseSnapshotOrSnapshot.createEdgesProvider(this.snapshotNodeInd
ex); |
| 922 } | 922 } |
| 923 | 923 |
| 924 /** | 924 /** |
| 925 * @param {!Profiler.HeapSnapshotCommon.Edge} item | 925 * @param {!HeapSnapshotModel.Edge} item |
| 926 * @return {!Profiler.HeapSnapshotObjectNode} | 926 * @return {!Profiler.HeapSnapshotObjectNode} |
| 927 */ | 927 */ |
| 928 _createChildNode(item) { | 928 _createChildNode(item) { |
| 929 return new Profiler.HeapSnapshotObjectNode(this._dataGrid, this._baseSnapsho
tOrSnapshot, item, null); | 929 return new Profiler.HeapSnapshotObjectNode(this._dataGrid, this._baseSnapsho
tOrSnapshot, item, null); |
| 930 } | 930 } |
| 931 | 931 |
| 932 /** | 932 /** |
| 933 * @param {!Profiler.HeapSnapshotCommon.Edge} edge | 933 * @param {!HeapSnapshotModel.Edge} edge |
| 934 * @return {number} | 934 * @return {number} |
| 935 */ | 935 */ |
| 936 _childHashForEntity(edge) { | 936 _childHashForEntity(edge) { |
| 937 return edge.edgeIndex; | 937 return edge.edgeIndex; |
| 938 } | 938 } |
| 939 | 939 |
| 940 /** | 940 /** |
| 941 * @param {!Profiler.HeapSnapshotObjectNode} childNode | 941 * @param {!Profiler.HeapSnapshotObjectNode} childNode |
| 942 * @return {number} | 942 * @return {number} |
| 943 */ | 943 */ |
| 944 _childHashForNode(childNode) { | 944 _childHashForNode(childNode) { |
| 945 return childNode._edgeIndex; | 945 return childNode._edgeIndex; |
| 946 } | 946 } |
| 947 | 947 |
| 948 /** | 948 /** |
| 949 * @return {!Profiler.HeapSnapshotCommon.ComparatorConfig} | 949 * @return {!HeapSnapshotModel.ComparatorConfig} |
| 950 */ | 950 */ |
| 951 comparator() { | 951 comparator() { |
| 952 var sortAscending = this._dataGrid.isSortOrderAscending(); | 952 var sortAscending = this._dataGrid.isSortOrderAscending(); |
| 953 var sortColumnId = this._dataGrid.sortColumnId(); | 953 var sortColumnId = this._dataGrid.sortColumnId(); |
| 954 var sortFields = { | 954 var sortFields = { |
| 955 object: ['!edgeName', sortAscending, 'retainedSize', false], | 955 object: ['!edgeName', sortAscending, 'retainedSize', false], |
| 956 distance: ['distance', sortAscending, 'retainedSize', false], | 956 distance: ['distance', sortAscending, 'retainedSize', false], |
| 957 count: ['!edgeName', true, 'retainedSize', false], | 957 count: ['!edgeName', true, 'retainedSize', false], |
| 958 addedSize: ['selfSize', sortAscending, '!edgeName', true], | 958 addedSize: ['selfSize', sortAscending, '!edgeName', true], |
| 959 removedSize: ['selfSize', sortAscending, '!edgeName', true], | 959 removedSize: ['selfSize', sortAscending, '!edgeName', true], |
| 960 shallowSize: ['selfSize', sortAscending, '!edgeName', true], | 960 shallowSize: ['selfSize', sortAscending, '!edgeName', true], |
| 961 retainedSize: ['retainedSize', sortAscending, '!edgeName', true] | 961 retainedSize: ['retainedSize', sortAscending, '!edgeName', true] |
| 962 }[sortColumnId] || | 962 }[sortColumnId] || |
| 963 ['!edgeName', true, 'retainedSize', false]; | 963 ['!edgeName', true, 'retainedSize', false]; |
| 964 return Profiler.HeapSnapshotGridNode.createComparator(sortFields); | 964 return Profiler.HeapSnapshotGridNode.createComparator(sortFields); |
| 965 } | 965 } |
| 966 }; | 966 }; |
| 967 | 967 |
| 968 /** | 968 /** |
| 969 * @unrestricted | 969 * @unrestricted |
| 970 */ | 970 */ |
| 971 Profiler.HeapSnapshotConstructorNode = class extends Profiler.HeapSnapshotGridNo
de { | 971 Profiler.HeapSnapshotConstructorNode = class extends Profiler.HeapSnapshotGridNo
de { |
| 972 /** | 972 /** |
| 973 * @param {!Profiler.HeapSnapshotConstructorsDataGrid} dataGrid | 973 * @param {!Profiler.HeapSnapshotConstructorsDataGrid} dataGrid |
| 974 * @param {string} className | 974 * @param {string} className |
| 975 * @param {!Profiler.HeapSnapshotCommon.Aggregate} aggregate | 975 * @param {!HeapSnapshotModel.Aggregate} aggregate |
| 976 * @param {!Profiler.HeapSnapshotCommon.NodeFilter} nodeFilter | 976 * @param {!HeapSnapshotModel.NodeFilter} nodeFilter |
| 977 */ | 977 */ |
| 978 constructor(dataGrid, className, aggregate, nodeFilter) { | 978 constructor(dataGrid, className, aggregate, nodeFilter) { |
| 979 super(dataGrid, aggregate.count > 0); | 979 super(dataGrid, aggregate.count > 0); |
| 980 this._name = className; | 980 this._name = className; |
| 981 this._nodeFilter = nodeFilter; | 981 this._nodeFilter = nodeFilter; |
| 982 this._distance = aggregate.distance; | 982 this._distance = aggregate.distance; |
| 983 this._count = aggregate.count; | 983 this._count = aggregate.count; |
| 984 this._shallowSize = aggregate.self; | 984 this._shallowSize = aggregate.self; |
| 985 this._retainedSize = aggregate.maxRet; | 985 this._retainedSize = aggregate.maxRet; |
| 986 | 986 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 * @return {!Element} | 1070 * @return {!Element} |
| 1071 */ | 1071 */ |
| 1072 createCell(columnId) { | 1072 createCell(columnId) { |
| 1073 var cell = columnId !== 'object' ? this._createValueCell(columnId) : super.c
reateCell(columnId); | 1073 var cell = columnId !== 'object' ? this._createValueCell(columnId) : super.c
reateCell(columnId); |
| 1074 if (this._searchMatched) | 1074 if (this._searchMatched) |
| 1075 cell.classList.add('highlight'); | 1075 cell.classList.add('highlight'); |
| 1076 return cell; | 1076 return cell; |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 /** | 1079 /** |
| 1080 * @param {!Profiler.HeapSnapshotCommon.Node} item | 1080 * @param {!HeapSnapshotModel.Node} item |
| 1081 * @return {!Profiler.HeapSnapshotInstanceNode} | 1081 * @return {!Profiler.HeapSnapshotInstanceNode} |
| 1082 */ | 1082 */ |
| 1083 _createChildNode(item) { | 1083 _createChildNode(item) { |
| 1084 return new Profiler.HeapSnapshotInstanceNode(this._dataGrid, this._dataGrid.
snapshot, item, false); | 1084 return new Profiler.HeapSnapshotInstanceNode(this._dataGrid, this._dataGrid.
snapshot, item, false); |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 /** | 1087 /** |
| 1088 * @return {!Profiler.HeapSnapshotCommon.ComparatorConfig} | 1088 * @return {!HeapSnapshotModel.ComparatorConfig} |
| 1089 */ | 1089 */ |
| 1090 comparator() { | 1090 comparator() { |
| 1091 var sortAscending = this._dataGrid.isSortOrderAscending(); | 1091 var sortAscending = this._dataGrid.isSortOrderAscending(); |
| 1092 var sortColumnId = this._dataGrid.sortColumnId(); | 1092 var sortColumnId = this._dataGrid.sortColumnId(); |
| 1093 var sortFields = { | 1093 var sortFields = { |
| 1094 object: ['name', sortAscending, 'id', true], | 1094 object: ['name', sortAscending, 'id', true], |
| 1095 distance: ['distance', sortAscending, 'retainedSize', false], | 1095 distance: ['distance', sortAscending, 'retainedSize', false], |
| 1096 count: ['name', true, 'id', true], | 1096 count: ['name', true, 'id', true], |
| 1097 shallowSize: ['selfSize', sortAscending, 'id', true], | 1097 shallowSize: ['selfSize', sortAscending, 'id', true], |
| 1098 retainedSize: ['retainedSize', sortAscending, 'id', true] | 1098 retainedSize: ['retainedSize', sortAscending, 'id', true] |
| 1099 }[sortColumnId]; | 1099 }[sortColumnId]; |
| 1100 return Profiler.HeapSnapshotGridNode.createComparator(sortFields); | 1100 return Profiler.HeapSnapshotGridNode.createComparator(sortFields); |
| 1101 } | 1101 } |
| 1102 | 1102 |
| 1103 /** | 1103 /** |
| 1104 * @param {!Profiler.HeapSnapshotCommon.Node} node | 1104 * @param {!HeapSnapshotModel.Node} node |
| 1105 * @return {number} | 1105 * @return {number} |
| 1106 */ | 1106 */ |
| 1107 _childHashForEntity(node) { | 1107 _childHashForEntity(node) { |
| 1108 return node.id; | 1108 return node.id; |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 /** | 1111 /** |
| 1112 * @param {!Profiler.HeapSnapshotInstanceNode} childNode | 1112 * @param {!Profiler.HeapSnapshotInstanceNode} childNode |
| 1113 * @return {number} | 1113 * @return {number} |
| 1114 */ | 1114 */ |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 * @param {function(boolean)} callback | 1157 * @param {function(boolean)} callback |
| 1158 */ | 1158 */ |
| 1159 isEmpty(callback) { | 1159 isEmpty(callback) { |
| 1160 callback(false); | 1160 callback(false); |
| 1161 } | 1161 } |
| 1162 | 1162 |
| 1163 /** | 1163 /** |
| 1164 * @override | 1164 * @override |
| 1165 * @param {number} beginPosition | 1165 * @param {number} beginPosition |
| 1166 * @param {number} endPosition | 1166 * @param {number} endPosition |
| 1167 * @param {function(!Profiler.HeapSnapshotCommon.ItemsRange)} callback | 1167 * @param {function(!HeapSnapshotModel.ItemsRange)} callback |
| 1168 */ | 1168 */ |
| 1169 serializeItemsRange(beginPosition, endPosition, callback) { | 1169 serializeItemsRange(beginPosition, endPosition, callback) { |
| 1170 /** | 1170 /** |
| 1171 * @param {!Profiler.HeapSnapshotCommon.ItemsRange} items | 1171 * @param {!HeapSnapshotModel.ItemsRange} items |
| 1172 * @this {Profiler.HeapSnapshotDiffNodesProvider} | 1172 * @this {Profiler.HeapSnapshotDiffNodesProvider} |
| 1173 */ | 1173 */ |
| 1174 function didReceiveAllItems(items) { | 1174 function didReceiveAllItems(items) { |
| 1175 items.totalLength = this._addedCount + this._removedCount; | 1175 items.totalLength = this._addedCount + this._removedCount; |
| 1176 callback(items); | 1176 callback(items); |
| 1177 } | 1177 } |
| 1178 | 1178 |
| 1179 /** | 1179 /** |
| 1180 * @param {!Profiler.HeapSnapshotCommon.ItemsRange} addedItems | 1180 * @param {!HeapSnapshotModel.ItemsRange} addedItems |
| 1181 * @param {!Profiler.HeapSnapshotCommon.ItemsRange} itemsRange | 1181 * @param {!HeapSnapshotModel.ItemsRange} itemsRange |
| 1182 * @this {Profiler.HeapSnapshotDiffNodesProvider} | 1182 * @this {Profiler.HeapSnapshotDiffNodesProvider} |
| 1183 */ | 1183 */ |
| 1184 function didReceiveDeletedItems(addedItems, itemsRange) { | 1184 function didReceiveDeletedItems(addedItems, itemsRange) { |
| 1185 var items = itemsRange.items; | 1185 var items = itemsRange.items; |
| 1186 if (!addedItems.items.length) | 1186 if (!addedItems.items.length) |
| 1187 addedItems.startPosition = this._addedCount + itemsRange.startPosition; | 1187 addedItems.startPosition = this._addedCount + itemsRange.startPosition; |
| 1188 for (var i = 0; i < items.length; i++) { | 1188 for (var i = 0; i < items.length; i++) { |
| 1189 items[i].isAddedNotRemoved = false; | 1189 items[i].isAddedNotRemoved = false; |
| 1190 addedItems.items.push(items[i]); | 1190 addedItems.items.push(items[i]); |
| 1191 } | 1191 } |
| 1192 addedItems.endPosition = this._addedCount + itemsRange.endPosition; | 1192 addedItems.endPosition = this._addedCount + itemsRange.endPosition; |
| 1193 didReceiveAllItems.call(this, addedItems); | 1193 didReceiveAllItems.call(this, addedItems); |
| 1194 } | 1194 } |
| 1195 | 1195 |
| 1196 /** | 1196 /** |
| 1197 * @param {!Profiler.HeapSnapshotCommon.ItemsRange} itemsRange | 1197 * @param {!HeapSnapshotModel.ItemsRange} itemsRange |
| 1198 * @this {Profiler.HeapSnapshotDiffNodesProvider} | 1198 * @this {Profiler.HeapSnapshotDiffNodesProvider} |
| 1199 */ | 1199 */ |
| 1200 function didReceiveAddedItems(itemsRange) { | 1200 function didReceiveAddedItems(itemsRange) { |
| 1201 var items = itemsRange.items; | 1201 var items = itemsRange.items; |
| 1202 for (var i = 0; i < items.length; i++) | 1202 for (var i = 0; i < items.length; i++) |
| 1203 items[i].isAddedNotRemoved = true; | 1203 items[i].isAddedNotRemoved = true; |
| 1204 if (itemsRange.endPosition < endPosition) { | 1204 if (itemsRange.endPosition < endPosition) { |
| 1205 return this._deletedNodesProvider.serializeItemsRange( | 1205 return this._deletedNodesProvider.serializeItemsRange( |
| 1206 0, endPosition - itemsRange.endPosition, didReceiveDeletedItems.bind
(this, itemsRange)); | 1206 0, endPosition - itemsRange.endPosition, didReceiveDeletedItems.bind
(this, itemsRange)); |
| 1207 } | 1207 } |
| 1208 | 1208 |
| 1209 itemsRange.totalLength = this._addedCount + this._removedCount; | 1209 itemsRange.totalLength = this._addedCount + this._removedCount; |
| 1210 didReceiveAllItems.call(this, itemsRange); | 1210 didReceiveAllItems.call(this, itemsRange); |
| 1211 } | 1211 } |
| 1212 | 1212 |
| 1213 if (beginPosition < this._addedCount) { | 1213 if (beginPosition < this._addedCount) { |
| 1214 this._addedNodesProvider.serializeItemsRange(beginPosition, endPosition, d
idReceiveAddedItems.bind(this)); | 1214 this._addedNodesProvider.serializeItemsRange(beginPosition, endPosition, d
idReceiveAddedItems.bind(this)); |
| 1215 } else { | 1215 } else { |
| 1216 var emptyRange = new Profiler.HeapSnapshotCommon.ItemsRange(0, 0, 0, []); | 1216 var emptyRange = new HeapSnapshotModel.ItemsRange(0, 0, 0, []); |
| 1217 this._deletedNodesProvider.serializeItemsRange( | 1217 this._deletedNodesProvider.serializeItemsRange( |
| 1218 beginPosition - this._addedCount, endPosition - this._addedCount, | 1218 beginPosition - this._addedCount, endPosition - this._addedCount, |
| 1219 didReceiveDeletedItems.bind(this, emptyRange)); | 1219 didReceiveDeletedItems.bind(this, emptyRange)); |
| 1220 } | 1220 } |
| 1221 } | 1221 } |
| 1222 | 1222 |
| 1223 /** | 1223 /** |
| 1224 * @override | 1224 * @override |
| 1225 * @param {!Profiler.HeapSnapshotCommon.ComparatorConfig} comparator | 1225 * @param {!HeapSnapshotModel.ComparatorConfig} comparator |
| 1226 * @return {!Promise<?>} | 1226 * @return {!Promise<?>} |
| 1227 */ | 1227 */ |
| 1228 sortAndRewind(comparator) { | 1228 sortAndRewind(comparator) { |
| 1229 /** | 1229 /** |
| 1230 * @this {Profiler.HeapSnapshotDiffNodesProvider} | 1230 * @this {Profiler.HeapSnapshotDiffNodesProvider} |
| 1231 * @return {!Promise<?>} | 1231 * @return {!Promise<?>} |
| 1232 */ | 1232 */ |
| 1233 function afterSort() { | 1233 function afterSort() { |
| 1234 return this._deletedNodesProvider.sortAndRewind(comparator); | 1234 return this._deletedNodesProvider.sortAndRewind(comparator); |
| 1235 } | 1235 } |
| 1236 return this._addedNodesProvider.sortAndRewind(comparator).then(afterSort.bin
d(this)); | 1236 return this._addedNodesProvider.sortAndRewind(comparator).then(afterSort.bin
d(this)); |
| 1237 } | 1237 } |
| 1238 }; | 1238 }; |
| 1239 | 1239 |
| 1240 /** | 1240 /** |
| 1241 * @unrestricted | 1241 * @unrestricted |
| 1242 */ | 1242 */ |
| 1243 Profiler.HeapSnapshotDiffNode = class extends Profiler.HeapSnapshotGridNode { | 1243 Profiler.HeapSnapshotDiffNode = class extends Profiler.HeapSnapshotGridNode { |
| 1244 /** | 1244 /** |
| 1245 * @param {!Profiler.HeapSnapshotDiffDataGrid} dataGrid | 1245 * @param {!Profiler.HeapSnapshotDiffDataGrid} dataGrid |
| 1246 * @param {string} className | 1246 * @param {string} className |
| 1247 * @param {!Profiler.HeapSnapshotCommon.DiffForClass} diffForClass | 1247 * @param {!HeapSnapshotModel.DiffForClass} diffForClass |
| 1248 */ | 1248 */ |
| 1249 constructor(dataGrid, className, diffForClass) { | 1249 constructor(dataGrid, className, diffForClass) { |
| 1250 super(dataGrid, true); | 1250 super(dataGrid, true); |
| 1251 this._name = className; | 1251 this._name = className; |
| 1252 this._addedCount = diffForClass.addedCount; | 1252 this._addedCount = diffForClass.addedCount; |
| 1253 this._removedCount = diffForClass.removedCount; | 1253 this._removedCount = diffForClass.removedCount; |
| 1254 this._countDelta = diffForClass.countDelta; | 1254 this._countDelta = diffForClass.countDelta; |
| 1255 this._addedSize = diffForClass.addedSize; | 1255 this._addedSize = diffForClass.addedSize; |
| 1256 this._removedSize = diffForClass.removedSize; | 1256 this._removedSize = diffForClass.removedSize; |
| 1257 this._sizeDelta = diffForClass.sizeDelta; | 1257 this._sizeDelta = diffForClass.sizeDelta; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1284 * @return {!Element} | 1284 * @return {!Element} |
| 1285 */ | 1285 */ |
| 1286 createCell(columnId) { | 1286 createCell(columnId) { |
| 1287 var cell = super.createCell(columnId); | 1287 var cell = super.createCell(columnId); |
| 1288 if (columnId !== 'object') | 1288 if (columnId !== 'object') |
| 1289 cell.classList.add('numeric-column'); | 1289 cell.classList.add('numeric-column'); |
| 1290 return cell; | 1290 return cell; |
| 1291 } | 1291 } |
| 1292 | 1292 |
| 1293 /** | 1293 /** |
| 1294 * @param {!Profiler.HeapSnapshotCommon.Node} item | 1294 * @param {!HeapSnapshotModel.Node} item |
| 1295 * @return {!Profiler.HeapSnapshotInstanceNode} | 1295 * @return {!Profiler.HeapSnapshotInstanceNode} |
| 1296 */ | 1296 */ |
| 1297 _createChildNode(item) { | 1297 _createChildNode(item) { |
| 1298 if (item.isAddedNotRemoved) | 1298 if (item.isAddedNotRemoved) |
| 1299 return new Profiler.HeapSnapshotInstanceNode(this._dataGrid, this._dataGri
d.snapshot, item, false); | 1299 return new Profiler.HeapSnapshotInstanceNode(this._dataGrid, this._dataGri
d.snapshot, item, false); |
| 1300 else | 1300 else |
| 1301 return new Profiler.HeapSnapshotInstanceNode(this._dataGrid, this._dataGri
d.baseSnapshot, item, true); | 1301 return new Profiler.HeapSnapshotInstanceNode(this._dataGrid, this._dataGri
d.baseSnapshot, item, true); |
| 1302 } | 1302 } |
| 1303 | 1303 |
| 1304 /** | 1304 /** |
| 1305 * @param {!Profiler.HeapSnapshotCommon.Node} node | 1305 * @param {!HeapSnapshotModel.Node} node |
| 1306 * @return {number} | 1306 * @return {number} |
| 1307 */ | 1307 */ |
| 1308 _childHashForEntity(node) { | 1308 _childHashForEntity(node) { |
| 1309 return node.id; | 1309 return node.id; |
| 1310 } | 1310 } |
| 1311 | 1311 |
| 1312 /** | 1312 /** |
| 1313 * @param {!Profiler.HeapSnapshotInstanceNode} childNode | 1313 * @param {!Profiler.HeapSnapshotInstanceNode} childNode |
| 1314 * @return {number} | 1314 * @return {number} |
| 1315 */ | 1315 */ |
| 1316 _childHashForNode(childNode) { | 1316 _childHashForNode(childNode) { |
| 1317 return childNode.snapshotNodeId; | 1317 return childNode.snapshotNodeId; |
| 1318 } | 1318 } |
| 1319 | 1319 |
| 1320 /** | 1320 /** |
| 1321 * @return {!Profiler.HeapSnapshotCommon.ComparatorConfig} | 1321 * @return {!HeapSnapshotModel.ComparatorConfig} |
| 1322 */ | 1322 */ |
| 1323 comparator() { | 1323 comparator() { |
| 1324 var sortAscending = this._dataGrid.isSortOrderAscending(); | 1324 var sortAscending = this._dataGrid.isSortOrderAscending(); |
| 1325 var sortColumnId = this._dataGrid.sortColumnId(); | 1325 var sortColumnId = this._dataGrid.sortColumnId(); |
| 1326 var sortFields = { | 1326 var sortFields = { |
| 1327 object: ['name', sortAscending, 'id', true], | 1327 object: ['name', sortAscending, 'id', true], |
| 1328 addedCount: ['name', true, 'id', true], | 1328 addedCount: ['name', true, 'id', true], |
| 1329 removedCount: ['name', true, 'id', true], | 1329 removedCount: ['name', true, 'id', true], |
| 1330 countDelta: ['name', true, 'id', true], | 1330 countDelta: ['name', true, 'id', true], |
| 1331 addedSize: ['selfSize', sortAscending, 'id', true], | 1331 addedSize: ['selfSize', sortAscending, 'id', true], |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1352 return '\u2212'; // Math minus sign, same width as plus. | 1352 return '\u2212'; // Math minus sign, same width as plus. |
| 1353 } | 1353 } |
| 1354 }; | 1354 }; |
| 1355 | 1355 |
| 1356 /** | 1356 /** |
| 1357 * @unrestricted | 1357 * @unrestricted |
| 1358 */ | 1358 */ |
| 1359 Profiler.AllocationGridNode = class extends Profiler.HeapSnapshotGridNode { | 1359 Profiler.AllocationGridNode = class extends Profiler.HeapSnapshotGridNode { |
| 1360 /** | 1360 /** |
| 1361 * @param {!Profiler.AllocationDataGrid} dataGrid | 1361 * @param {!Profiler.AllocationDataGrid} dataGrid |
| 1362 * @param {!Profiler.HeapSnapshotCommon.SerializedAllocationNode} data | 1362 * @param {!HeapSnapshotModel.SerializedAllocationNode} data |
| 1363 */ | 1363 */ |
| 1364 constructor(dataGrid, data) { | 1364 constructor(dataGrid, data) { |
| 1365 super(dataGrid, data.hasChildren); | 1365 super(dataGrid, data.hasChildren); |
| 1366 this._populated = false; | 1366 this._populated = false; |
| 1367 this._allocationNode = data; | 1367 this._allocationNode = data; |
| 1368 this.data = { | 1368 this.data = { |
| 1369 'liveCount': Number.withThousandsSeparator(data.liveCount), | 1369 'liveCount': Number.withThousandsSeparator(data.liveCount), |
| 1370 'count': Number.withThousandsSeparator(data.count), | 1370 'count': Number.withThousandsSeparator(data.count), |
| 1371 'liveSize': Number.withThousandsSeparator(data.liveSize), | 1371 'liveSize': Number.withThousandsSeparator(data.liveSize), |
| 1372 'size': Number.withThousandsSeparator(data.size), | 1372 'size': Number.withThousandsSeparator(data.size), |
| 1373 'name': data.name | 1373 'name': data.name |
| 1374 }; | 1374 }; |
| 1375 } | 1375 } |
| 1376 | 1376 |
| 1377 /** | 1377 /** |
| 1378 * @override | 1378 * @override |
| 1379 */ | 1379 */ |
| 1380 populate() { | 1380 populate() { |
| 1381 if (this._populated) | 1381 if (this._populated) |
| 1382 return; | 1382 return; |
| 1383 this._populated = true; | 1383 this._populated = true; |
| 1384 this._dataGrid.snapshot.allocationNodeCallers(this._allocationNode.id, didRe
ceiveCallers.bind(this)); | 1384 this._dataGrid.snapshot.allocationNodeCallers(this._allocationNode.id, didRe
ceiveCallers.bind(this)); |
| 1385 | 1385 |
| 1386 /** | 1386 /** |
| 1387 * @param {!Profiler.HeapSnapshotCommon.AllocationNodeCallers} callers | 1387 * @param {!HeapSnapshotModel.AllocationNodeCallers} callers |
| 1388 * @this {Profiler.AllocationGridNode} | 1388 * @this {Profiler.AllocationGridNode} |
| 1389 */ | 1389 */ |
| 1390 function didReceiveCallers(callers) { | 1390 function didReceiveCallers(callers) { |
| 1391 var callersChain = callers.nodesWithSingleCaller; | 1391 var callersChain = callers.nodesWithSingleCaller; |
| 1392 var parentNode = this; | 1392 var parentNode = this; |
| 1393 var dataGrid = /** @type {!Profiler.AllocationDataGrid} */ (this._dataGrid
); | 1393 var dataGrid = /** @type {!Profiler.AllocationDataGrid} */ (this._dataGrid
); |
| 1394 for (var i = 0; i < callersChain.length; i++) { | 1394 for (var i = 0; i < callersChain.length; i++) { |
| 1395 var child = new Profiler.AllocationGridNode(dataGrid, callersChain[i]); | 1395 var child = new Profiler.AllocationGridNode(dataGrid, callersChain[i]); |
| 1396 dataGrid.appendNode(parentNode, child); | 1396 dataGrid.appendNode(parentNode, child); |
| 1397 parentNode = child; | 1397 parentNode = child; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1440 return cell; | 1440 return cell; |
| 1441 } | 1441 } |
| 1442 | 1442 |
| 1443 /** | 1443 /** |
| 1444 * @return {number} | 1444 * @return {number} |
| 1445 */ | 1445 */ |
| 1446 allocationNodeId() { | 1446 allocationNodeId() { |
| 1447 return this._allocationNode.id; | 1447 return this._allocationNode.id; |
| 1448 } | 1448 } |
| 1449 }; | 1449 }; |
| OLD | NEW |