| 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 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 { | 856 { |
| 857 // May be undefined in tests. | 857 // May be undefined in tests. |
| 858 if (this._dispatcher) | 858 if (this._dispatcher) |
| 859 this._dispatcher.sendEvent(WebInspector.HeapSnapshotProgressEvent.Up
date, text); | 859 this._dispatcher.sendEvent(WebInspector.HeapSnapshotProgressEvent.Up
date, text); |
| 860 } | 860 } |
| 861 } | 861 } |
| 862 | 862 |
| 863 | 863 |
| 864 /** | 864 /** |
| 865 * @param {!WebInspector.HeapSnapshotProgress} progress | 865 * @param {!WebInspector.HeapSnapshotProgress} progress |
| 866 * @param {boolean} showHiddenData |
| 866 * @constructor | 867 * @constructor |
| 867 */ | 868 */ |
| 868 WebInspector.HeapSnapshot = function(profile, progress) | 869 WebInspector.HeapSnapshot = function(profile, progress, showHiddenData) |
| 869 { | 870 { |
| 870 this._nodes = profile.nodes; | 871 this._nodes = profile.nodes; |
| 871 this._containmentEdges = profile.edges; | 872 this._containmentEdges = profile.edges; |
| 872 /** @type {!HeapSnapshotMetainfo} */ | 873 /** @type {!HeapSnapshotMetainfo} */ |
| 873 this._metaNode = profile.snapshot.meta; | 874 this._metaNode = profile.snapshot.meta; |
| 874 this._strings = profile.strings; | 875 this._strings = profile.strings; |
| 875 this._progress = progress; | 876 this._progress = progress; |
| 876 | 877 |
| 877 this._noDistance = -5; | 878 this._noDistance = -5; |
| 878 this._rootNodeIndex = 0; | 879 this._rootNodeIndex = 0; |
| 879 if (profile.snapshot.root_index) | 880 if (profile.snapshot.root_index) |
| 880 this._rootNodeIndex = profile.snapshot.root_index; | 881 this._rootNodeIndex = profile.snapshot.root_index; |
| 881 | 882 |
| 882 this._snapshotDiffs = {}; | 883 this._snapshotDiffs = {}; |
| 883 this._aggregatesForDiff = null; | 884 this._aggregatesForDiff = null; |
| 884 this._aggregates = {}; | 885 this._aggregates = {}; |
| 885 this._aggregatesSortedFlags = {}; | 886 this._aggregatesSortedFlags = {}; |
| 887 this._showHiddenData = showHiddenData; |
| 886 | 888 |
| 887 this._init(); | 889 this._init(); |
| 888 | 890 |
| 889 if (profile.snapshot.trace_function_count) { | 891 if (profile.snapshot.trace_function_count) { |
| 890 this._progress.updateStatus("Buiding allocation statistics\u2026"); | 892 this._progress.updateStatus("Buiding allocation statistics\u2026"); |
| 891 var nodes = this._nodes; | 893 var nodes = this._nodes; |
| 892 var nodesLength = nodes.length; | 894 var nodesLength = nodes.length; |
| 893 var nodeFieldCount = this._nodeFieldCount; | 895 var nodeFieldCount = this._nodeFieldCount; |
| 894 var node = this.rootNode(); | 896 var node = this.rootNode(); |
| 895 var liveObjects = {}; | 897 var liveObjects = {}; |
| (...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 if (!node) | 1915 if (!node) |
| 1914 return null; | 1916 return null; |
| 1915 var result = []; | 1917 var result = []; |
| 1916 while (!node.isRoot()) { | 1918 while (!node.isRoot()) { |
| 1917 result.push(node.id()); | 1919 result.push(node.id()); |
| 1918 node.nodeIndex = node.dominatorIndex(); | 1920 node.nodeIndex = node.dominatorIndex(); |
| 1919 } | 1921 } |
| 1920 return result; | 1922 return result; |
| 1921 }, | 1923 }, |
| 1922 | 1924 |
| 1923 _parseFilter: function(filter) | |
| 1924 { | |
| 1925 if (!filter) | |
| 1926 return null; | |
| 1927 var parsedFilter = eval("(function(){return " + filter + "})()"); | |
| 1928 return parsedFilter.bind(this); | |
| 1929 }, | |
| 1930 | |
| 1931 /** | 1925 /** |
| 1932 * @param {number} nodeIndex | 1926 * @param {number} nodeIndex |
| 1933 * @param {boolean} showHiddenData | |
| 1934 * @return {!WebInspector.HeapSnapshotEdgesProvider} | 1927 * @return {!WebInspector.HeapSnapshotEdgesProvider} |
| 1935 */ | 1928 */ |
| 1936 createEdgesProvider: function(nodeIndex, showHiddenData) | 1929 createEdgesProvider: function(nodeIndex) |
| 1937 { | 1930 { |
| 1938 var node = this.createNode(nodeIndex); | 1931 var node = this.createNode(nodeIndex); |
| 1939 var filter = this.containmentEdgesFilter(showHiddenData); | 1932 var filter = this.containmentEdgesFilter(); |
| 1940 var indexProvider = new WebInspector.HeapSnapshotEdgeIndexProvider(this)
; | 1933 var indexProvider = new WebInspector.HeapSnapshotEdgeIndexProvider(this)
; |
| 1941 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edg
es(), indexProvider); | 1934 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edg
es(), indexProvider); |
| 1942 }, | 1935 }, |
| 1943 | 1936 |
| 1944 /** | 1937 /** |
| 1945 * @param {number} nodeIndex | 1938 * @param {number} nodeIndex |
| 1946 * @return {!WebInspector.HeapSnapshotEdgesProvider} | 1939 * @return {!WebInspector.HeapSnapshotEdgesProvider} |
| 1947 */ | 1940 */ |
| 1948 createEdgesProviderForTest: function(nodeIndex, filter) | 1941 createEdgesProviderForTest: function(nodeIndex, filter) |
| 1949 { | 1942 { |
| 1950 var node = this.createNode(nodeIndex); | 1943 var node = this.createNode(nodeIndex); |
| 1951 var indexProvider = new WebInspector.HeapSnapshotEdgeIndexProvider(this)
; | 1944 var indexProvider = new WebInspector.HeapSnapshotEdgeIndexProvider(this)
; |
| 1952 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edg
es(), indexProvider); | 1945 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edg
es(), indexProvider); |
| 1953 }, | 1946 }, |
| 1954 | 1947 |
| 1955 /** | 1948 /** |
| 1956 * @param {boolean} showHiddenData | |
| 1957 * @return {?function(!WebInspector.HeapSnapshotEdge):boolean} | 1949 * @return {?function(!WebInspector.HeapSnapshotEdge):boolean} |
| 1958 */ | 1950 */ |
| 1959 retainingEdgesFilter: function(showHiddenData) | 1951 retainingEdgesFilter: function() |
| 1960 { | 1952 { |
| 1961 return null; | 1953 return null; |
| 1962 }, | 1954 }, |
| 1963 | 1955 |
| 1964 /** | 1956 /** |
| 1965 * @param {boolean} showHiddenData | |
| 1966 * @return {?function(!WebInspector.HeapSnapshotEdge):boolean} | 1957 * @return {?function(!WebInspector.HeapSnapshotEdge):boolean} |
| 1967 */ | 1958 */ |
| 1968 containmentEdgesFilter: function(showHiddenData) | 1959 containmentEdgesFilter: function() |
| 1969 { | 1960 { |
| 1970 return null; | 1961 return null; |
| 1971 }, | 1962 }, |
| 1972 | 1963 |
| 1973 /** | 1964 /** |
| 1974 * @param {number} nodeIndex | 1965 * @param {number} nodeIndex |
| 1975 * @param {boolean} showHiddenData | |
| 1976 * @return {!WebInspector.HeapSnapshotEdgesProvider} | 1966 * @return {!WebInspector.HeapSnapshotEdgesProvider} |
| 1977 */ | 1967 */ |
| 1978 createRetainingEdgesProvider: function(nodeIndex, showHiddenData) | 1968 createRetainingEdgesProvider: function(nodeIndex) |
| 1979 { | 1969 { |
| 1980 var node = this.createNode(nodeIndex); | 1970 var node = this.createNode(nodeIndex); |
| 1981 var filter = this.retainingEdgesFilter(showHiddenData); | 1971 var filter = this.retainingEdgesFilter(); |
| 1982 var indexProvider = new WebInspector.HeapSnapshotRetainerEdgeIndexProvid
er(this); | 1972 var indexProvider = new WebInspector.HeapSnapshotRetainerEdgeIndexProvid
er(this); |
| 1983 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.ret
ainers(), indexProvider); | 1973 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.ret
ainers(), indexProvider); |
| 1984 }, | 1974 }, |
| 1985 | 1975 |
| 1986 /** | 1976 /** |
| 1987 * @param {string} baseSnapshotId | 1977 * @param {string} baseSnapshotId |
| 1988 * @param {string} className | 1978 * @param {string} className |
| 1989 * @return {!WebInspector.HeapSnapshotNodesProvider} | 1979 * @return {!WebInspector.HeapSnapshotNodesProvider} |
| 1990 */ | 1980 */ |
| 1991 createAddedNodesProvider: function(baseSnapshotId, className) | 1981 createAddedNodesProvider: function(baseSnapshotId, className) |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2325 * @param {number} windowRight | 2315 * @param {number} windowRight |
| 2326 */ | 2316 */ |
| 2327 sort: function(comparator, leftBound, rightBound, windowLeft, windowRight) | 2317 sort: function(comparator, leftBound, rightBound, windowLeft, windowRight) |
| 2328 { | 2318 { |
| 2329 this._iterationOrder.sortRange(this._buildCompareFunction(comparator), l
eftBound, rightBound, windowLeft, windowRight); | 2319 this._iterationOrder.sortRange(this._buildCompareFunction(comparator), l
eftBound, rightBound, windowLeft, windowRight); |
| 2330 }, | 2320 }, |
| 2331 | 2321 |
| 2332 __proto__: WebInspector.HeapSnapshotItemProvider.prototype | 2322 __proto__: WebInspector.HeapSnapshotItemProvider.prototype |
| 2333 } | 2323 } |
| 2334 | 2324 |
| OLD | NEW |