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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 var node = this.node(); | 122 var node = this.node(); |
123 return new WebInspector.HeapSnapshotEdge.Serialized(this.name(), node.se
rialize(), this.nodeIndex(), this.type(), node.distance()); | 123 return new WebInspector.HeapSnapshotEdge.Serialized(this.name(), node.se
rialize(), this.nodeIndex(), this.type(), node.distance()); |
124 }, | 124 }, |
125 | 125 |
126 _type: function() | 126 _type: function() |
127 { | 127 { |
128 return this._edges[this.edgeIndex + this._snapshot._edgeTypeOffset]; | 128 return this._edges[this.edgeIndex + this._snapshot._edgeTypeOffset]; |
129 } | 129 } |
130 }; | 130 }; |
131 | 131 |
| 132 |
| 133 |
| 134 /** |
| 135 * @interface |
| 136 */ |
| 137 WebInspector.HeapSnapshotItemIterator = function() { } |
| 138 |
| 139 WebInspector.HeapSnapshotItemIterator.prototype = { |
| 140 rewind: function() { }, |
| 141 |
| 142 /** |
| 143 * @return {boolean} |
| 144 */ |
| 145 hasNext: function() { }, |
| 146 |
| 147 /** |
| 148 * @return {number} |
| 149 */ |
| 150 index: function() { }, |
| 151 |
| 152 /** |
| 153 * @param {number} newIndex |
| 154 */ |
| 155 setIndex: function(newIndex) { }, |
| 156 |
| 157 /** |
| 158 * @return {!WebInspector.HeapSnapshotEdge|!WebInspector.HeapSnapshotNode|!W
ebInspector.HeapSnapshotRetainerEdge} |
| 159 */ |
| 160 item: function() { }, |
| 161 |
| 162 next: function() { } |
| 163 }; |
| 164 |
| 165 |
| 166 |
132 /** | 167 /** |
133 * @constructor | 168 * @constructor |
| 169 * @implements {WebInspector.HeapSnapshotItemIterator} |
| 170 * @param {!WebInspector.HeapSnapshotEdge} edge |
134 */ | 171 */ |
135 WebInspector.HeapSnapshotEdgeIterator = function(edge) | 172 WebInspector.HeapSnapshotEdgeIterator = function(edge) |
136 { | 173 { |
137 this.edge = edge; | 174 this.edge = edge; |
138 } | 175 } |
139 | 176 |
140 WebInspector.HeapSnapshotEdgeIterator.prototype = { | 177 WebInspector.HeapSnapshotEdgeIterator.prototype = { |
141 rewind: function() | 178 rewind: function() |
142 { | 179 { |
143 this.edge.edgeIndex = 0; | 180 this.edge.edgeIndex = 0; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 * @return {string} | 358 * @return {string} |
322 */ | 359 */ |
323 type: function() | 360 type: function() |
324 { | 361 { |
325 return this._edge().type(); | 362 return this._edge().type(); |
326 } | 363 } |
327 } | 364 } |
328 | 365 |
329 /** | 366 /** |
330 * @constructor | 367 * @constructor |
| 368 * @implements {WebInspector.HeapSnapshotItemIterator} |
| 369 * @param {!WebInspector.HeapSnapshotRetainerEdge} retainer |
331 */ | 370 */ |
332 WebInspector.HeapSnapshotRetainerEdgeIterator = function(retainer) | 371 WebInspector.HeapSnapshotRetainerEdgeIterator = function(retainer) |
333 { | 372 { |
334 this.retainer = retainer; | 373 this.retainer = retainer; |
335 } | 374 } |
336 | 375 |
337 WebInspector.HeapSnapshotRetainerEdgeIterator.prototype = { | 376 WebInspector.HeapSnapshotRetainerEdgeIterator.prototype = { |
338 rewind: function() | 377 rewind: function() |
339 { | 378 { |
340 this.retainer.setRetainerIndex(0); | 379 this.retainer.setRetainerIndex(0); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 */ | 633 */ |
595 _type: function() | 634 _type: function() |
596 { | 635 { |
597 var snapshot = this._snapshot; | 636 var snapshot = this._snapshot; |
598 return snapshot._nodes[this.nodeIndex + snapshot._nodeTypeOffset]; | 637 return snapshot._nodes[this.nodeIndex + snapshot._nodeTypeOffset]; |
599 } | 638 } |
600 }; | 639 }; |
601 | 640 |
602 /** | 641 /** |
603 * @constructor | 642 * @constructor |
| 643 * @implements {WebInspector.HeapSnapshotItemIterator} |
| 644 * @param {!WebInspector.HeapSnapshotNode} node |
604 */ | 645 */ |
605 WebInspector.HeapSnapshotNodeIterator = function(node) | 646 WebInspector.HeapSnapshotNodeIterator = function(node) |
606 { | 647 { |
607 this.node = node; | 648 this.node = node; |
608 this._nodesLength = node._snapshot._nodes.length; | 649 this._nodesLength = node._snapshot._nodes.length; |
609 } | 650 } |
610 | 651 |
611 WebInspector.HeapSnapshotNodeIterator.prototype = { | 652 WebInspector.HeapSnapshotNodeIterator.prototype = { |
612 rewind: function() | 653 rewind: function() |
613 { | 654 { |
614 this.node.nodeIndex = this.node._firstNodeIndex; | 655 this.node.nodeIndex = this.node._firstNodeIndex; |
615 }, | 656 }, |
616 | 657 |
617 /** | 658 /** |
618 * @return {boolean} | 659 * @return {boolean} |
619 */ | 660 */ |
620 hasNext: function() | 661 hasNext: function() |
621 { | 662 { |
622 return this.node.nodeIndex < this._nodesLength; | 663 return this.node.nodeIndex < this._nodesLength; |
623 }, | 664 }, |
624 | 665 |
625 /** | 666 /** |
626 * @return {number} | 667 * @return {number} |
627 */ | 668 */ |
628 index: function() | 669 index: function() |
629 { | 670 { |
630 return this.node.nodeIndex; | 671 return /** @type{number} */ (this.node.nodeIndex); |
631 }, | 672 }, |
632 | 673 |
633 /** | 674 /** |
634 * @param {number} newIndex | 675 * @param {number} newIndex |
635 */ | 676 */ |
636 setIndex: function(newIndex) | 677 setIndex: function(newIndex) |
637 { | 678 { |
638 this.node.nodeIndex = newIndex; | 679 this.node.nodeIndex = newIndex; |
639 }, | 680 }, |
640 | 681 |
641 /** | 682 /** |
642 * @return {!WebInspector.HeapSnapshotNode} | 683 * @return {!WebInspector.HeapSnapshotNode} |
643 */ | 684 */ |
644 item: function() | 685 item: function() |
645 { | 686 { |
646 return this.node; | 687 return this.node; |
647 }, | 688 }, |
648 | 689 |
649 next: function() | 690 next: function() |
650 { | 691 { |
651 this.node.nodeIndex = this.node._nextNodeIndex(); | 692 this.node.nodeIndex = this.node._nextNodeIndex(); |
652 } | 693 } |
653 } | 694 } |
654 | 695 |
655 | 696 |
656 /** | 697 /** |
| 698 * @constructor |
| 699 * @implements {WebInspector.HeapSnapshotItemIterator} |
| 700 * @param {!WebInspector.HeapSnapshotItemIterator} iterator |
| 701 * @param {!Array.<number>|!Uint32Array} indexes |
| 702 */ |
| 703 WebInspector.HeapSnapshotIndexRangeIterator = function(iterator, indexes) |
| 704 { |
| 705 this._iterator = iterator; |
| 706 this._indexes = indexes; |
| 707 this._position = 0; |
| 708 this._forcedIndex = -1; |
| 709 } |
| 710 |
| 711 WebInspector.HeapSnapshotIndexRangeIterator.prototype = { |
| 712 rewind: function() { }, |
| 713 |
| 714 /** |
| 715 * @return {boolean} |
| 716 */ |
| 717 hasNext: function() |
| 718 { |
| 719 return this._position < this._indexes.length |
| 720 }, |
| 721 |
| 722 /** |
| 723 * @return {number} |
| 724 */ |
| 725 index: function() |
| 726 { |
| 727 if (this._forcedIndex !== -1) |
| 728 return this._forcedIndex; |
| 729 return this._indexes[this._position]; |
| 730 }, |
| 731 |
| 732 /** |
| 733 * @param {number} newIndex |
| 734 */ |
| 735 setIndex: function(newIndex) |
| 736 { |
| 737 this._forcedIndex = newIndex; |
| 738 }, |
| 739 |
| 740 /** |
| 741 * @return {!WebInspector.HeapSnapshotEdge|!WebInspector.HeapSnapshotNode|!W
ebInspector.HeapSnapshotRetainerEdge} |
| 742 */ |
| 743 item: function() |
| 744 { |
| 745 this._iterator.setIndex(this.index()); |
| 746 return this._iterator.item(); |
| 747 }, |
| 748 |
| 749 next: function() |
| 750 { |
| 751 ++this._position; |
| 752 } |
| 753 } |
| 754 |
| 755 |
| 756 /** |
| 757 * @constructor |
| 758 * @implements {WebInspector.HeapSnapshotItemIterator} |
| 759 * @param {!WebInspector.HeapSnapshotItemIterator} iterator |
| 760 */ |
| 761 WebInspector.HeapSnapshotFilteredIterator = function(iterator, filter) |
| 762 { |
| 763 this._iterator = iterator; |
| 764 this._filter = filter; |
| 765 this._skipFilteredItems(); |
| 766 } |
| 767 |
| 768 WebInspector.HeapSnapshotFilteredIterator.prototype = { |
| 769 rewind: function() { }, |
| 770 |
| 771 /** |
| 772 * @return {boolean} |
| 773 */ |
| 774 hasNext: function() |
| 775 { |
| 776 return this._iterator.hasNext(); |
| 777 }, |
| 778 |
| 779 /** |
| 780 * @return {number} |
| 781 */ |
| 782 index: function() |
| 783 { |
| 784 return this._iterator.index(); |
| 785 }, |
| 786 |
| 787 /** |
| 788 * @param {number} newIndex |
| 789 */ |
| 790 setIndex: function(newIndex) |
| 791 { |
| 792 this._iterator.setIndex(newIndex); |
| 793 }, |
| 794 |
| 795 /** |
| 796 * @return {!WebInspector.HeapSnapshotEdge|!WebInspector.HeapSnapshotNode|!W
ebInspector.HeapSnapshotRetainerEdge} |
| 797 */ |
| 798 item: function() |
| 799 { |
| 800 return this._iterator.item(); |
| 801 }, |
| 802 |
| 803 next: function() |
| 804 { |
| 805 this._iterator.next(); |
| 806 this._skipFilteredItems(); |
| 807 }, |
| 808 |
| 809 _skipFilteredItems: function() |
| 810 { |
| 811 while (this._iterator.hasNext() && !this._filter(this._iterator.item()))
{ |
| 812 this._iterator.next(); |
| 813 } |
| 814 } |
| 815 } |
| 816 |
| 817 |
| 818 /** |
657 * @param {!WebInspector.HeapSnapshotWorkerDispatcher=} dispatcher | 819 * @param {!WebInspector.HeapSnapshotWorkerDispatcher=} dispatcher |
658 * @constructor | 820 * @constructor |
659 */ | 821 */ |
660 WebInspector.HeapSnapshotProgress = function(dispatcher) | 822 WebInspector.HeapSnapshotProgress = function(dispatcher) |
661 { | 823 { |
662 this._dispatcher = dispatcher; | 824 this._dispatcher = dispatcher; |
663 } | 825 } |
664 | 826 |
665 WebInspector.HeapSnapshotProgress.prototype = { | 827 WebInspector.HeapSnapshotProgress.prototype = { |
666 /** | 828 /** |
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1885 * @return {!WebInspector.HeapSnapshotCommon.StaticData} | 2047 * @return {!WebInspector.HeapSnapshotCommon.StaticData} |
1886 */ | 2048 */ |
1887 updateStaticData: function() | 2049 updateStaticData: function() |
1888 { | 2050 { |
1889 return new WebInspector.HeapSnapshotCommon.StaticData(this.nodeCount, th
is._rootNodeIndex, this.totalSize, this._maxJsNodeId()); | 2051 return new WebInspector.HeapSnapshotCommon.StaticData(this.nodeCount, th
is._rootNodeIndex, this.totalSize, this._maxJsNodeId()); |
1890 } | 2052 } |
1891 }; | 2053 }; |
1892 | 2054 |
1893 /** | 2055 /** |
1894 * @constructor | 2056 * @constructor |
1895 * @param {(!Array.<number>|!Uint32Array)=} unfilteredIterationOrder | 2057 * @param {!WebInspector.HeapSnapshotItemIterator} iterator |
1896 */ | 2058 */ |
1897 WebInspector.HeapSnapshotFilteredOrderedIterator = function(iterator, filter, un
filteredIterationOrder) | 2059 WebInspector.HeapSnapshotItemProvider = function(iterator) |
1898 { | 2060 { |
1899 this._filter = filter; | |
1900 this._iterator = iterator; | 2061 this._iterator = iterator; |
1901 this._unfilteredIterationOrder = unfilteredIterationOrder; | 2062 this._isEmpty = !iterator.hasNext(); |
1902 /** @type {?Array.<number>|?Uint32Array} */ | 2063 /** @type {?Array.<number>} */ |
1903 this._iterationOrder = null; | 2064 this._iterationOrder = null; |
1904 this._position = 0; | |
1905 this._currentComparator = null; | 2065 this._currentComparator = null; |
1906 this._sortedPrefixLength = 0; | 2066 this._sortedPrefixLength = 0; |
1907 this._sortedSuffixLength = 0; | 2067 this._sortedSuffixLength = 0; |
1908 } | 2068 } |
1909 | 2069 |
1910 WebInspector.HeapSnapshotFilteredOrderedIterator.prototype = { | 2070 WebInspector.HeapSnapshotItemProvider.prototype = { |
1911 _createIterationOrder: function() | 2071 _createIterationOrder: function() |
1912 { | 2072 { |
1913 if (this._iterationOrder) | 2073 if (this._iterationOrder) |
1914 return; | 2074 return; |
1915 if (this._unfilteredIterationOrder && !this._filter) { | |
1916 this._iterationOrder = this._unfilteredIterationOrder; | |
1917 this._unfilteredIterationOrder = null; | |
1918 return; | |
1919 } | |
1920 this._iterationOrder = []; | 2075 this._iterationOrder = []; |
1921 var iterator = this._iterator; | 2076 for (var iterator = this._iterator; iterator.hasNext(); iterator.next()) |
1922 if (!this._unfilteredIterationOrder && !this._filter) { | 2077 this._iterationOrder.push(iterator.index()); |
1923 for (iterator.rewind(); iterator.hasNext(); iterator.next()) | |
1924 this._iterationOrder.push(iterator.index()); | |
1925 } else if (!this._unfilteredIterationOrder) { | |
1926 for (iterator.rewind(); iterator.hasNext(); iterator.next()) { | |
1927 if (this._filter(iterator.item())) | |
1928 this._iterationOrder.push(iterator.index()); | |
1929 } | |
1930 } else { | |
1931 var order = this._unfilteredIterationOrder; | |
1932 for (var i = 0, l = order.length; i < l; ++i) { | |
1933 iterator.setIndex(order[i]); | |
1934 if (this._filter(iterator.item())) | |
1935 this._iterationOrder.push(iterator.index()); | |
1936 } | |
1937 this._unfilteredIterationOrder = null; | |
1938 } | |
1939 }, | |
1940 | |
1941 rewind: function() | |
1942 { | |
1943 this._position = 0; | |
1944 }, | 2078 }, |
1945 | 2079 |
1946 /** | 2080 /** |
1947 * @return {boolean} | |
1948 */ | |
1949 hasNext: function() | |
1950 { | |
1951 return this._position < this._iterationOrder.length; | |
1952 }, | |
1953 | |
1954 /** | |
1955 * @return {boolean} | 2081 * @return {boolean} |
1956 */ | 2082 */ |
1957 isEmpty: function() | 2083 isEmpty: function() |
1958 { | 2084 { |
1959 if (this._iterationOrder) | 2085 return this._isEmpty; |
1960 return !this._iterationOrder.length; | |
1961 if (this._unfilteredIterationOrder && !this._filter) | |
1962 return !this._unfilteredIterationOrder.length; | |
1963 var iterator = this._iterator; | |
1964 if (!this._unfilteredIterationOrder && !this._filter) { | |
1965 iterator.rewind(); | |
1966 return !iterator.hasNext(); | |
1967 } else if (!this._unfilteredIterationOrder) { | |
1968 for (iterator.rewind(); iterator.hasNext(); iterator.next()) | |
1969 if (this._filter(iterator.item())) | |
1970 return false; | |
1971 } else { | |
1972 var order = this._unfilteredIterationOrder; | |
1973 for (var i = 0, l = order.length; i < l; ++i) { | |
1974 iterator.setIndex(order[i]); | |
1975 if (this._filter(iterator.item())) | |
1976 return false; | |
1977 } | |
1978 } | |
1979 return true; | |
1980 }, | 2086 }, |
1981 | 2087 |
1982 /** | 2088 /** |
1983 * @return {*} | |
1984 */ | |
1985 item: function() | |
1986 { | |
1987 this._iterator.setIndex(this._iterationOrder[this._position]); | |
1988 return this._iterator.item(); | |
1989 }, | |
1990 | |
1991 /** | |
1992 * @type {number} | |
1993 */ | |
1994 get length() | |
1995 { | |
1996 this._createIterationOrder(); | |
1997 return this._iterationOrder.length; | |
1998 }, | |
1999 | |
2000 next: function() | |
2001 { | |
2002 ++this._position; | |
2003 }, | |
2004 | |
2005 /** | |
2006 * @param {number} begin | 2089 * @param {number} begin |
2007 * @param {number} end | 2090 * @param {number} end |
2008 * @return {!WebInspector.HeapSnapshotCommon.ItemsRange} | 2091 * @return {!WebInspector.HeapSnapshotCommon.ItemsRange} |
2009 */ | 2092 */ |
2010 serializeItemsRange: function(begin, end) | 2093 serializeItemsRange: function(begin, end) |
2011 { | 2094 { |
2012 this._createIterationOrder(); | 2095 this._createIterationOrder(); |
2013 if (begin > end) | 2096 if (begin > end) |
2014 throw new Error("Start position > end position: " + begin + " > " +
end); | 2097 throw new Error("Start position > end position: " + begin + " > " +
end); |
2015 if (end > this._iterationOrder.length) | 2098 if (end > this._iterationOrder.length) |
2016 end = this._iterationOrder.length; | 2099 end = this._iterationOrder.length; |
2017 if (this._sortedPrefixLength < end && begin < this._iterationOrder.lengt
h - this._sortedSuffixLength) { | 2100 if (this._sortedPrefixLength < end && begin < this._iterationOrder.lengt
h - this._sortedSuffixLength) { |
2018 this.sort(this._currentComparator, this._sortedPrefixLength, this._i
terationOrder.length - 1 - this._sortedSuffixLength, begin, end - 1); | 2101 this.sort(this._currentComparator, this._sortedPrefixLength, this._i
terationOrder.length - 1 - this._sortedSuffixLength, begin, end - 1); |
2019 if (begin <= this._sortedPrefixLength) | 2102 if (begin <= this._sortedPrefixLength) |
2020 this._sortedPrefixLength = end; | 2103 this._sortedPrefixLength = end; |
2021 if (end >= this._iterationOrder.length - this._sortedSuffixLength) | 2104 if (end >= this._iterationOrder.length - this._sortedSuffixLength) |
2022 this._sortedSuffixLength = this._iterationOrder.length - begin; | 2105 this._sortedSuffixLength = this._iterationOrder.length - begin; |
2023 } | 2106 } |
2024 | 2107 var position = begin; |
2025 this._position = begin; | |
2026 var startPosition = this._position; | |
2027 var count = end - begin; | 2108 var count = end - begin; |
2028 var result = new Array(count); | 2109 var result = new Array(count); |
2029 for (var i = 0 ; i < count && this.hasNext(); ++i, this.next()) | 2110 var iterator = this._iterator; |
2030 result[i] = this.item().serialize(); | 2111 for (var i = 0 ; i < count; ++i) { |
2031 return new WebInspector.HeapSnapshotCommon.ItemsRange(startPosition, thi
s._position, this._iterationOrder.length, result); | 2112 iterator.setIndex(this._iterationOrder[position++]); |
| 2113 result[i] = iterator.item().serialize(); |
| 2114 } |
| 2115 return new WebInspector.HeapSnapshotCommon.ItemsRange(begin, end, this._
iterationOrder.length, result); |
2032 }, | 2116 }, |
2033 | 2117 |
2034 sortAndRewind: function(comparator) | 2118 sortAndRewind: function(comparator) |
2035 { | 2119 { |
2036 this._currentComparator = comparator; | 2120 this._currentComparator = comparator; |
2037 this._sortedPrefixLength = 0; | 2121 this._sortedPrefixLength = 0; |
2038 this._sortedSuffixLength = 0; | 2122 this._sortedSuffixLength = 0; |
2039 this.rewind(); | |
2040 } | 2123 } |
2041 } | 2124 } |
2042 | 2125 |
2043 /** | 2126 /** |
2044 * @constructor | 2127 * @constructor |
2045 * @extends {WebInspector.HeapSnapshotFilteredOrderedIterator} | 2128 * @extends {WebInspector.HeapSnapshotItemProvider} |
2046 */ | 2129 */ |
2047 WebInspector.HeapSnapshotEdgesProvider = function(snapshot, filter, edgesIter) | 2130 WebInspector.HeapSnapshotEdgesProvider = function(snapshot, filter, edgesIter) |
2048 { | 2131 { |
2049 this.snapshot = snapshot; | 2132 this.snapshot = snapshot; |
2050 WebInspector.HeapSnapshotFilteredOrderedIterator.call(this, edgesIter, filte
r); | 2133 if (filter) |
| 2134 edgesIter = new WebInspector.HeapSnapshotFilteredIterator(edgesIter, fil
ter); |
| 2135 WebInspector.HeapSnapshotItemProvider.call(this, edgesIter); |
2051 } | 2136 } |
2052 | 2137 |
2053 WebInspector.HeapSnapshotEdgesProvider.prototype = { | 2138 WebInspector.HeapSnapshotEdgesProvider.prototype = { |
2054 /** | 2139 /** |
2055 * @param {!WebInspector.HeapSnapshotCommon.ComparatorConfig} comparator | 2140 * @param {!WebInspector.HeapSnapshotCommon.ComparatorConfig} comparator |
2056 * @param {number} leftBound | 2141 * @param {number} leftBound |
2057 * @param {number} rightBound | 2142 * @param {number} rightBound |
2058 * @param {number} windowLeft | 2143 * @param {number} windowLeft |
2059 * @param {number} windowRight | 2144 * @param {number} windowRight |
2060 */ | 2145 */ |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2125 } | 2210 } |
2126 | 2211 |
2127 if (fieldName1 === "!edgeName") | 2212 if (fieldName1 === "!edgeName") |
2128 this._iterationOrder.sortRange(compareEdgeAndNode, leftBound, rightB
ound, windowLeft, windowRight); | 2213 this._iterationOrder.sortRange(compareEdgeAndNode, leftBound, rightB
ound, windowLeft, windowRight); |
2129 else if (fieldName2 === "!edgeName") | 2214 else if (fieldName2 === "!edgeName") |
2130 this._iterationOrder.sortRange(compareNodeAndEdge, leftBound, rightB
ound, windowLeft, windowRight); | 2215 this._iterationOrder.sortRange(compareNodeAndEdge, leftBound, rightB
ound, windowLeft, windowRight); |
2131 else | 2216 else |
2132 this._iterationOrder.sortRange(compareNodeAndNode, leftBound, rightB
ound, windowLeft, windowRight); | 2217 this._iterationOrder.sortRange(compareNodeAndNode, leftBound, rightB
ound, windowLeft, windowRight); |
2133 }, | 2218 }, |
2134 | 2219 |
2135 __proto__: WebInspector.HeapSnapshotFilteredOrderedIterator.prototype | 2220 __proto__: WebInspector.HeapSnapshotItemProvider.prototype |
2136 } | 2221 } |
2137 | 2222 |
2138 | 2223 |
2139 /** | 2224 /** |
2140 * @constructor | 2225 * @constructor |
2141 * @extends {WebInspector.HeapSnapshotFilteredOrderedIterator} | 2226 * @extends {WebInspector.HeapSnapshotItemProvider} |
2142 * @param {(!Array.<number>|!Uint32Array)=} nodeIndexes | 2227 * @param {?function(!WebInspector.HeapSnapshotNode):boolean} filter |
| 2228 * @param {(!Array.<number>|!Uint32Array)} nodeIndexes |
2143 */ | 2229 */ |
2144 WebInspector.HeapSnapshotNodesProvider = function(snapshot, filter, nodeIndexes) | 2230 WebInspector.HeapSnapshotNodesProvider = function(snapshot, filter, nodeIndexes) |
2145 { | 2231 { |
2146 this.snapshot = snapshot; | 2232 this.snapshot = snapshot; |
2147 WebInspector.HeapSnapshotFilteredOrderedIterator.call(this, snapshot._allNod
es(), filter, nodeIndexes); | 2233 var it = new WebInspector.HeapSnapshotIndexRangeIterator(snapshot._allNodes(
), nodeIndexes); |
| 2234 if (filter) |
| 2235 it = new WebInspector.HeapSnapshotFilteredIterator(it, filter); |
| 2236 WebInspector.HeapSnapshotItemProvider.call(this, it); |
2148 } | 2237 } |
2149 | 2238 |
2150 WebInspector.HeapSnapshotNodesProvider.prototype = { | 2239 WebInspector.HeapSnapshotNodesProvider.prototype = { |
2151 /** | 2240 /** |
2152 * @param {string} snapshotObjectId | 2241 * @param {string} snapshotObjectId |
2153 * @return {number} | 2242 * @return {number} |
2154 */ | 2243 */ |
2155 nodePosition: function(snapshotObjectId) | 2244 nodePosition: function(snapshotObjectId) |
2156 { | 2245 { |
2157 this._createIterationOrder(); | 2246 this._createIterationOrder(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2219 * @param {number} leftBound | 2308 * @param {number} leftBound |
2220 * @param {number} rightBound | 2309 * @param {number} rightBound |
2221 * @param {number} windowLeft | 2310 * @param {number} windowLeft |
2222 * @param {number} windowRight | 2311 * @param {number} windowRight |
2223 */ | 2312 */ |
2224 sort: function(comparator, leftBound, rightBound, windowLeft, windowRight) | 2313 sort: function(comparator, leftBound, rightBound, windowLeft, windowRight) |
2225 { | 2314 { |
2226 this._iterationOrder.sortRange(this._buildCompareFunction(comparator), l
eftBound, rightBound, windowLeft, windowRight); | 2315 this._iterationOrder.sortRange(this._buildCompareFunction(comparator), l
eftBound, rightBound, windowLeft, windowRight); |
2227 }, | 2316 }, |
2228 | 2317 |
2229 __proto__: WebInspector.HeapSnapshotFilteredOrderedIterator.prototype | 2318 __proto__: WebInspector.HeapSnapshotItemProvider.prototype |
2230 } | 2319 } |
2231 | 2320 |
OLD | NEW |