OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 * @param {!WebInspector.HeapSnapshotProgress} progress | 33 * @param {!WebInspector.HeapSnapshotProgress} progress |
| 34 * @param {boolean} showHiddenData |
34 * @extends {WebInspector.HeapSnapshot} | 35 * @extends {WebInspector.HeapSnapshot} |
35 */ | 36 */ |
36 WebInspector.JSHeapSnapshot = function(profile, progress) | 37 WebInspector.JSHeapSnapshot = function(profile, progress, showHiddenData) |
37 { | 38 { |
38 this._nodeFlags = { // bit flags | 39 this._nodeFlags = { // bit flags |
39 canBeQueried: 1, | 40 canBeQueried: 1, |
40 detachedDOMTreeNode: 2, | 41 detachedDOMTreeNode: 2, |
41 pageObject: 4, // The idea is to track separately the objects owned by t
he page and the objects owned by debugger. | 42 pageObject: 4, // The idea is to track separately the objects owned by t
he page and the objects owned by debugger. |
42 | 43 |
43 visitedMarkerMask: 0x0ffff, // bits: 0,1111,1111,1111,1111 | 44 visitedMarkerMask: 0x0ffff, // bits: 0,1111,1111,1111,1111 |
44 visitedMarker: 0x10000 // bits: 1,0000,0000,0000,0000 | 45 visitedMarker: 0x10000 // bits: 1,0000,0000,0000,0000 |
45 }; | 46 }; |
46 this._lazyStringCache = { }; | 47 this._lazyStringCache = { }; |
47 WebInspector.HeapSnapshot.call(this, profile, progress); | 48 WebInspector.HeapSnapshot.call(this, profile, progress, showHiddenData); |
48 } | 49 } |
49 | 50 |
50 WebInspector.JSHeapSnapshot.prototype = { | 51 WebInspector.JSHeapSnapshot.prototype = { |
51 /** | 52 /** |
52 * @param {number} nodeIndex | 53 * @param {number} nodeIndex |
53 * @return {!WebInspector.JSHeapSnapshotNode} | 54 * @return {!WebInspector.JSHeapSnapshotNode} |
54 */ | 55 */ |
55 createNode: function(nodeIndex) | 56 createNode: function(nodeIndex) |
56 { | 57 { |
57 return new WebInspector.JSHeapSnapshotNode(this, nodeIndex); | 58 return new WebInspector.JSHeapSnapshotNode(this, nodeIndex); |
(...skipping 13 matching lines...) Expand all Loading... |
71 * @override | 72 * @override |
72 * @param {number} retainerIndex | 73 * @param {number} retainerIndex |
73 * @return {!WebInspector.JSHeapSnapshotRetainerEdge} | 74 * @return {!WebInspector.JSHeapSnapshotRetainerEdge} |
74 */ | 75 */ |
75 createRetainingEdge: function(retainerIndex) | 76 createRetainingEdge: function(retainerIndex) |
76 { | 77 { |
77 return new WebInspector.JSHeapSnapshotRetainerEdge(this, retainerIndex); | 78 return new WebInspector.JSHeapSnapshotRetainerEdge(this, retainerIndex); |
78 }, | 79 }, |
79 | 80 |
80 /** | 81 /** |
81 * @return {function(!WebInspector.JSHeapSnapshotNode):boolean} | 82 * @override |
| 83 * @return {?function(!WebInspector.JSHeapSnapshotNode):boolean} |
82 */ | 84 */ |
83 classNodesFilter: function() | 85 classNodesFilter: function() |
84 { | 86 { |
| 87 /** |
| 88 * @param {!WebInspector.JSHeapSnapshotNode} node |
| 89 * @return {boolean} |
| 90 */ |
85 function filter(node) | 91 function filter(node) |
86 { | 92 { |
87 return node.isUserObject(); | 93 return node.isUserObject(); |
88 } | 94 } |
89 return filter; | 95 return this._showHiddenData ? null : filter; |
90 }, | 96 }, |
91 | 97 |
92 /** | 98 /** |
93 * @param {boolean} showHiddenData | |
94 * @return {function(!WebInspector.HeapSnapshotEdge):boolean} | 99 * @return {function(!WebInspector.HeapSnapshotEdge):boolean} |
95 */ | 100 */ |
96 containmentEdgesFilter: function(showHiddenData) | 101 containmentEdgesFilter: function() |
97 { | 102 { |
| 103 var showHiddenData = this._showHiddenData; |
98 function filter(edge) { | 104 function filter(edge) { |
99 if (edge.isInvisible()) | 105 if (edge.isInvisible()) |
100 return false; | 106 return false; |
101 if (showHiddenData) | 107 if (showHiddenData) |
102 return true; | 108 return true; |
103 return !edge.isHidden() && !edge.node().isHidden(); | 109 return !edge.isHidden() && !edge.node().isHidden(); |
104 } | 110 } |
105 return filter; | 111 return filter; |
106 }, | 112 }, |
107 | 113 |
108 /** | 114 /** |
109 * @param {boolean} showHiddenData | |
110 * @return {function(!WebInspector.HeapSnapshotEdge):boolean} | 115 * @return {function(!WebInspector.HeapSnapshotEdge):boolean} |
111 */ | 116 */ |
112 retainingEdgesFilter: function(showHiddenData) | 117 retainingEdgesFilter: function() |
113 { | 118 { |
114 var containmentEdgesFilter = this.containmentEdgesFilter(showHiddenData)
; | 119 var containmentEdgesFilter = this.containmentEdgesFilter(); |
115 function filter(edge) | 120 function filter(edge) |
116 { | 121 { |
117 return containmentEdgesFilter(edge) && !edge.node().isRoot() && !edg
e.isWeak(); | 122 return containmentEdgesFilter(edge) && !edge.node().isRoot() && !edg
e.isWeak(); |
118 } | 123 } |
119 return filter; | 124 return filter; |
120 }, | 125 }, |
121 | 126 |
122 dispose: function() | 127 dispose: function() |
123 { | 128 { |
124 WebInspector.HeapSnapshot.prototype.dispose.call(this); | 129 WebInspector.HeapSnapshot.prototype.dispose.call(this); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 for (var iter2 = subRoot.edges(); iter2.hasNext(); iter2.next()) | 219 for (var iter2 = subRoot.edges(); iter2.hasNext(); iter2.next()) |
215 doAction(iter2.edge.node()); | 220 doAction(iter2.edge.node()); |
216 doAction(subRoot); | 221 doAction(subRoot); |
217 } | 222 } |
218 for (var iter = this.rootNode().edges(); iter.hasNext(); iter.next()
) | 223 for (var iter = this.rootNode().edges(); iter.hasNext(); iter.next()
) |
219 doAction(iter.edge.node()) | 224 doAction(iter.edge.node()) |
220 } | 225 } |
221 }, | 226 }, |
222 | 227 |
223 /** | 228 /** |
224 * @return {!{map: !Uint32Array, flag: number}} | 229 * @return {?{map: !Uint32Array, flag: number}} |
225 */ | 230 */ |
226 userObjectsMapAndFlag: function() | 231 userObjectsMapAndFlag: function() |
227 { | 232 { |
228 return { | 233 return this._showHiddenData ? null : { |
229 map: this._flags, | 234 map: this._flags, |
230 flag: this._nodeFlags.pageObject | 235 flag: this._nodeFlags.pageObject |
231 }; | 236 }; |
232 }, | 237 }, |
233 | 238 |
234 _flagsOfNode: function(node) | 239 _flagsOfNode: function(node) |
235 { | 240 { |
236 return this._flags[node.nodeIndex / this._nodeFieldCount]; | 241 return this._flags[node.nodeIndex / this._nodeFieldCount]; |
237 }, | 242 }, |
238 | 243 |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 * @return {boolean} | 836 * @return {boolean} |
832 */ | 837 */ |
833 isWeak: function() | 838 isWeak: function() |
834 { | 839 { |
835 return this._edge().isWeak(); | 840 return this._edge().isWeak(); |
836 }, | 841 }, |
837 | 842 |
838 __proto__: WebInspector.HeapSnapshotRetainerEdge.prototype | 843 __proto__: WebInspector.HeapSnapshotRetainerEdge.prototype |
839 } | 844 } |
840 | 845 |
OLD | NEW |