OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 callback(); | 594 callback(); |
595 } | 595 } |
596 }, | 596 }, |
597 | 597 |
598 _sortData: function() | 598 _sortData: function() |
599 { | 599 { |
600 var sortAscending = this.dataGrid.sortOrder === "ascending"; | 600 var sortAscending = this.dataGrid.sortOrder === "ascending"; |
601 var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier; | 601 var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier; |
602 var sortProperty = { | 602 var sortProperty = { |
603 cons: ["constructorName", null], | 603 cons: ["constructorName", null], |
604 count: ["count", null], | 604 count: ["count", "constructorName"], |
605 size: ["size", "count"], | 605 size: ["size", "constructorName"], |
606 countDelta: this.showCountDeltaAsPercent ? ["countDeltaPercent", nul
l] : ["countDelta", null], | 606 countDelta: [this.showCountDeltaAsPercent ? "countDeltaPercent" : "c
ountDelta", "constructorName"], |
607 sizeDelta: this.showSizeDeltaAsPercent ? ["sizeDeltaPercent", "count
DeltaPercent"] : ["sizeDelta", "sizeDeltaPercent"] | 607 sizeDelta: [this.showSizeDeltaAsPercent ? "sizeDeltaPercent" : "size
Delta", "constructorName"] |
608 }[sortColumnIdentifier]; | 608 }[sortColumnIdentifier]; |
609 | 609 |
610 this.snapshotDataGridList.sort(WebInspector.HeapSnapshotDataGridList.pro
pertyComparator(sortProperty[0], sortProperty[1], sortAscending)); | 610 this.snapshotDataGridList.sort(WebInspector.HeapSnapshotDataGridList.pro
pertyComparator(sortProperty[0], sortProperty[1], sortAscending)); |
611 | 611 |
612 this.refresh(); | 612 this.refresh(); |
613 }, | 613 }, |
614 | 614 |
615 _updateBaseOptions: function() | 615 _updateBaseOptions: function() |
616 { | 616 { |
617 var list = this._getProfiles(); | 617 var list = this._getProfiles(); |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 | 1039 |
1040 WebInspector.HeapSnapshotDataGridList.propertyComparators = [{}, {}]; | 1040 WebInspector.HeapSnapshotDataGridList.propertyComparators = [{}, {}]; |
1041 | 1041 |
1042 WebInspector.HeapSnapshotDataGridList.propertyComparator = function(property, pr
operty2, isAscending) | 1042 WebInspector.HeapSnapshotDataGridList.propertyComparator = function(property, pr
operty2, isAscending) |
1043 { | 1043 { |
1044 var propertyHash = property + "#" + property2; | 1044 var propertyHash = property + "#" + property2; |
1045 var comparator = this.propertyComparators[(isAscending ? 1 : 0)][propertyHas
h]; | 1045 var comparator = this.propertyComparators[(isAscending ? 1 : 0)][propertyHas
h]; |
1046 if (!comparator) { | 1046 if (!comparator) { |
1047 comparator = function(lhs, rhs) { | 1047 comparator = function(lhs, rhs) { |
1048 var l = lhs[property], r = rhs[property]; | 1048 var l = lhs[property], r = rhs[property]; |
1049 if ((l === null || r === null) && property2 !== null) | 1049 var result = 0; |
1050 l = lhs[property2], r = rhs[property2]; | 1050 if (l !== null && r !== null) { |
1051 var result = l < r ? -1 : (l > r ? 1 : 0); | 1051 result = l < r ? -1 : (l > r ? 1 : 0); |
1052 return isAscending ? result : -result; | 1052 } |
| 1053 if (result !== 0 || property2 === null) { |
| 1054 return isAscending ? result : -result; |
| 1055 } else { |
| 1056 l = lhs[property2]; |
| 1057 r = rhs[property2]; |
| 1058 return l < r ? -1 : (l > r ? 1 : 0); |
| 1059 } |
1053 }; | 1060 }; |
1054 this.propertyComparators[(isAscending ? 1 : 0)][propertyHash] = comparat
or; | 1061 this.propertyComparators[(isAscending ? 1 : 0)][propertyHash] = comparat
or; |
1055 } | 1062 } |
1056 return comparator; | 1063 return comparator; |
1057 }; | 1064 }; |
1058 | 1065 |
1059 WebInspector.HeapSnapshotDataGridRetainerNode = function(snapshotView, baseEntry
, snapshotEntry, owningTree) | 1066 WebInspector.HeapSnapshotDataGridRetainerNode = function(snapshotView, baseEntry
, snapshotEntry, owningTree) |
1060 { | 1067 { |
1061 this.snapshotView = snapshotView; | 1068 this.snapshotView = snapshotView; |
1062 | 1069 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 return new WebInspector.ProfileSidebarTreeElement(profile, WebInspector.
UIString("Snapshot %d"), "heap-snapshot-sidebar-tree-item"); | 1168 return new WebInspector.ProfileSidebarTreeElement(profile, WebInspector.
UIString("Snapshot %d"), "heap-snapshot-sidebar-tree-item"); |
1162 }, | 1169 }, |
1163 | 1170 |
1164 createView: function(profile) | 1171 createView: function(profile) |
1165 { | 1172 { |
1166 return new WebInspector.HeapSnapshotView(WebInspector.panels.profiles, p
rofile); | 1173 return new WebInspector.HeapSnapshotView(WebInspector.panels.profiles, p
rofile); |
1167 } | 1174 } |
1168 } | 1175 } |
1169 | 1176 |
1170 WebInspector.HeapSnapshotProfileType.prototype.__proto__ = WebInspector.ProfileT
ype.prototype; | 1177 WebInspector.HeapSnapshotProfileType.prototype.__proto__ = WebInspector.ProfileT
ype.prototype; |
OLD | NEW |