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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 { | 722 { |
723 ++this._position; | 723 ++this._position; |
724 } | 724 } |
725 } | 725 } |
726 | 726 |
727 | 727 |
728 /** | 728 /** |
729 * @constructor | 729 * @constructor |
730 * @implements {WebInspector.HeapSnapshotItemIterator} | 730 * @implements {WebInspector.HeapSnapshotItemIterator} |
731 * @param {!WebInspector.HeapSnapshotItemIterator} iterator | 731 * @param {!WebInspector.HeapSnapshotItemIterator} iterator |
| 732 * @param {function(!WebInspector.HeapSnapshotItem):boolean=} filter |
732 */ | 733 */ |
733 WebInspector.HeapSnapshotFilteredIterator = function(iterator, filter) | 734 WebInspector.HeapSnapshotFilteredIterator = function(iterator, filter) |
734 { | 735 { |
735 this._iterator = iterator; | 736 this._iterator = iterator; |
736 this._filter = filter; | 737 this._filter = filter; |
737 this._skipFilteredItems(); | 738 this._skipFilteredItems(); |
738 } | 739 } |
739 | 740 |
740 WebInspector.HeapSnapshotFilteredIterator.prototype = { | 741 WebInspector.HeapSnapshotFilteredIterator.prototype = { |
741 /** | 742 /** |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 _sendUpdateEvent: function(text) | 805 _sendUpdateEvent: function(text) |
805 { | 806 { |
806 // May be undefined in tests. | 807 // May be undefined in tests. |
807 if (this._dispatcher) | 808 if (this._dispatcher) |
808 this._dispatcher.sendEvent(WebInspector.HeapSnapshotProgressEvent.Up
date, text); | 809 this._dispatcher.sendEvent(WebInspector.HeapSnapshotProgressEvent.Up
date, text); |
809 } | 810 } |
810 } | 811 } |
811 | 812 |
812 | 813 |
813 /** | 814 /** |
| 815 * @param {!Object} profile |
814 * @param {!WebInspector.HeapSnapshotProgress} progress | 816 * @param {!WebInspector.HeapSnapshotProgress} progress |
815 * @param {boolean} showHiddenData | 817 * @param {boolean} showHiddenData |
816 * @constructor | 818 * @constructor |
817 */ | 819 */ |
818 WebInspector.HeapSnapshot = function(profile, progress, showHiddenData) | 820 WebInspector.HeapSnapshot = function(profile, progress, showHiddenData) |
819 { | 821 { |
820 this._nodes = profile.nodes; | 822 this._nodes = profile.nodes; |
821 this._containmentEdges = profile.edges; | 823 this._containmentEdges = profile.edges; |
822 /** @type {!HeapSnapshotMetainfo} */ | 824 /** @type {!HeapSnapshotMetainfo} */ |
823 this._metaNode = profile.snapshot.meta; | 825 this._metaNode = profile.snapshot.meta; |
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1890 createEdgesProvider: function(nodeIndex) | 1892 createEdgesProvider: function(nodeIndex) |
1891 { | 1893 { |
1892 var node = this.createNode(nodeIndex); | 1894 var node = this.createNode(nodeIndex); |
1893 var filter = this.containmentEdgesFilter(); | 1895 var filter = this.containmentEdgesFilter(); |
1894 var indexProvider = new WebInspector.HeapSnapshotEdgeIndexProvider(this)
; | 1896 var indexProvider = new WebInspector.HeapSnapshotEdgeIndexProvider(this)
; |
1895 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edg
es(), indexProvider); | 1897 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edg
es(), indexProvider); |
1896 }, | 1898 }, |
1897 | 1899 |
1898 /** | 1900 /** |
1899 * @param {number} nodeIndex | 1901 * @param {number} nodeIndex |
| 1902 * @param {?function(!WebInspector.HeapSnapshotEdge):boolean} filter |
1900 * @return {!WebInspector.HeapSnapshotEdgesProvider} | 1903 * @return {!WebInspector.HeapSnapshotEdgesProvider} |
1901 */ | 1904 */ |
1902 createEdgesProviderForTest: function(nodeIndex, filter) | 1905 createEdgesProviderForTest: function(nodeIndex, filter) |
1903 { | 1906 { |
1904 var node = this.createNode(nodeIndex); | 1907 var node = this.createNode(nodeIndex); |
1905 var indexProvider = new WebInspector.HeapSnapshotEdgeIndexProvider(this)
; | 1908 var indexProvider = new WebInspector.HeapSnapshotEdgeIndexProvider(this)
; |
1906 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edg
es(), indexProvider); | 1909 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edg
es(), indexProvider); |
1907 }, | 1910 }, |
1908 | 1911 |
1909 /** | 1912 /** |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2082 { | 2085 { |
2083 this._currentComparator = comparator; | 2086 this._currentComparator = comparator; |
2084 this._sortedPrefixLength = 0; | 2087 this._sortedPrefixLength = 0; |
2085 this._sortedSuffixLength = 0; | 2088 this._sortedSuffixLength = 0; |
2086 } | 2089 } |
2087 } | 2090 } |
2088 | 2091 |
2089 /** | 2092 /** |
2090 * @constructor | 2093 * @constructor |
2091 * @extends {WebInspector.HeapSnapshotItemProvider} | 2094 * @extends {WebInspector.HeapSnapshotItemProvider} |
| 2095 * @param {!WebInspector.HeapSnapshot} snapshot |
| 2096 * @param {?function(!WebInspector.HeapSnapshotEdge):boolean} filter |
| 2097 * @param {!WebInspector.HeapSnapshotEdgeIterator} edgesIter |
2092 * @param {!WebInspector.HeapSnapshotItemIndexProvider} indexProvider | 2098 * @param {!WebInspector.HeapSnapshotItemIndexProvider} indexProvider |
2093 */ | 2099 */ |
2094 WebInspector.HeapSnapshotEdgesProvider = function(snapshot, filter, edgesIter, i
ndexProvider) | 2100 WebInspector.HeapSnapshotEdgesProvider = function(snapshot, filter, edgesIter, i
ndexProvider) |
2095 { | 2101 { |
2096 this.snapshot = snapshot; | 2102 this.snapshot = snapshot; |
2097 if (filter) | 2103 var iter = filter ? new WebInspector.HeapSnapshotFilteredIterator(edgesIter,
/** @type {function(!WebInspector.HeapSnapshotItem):boolean} */ (filter)) : edg
esIter; |
2098 edgesIter = new WebInspector.HeapSnapshotFilteredIterator(edgesIter, fil
ter); | 2104 WebInspector.HeapSnapshotItemProvider.call(this, iter, indexProvider); |
2099 WebInspector.HeapSnapshotItemProvider.call(this, edgesIter, indexProvider); | |
2100 } | 2105 } |
2101 | 2106 |
2102 WebInspector.HeapSnapshotEdgesProvider.prototype = { | 2107 WebInspector.HeapSnapshotEdgesProvider.prototype = { |
2103 /** | 2108 /** |
2104 * @param {!WebInspector.HeapSnapshotCommon.ComparatorConfig} comparator | 2109 * @param {!WebInspector.HeapSnapshotCommon.ComparatorConfig} comparator |
2105 * @param {number} leftBound | 2110 * @param {number} leftBound |
2106 * @param {number} rightBound | 2111 * @param {number} rightBound |
2107 * @param {number} windowLeft | 2112 * @param {number} windowLeft |
2108 * @param {number} windowRight | 2113 * @param {number} windowRight |
2109 */ | 2114 */ |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2181 this._iterationOrder.sortRange(compareNodeAndNode, leftBound, rightB
ound, windowLeft, windowRight); | 2186 this._iterationOrder.sortRange(compareNodeAndNode, leftBound, rightB
ound, windowLeft, windowRight); |
2182 }, | 2187 }, |
2183 | 2188 |
2184 __proto__: WebInspector.HeapSnapshotItemProvider.prototype | 2189 __proto__: WebInspector.HeapSnapshotItemProvider.prototype |
2185 } | 2190 } |
2186 | 2191 |
2187 | 2192 |
2188 /** | 2193 /** |
2189 * @constructor | 2194 * @constructor |
2190 * @extends {WebInspector.HeapSnapshotItemProvider} | 2195 * @extends {WebInspector.HeapSnapshotItemProvider} |
| 2196 * @param {!WebInspector.HeapSnapshot} snapshot |
2191 * @param {?function(!WebInspector.HeapSnapshotNode):boolean} filter | 2197 * @param {?function(!WebInspector.HeapSnapshotNode):boolean} filter |
2192 * @param {(!Array.<number>|!Uint32Array)} nodeIndexes | 2198 * @param {(!Array.<number>|!Uint32Array)} nodeIndexes |
2193 */ | 2199 */ |
2194 WebInspector.HeapSnapshotNodesProvider = function(snapshot, filter, nodeIndexes) | 2200 WebInspector.HeapSnapshotNodesProvider = function(snapshot, filter, nodeIndexes) |
2195 { | 2201 { |
2196 this.snapshot = snapshot; | 2202 this.snapshot = snapshot; |
2197 var indexProvider = new WebInspector.HeapSnapshotNodeIndexProvider(snapshot)
; | 2203 var indexProvider = new WebInspector.HeapSnapshotNodeIndexProvider(snapshot)
; |
2198 var it = new WebInspector.HeapSnapshotIndexRangeIterator(indexProvider, node
Indexes); | 2204 var it = new WebInspector.HeapSnapshotIndexRangeIterator(indexProvider, node
Indexes); |
| 2205 |
2199 if (filter) | 2206 if (filter) |
2200 it = new WebInspector.HeapSnapshotFilteredIterator(it, filter); | 2207 it = new WebInspector.HeapSnapshotFilteredIterator(it, /** @type {functi
on(!WebInspector.HeapSnapshotItem):boolean} */ (filter)); |
2201 WebInspector.HeapSnapshotItemProvider.call(this, it, indexProvider); | 2208 WebInspector.HeapSnapshotItemProvider.call(this, it, indexProvider); |
2202 } | 2209 } |
2203 | 2210 |
2204 WebInspector.HeapSnapshotNodesProvider.prototype = { | 2211 WebInspector.HeapSnapshotNodesProvider.prototype = { |
2205 /** | 2212 /** |
2206 * @param {string} snapshotObjectId | 2213 * @param {string} snapshotObjectId |
2207 * @return {number} | 2214 * @return {number} |
2208 */ | 2215 */ |
2209 nodePosition: function(snapshotObjectId) | 2216 nodePosition: function(snapshotObjectId) |
2210 { | 2217 { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2263 var result = sortByNodeField(fieldAccessor1, ascending1); | 2270 var result = sortByNodeField(fieldAccessor1, ascending1); |
2264 if (result === 0) | 2271 if (result === 0) |
2265 result = sortByNodeField(fieldAccessor2, ascending2); | 2272 result = sortByNodeField(fieldAccessor2, ascending2); |
2266 return result || indexA - indexB; | 2273 return result || indexA - indexB; |
2267 } | 2274 } |
2268 | 2275 |
2269 return sortByComparator; | 2276 return sortByComparator; |
2270 }, | 2277 }, |
2271 | 2278 |
2272 /** | 2279 /** |
| 2280 * @param {!WebInspector.HeapSnapshotCommon.ComparatorConfig} comparator |
2273 * @param {number} leftBound | 2281 * @param {number} leftBound |
2274 * @param {number} rightBound | 2282 * @param {number} rightBound |
2275 * @param {number} windowLeft | 2283 * @param {number} windowLeft |
2276 * @param {number} windowRight | 2284 * @param {number} windowRight |
2277 */ | 2285 */ |
2278 sort: function(comparator, leftBound, rightBound, windowLeft, windowRight) | 2286 sort: function(comparator, leftBound, rightBound, windowLeft, windowRight) |
2279 { | 2287 { |
2280 this._iterationOrder.sortRange(this._buildCompareFunction(comparator), l
eftBound, rightBound, windowLeft, windowRight); | 2288 this._iterationOrder.sortRange(this._buildCompareFunction(comparator), l
eftBound, rightBound, windowLeft, windowRight); |
2281 }, | 2289 }, |
2282 | 2290 |
2283 __proto__: WebInspector.HeapSnapshotItemProvider.prototype | 2291 __proto__: WebInspector.HeapSnapshotItemProvider.prototype |
2284 } | 2292 } |
2285 | 2293 |
OLD | NEW |