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