OLD | NEW |
1 var initialize_HeapSnapshotTest = function() { | 1 var initialize_HeapSnapshotTest = function() { |
2 | 2 |
3 InspectorTest.createHeapSnapshotMockFactories = function() { | 3 InspectorTest.createHeapSnapshotMockFactories = function() { |
4 | 4 |
5 InspectorTest.createJSHeapSnapshotMockObject = function() | 5 InspectorTest.createJSHeapSnapshotMockObject = function() |
6 { | 6 { |
7 return { | 7 return { |
8 _rootNodeIndex: 0, | 8 _rootNodeIndex: 0, |
9 _nodeTypeOffset: 0, | 9 _nodeTypeOffset: 0, |
10 _nodeNameOffset: 1, | 10 _nodeNameOffset: 1, |
(...skipping 11 matching lines...) Expand all Loading... |
22 _realNodesLength: 18, | 22 _realNodesLength: 18, |
23 // Represents the following graph: | 23 // Represents the following graph: |
24 // (numbers in parentheses indicate node offset) | 24 // (numbers in parentheses indicate node offset) |
25 // | 25 // |
26 // -> A (3) --ac- C (9) -ce- E(15) | 26 // -> A (3) --ac- C (9) -ce- E(15) |
27 // a/ | / | 27 // a/ | / |
28 // "" (0) 1 - bc - | 28 // "" (0) 1 - bc - |
29 // b\ v / | 29 // b\ v / |
30 // -> B (6) -bd- D (12) | 30 // -> B (6) -bd- D (12) |
31 // | 31 // |
32 _nodes: [ | 32 _nodes: new Uint32Array([ |
33 0, 0, 2, // 0: root | 33 0, 0, 2, // 0: root |
34 1, 1, 2, // 3: A | 34 1, 1, 2, // 3: A |
35 1, 2, 2, // 6: B | 35 1, 2, 2, // 6: B |
36 1, 3, 1, // 9: C | 36 1, 3, 1, // 9: C |
37 1, 4, 0, // 12: D | 37 1, 4, 0, // 12: D |
38 1, 5, 0], // 15: E | 38 1, 5, 0]), // 15: E |
39 _containmentEdges: [ | 39 _containmentEdges: new Uint32Array([ |
40 2, 6, 3, // 0: shortcut 'a' to node 'A' | 40 2, 6, 3, // 0: shortcut 'a' to node 'A' |
41 1, 7, 6, // 3: property 'b' to node 'B' | 41 1, 7, 6, // 3: property 'b' to node 'B' |
42 0, 1, 6, // 6: element '1' to node 'B' | 42 0, 1, 6, // 6: element '1' to node 'B' |
43 1, 8, 9, // 9: property 'ac' to node 'C' | 43 1, 8, 9, // 9: property 'ac' to node 'C' |
44 1, 9, 9, // 12: property 'bc' to node 'C' | 44 1, 9, 9, // 12: property 'bc' to node 'C' |
45 1, 10, 12, // 15: property 'bd' to node 'D' | 45 1, 10, 12, // 15: property 'bd' to node 'D' |
46 1, 11, 15], // 18: property 'ce' to node 'E' | 46 1, 11, 15]),// 18: property 'ce' to node 'E' |
47 _strings: ["", "A", "B", "C", "D", "E", "a", "b", "ac", "bc", "bd", "ce"
], | 47 _strings: ["", "A", "B", "C", "D", "E", "a", "b", "ac", "bc", "bd", "ce"
], |
48 _firstEdgeIndexes: [0, 6, 12, 18, 21, 21, 21], | 48 _firstEdgeIndexes: new Uint32Array([0, 6, 12, 18, 21, 21, 21]), |
49 createNode: WebInspector.JSHeapSnapshot.prototype.createNode, | 49 createNode: WebInspector.JSHeapSnapshot.prototype.createNode, |
50 createEdge: WebInspector.JSHeapSnapshot.prototype.createEdge, | 50 createEdge: WebInspector.JSHeapSnapshot.prototype.createEdge, |
51 createRetainingEdge: WebInspector.JSHeapSnapshot.prototype.createRetaini
ngEdge | 51 createRetainingEdge: WebInspector.JSHeapSnapshot.prototype.createRetaini
ngEdge |
52 }; | 52 }; |
53 }; | 53 }; |
54 | 54 |
55 InspectorTest.createHeapSnapshotMockRaw = function() | 55 InspectorTest.createHeapSnapshotMockRaw = function() |
56 { | 56 { |
57 // Effectively the same graph as in createJSHeapSnapshotMockObject, | 57 // Effectively the same graph as in createJSHeapSnapshotMockObject, |
58 // but having full set of fields. | 58 // but having full set of fields. |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 | 320 |
321 rawSnapshot.strings = this._strings.slice(); | 321 rawSnapshot.strings = this._strings.slice(); |
322 | 322 |
323 var meta = rawSnapshot.snapshot.meta; | 323 var meta = rawSnapshot.snapshot.meta; |
324 rawSnapshot.snapshot.edge_count = rawSnapshot.edges.length / meta.edge_f
ields.length; | 324 rawSnapshot.snapshot.edge_count = rawSnapshot.edges.length / meta.edge_f
ields.length; |
325 rawSnapshot.snapshot.node_count = rawSnapshot.nodes.length / meta.node_f
ields.length; | 325 rawSnapshot.snapshot.node_count = rawSnapshot.nodes.length / meta.node_f
ields.length; |
326 | 326 |
327 return rawSnapshot; | 327 return rawSnapshot; |
328 }, | 328 }, |
329 | 329 |
| 330 createJSHeapSnapshot: function() |
| 331 { |
| 332 var parsedSnapshot = InspectorTest._postprocessHeapSnapshotMock(this.gen
erateSnapshot()); |
| 333 return new WebInspector.JSHeapSnapshot(parsedSnapshot, new WebInspector.
HeapSnapshotProgress()); |
| 334 }, |
| 335 |
330 _registerNode: function(node) | 336 _registerNode: function(node) |
331 { | 337 { |
332 this._nodes.push(node); | 338 this._nodes.push(node); |
333 return this._nodes.length - 1; | 339 return this._nodes.length - 1; |
334 }, | 340 }, |
335 | 341 |
336 lookupNodeType: function(typeName) | 342 lookupNodeType: function(typeName) |
337 { | 343 { |
338 if (typeName === undefined) | 344 if (typeName === undefined) |
339 throw new Error("wrong node type: " + typeName); | 345 throw new Error("wrong node type: " + typeName); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 function sortingComplete() | 744 function sortingComplete() |
739 { | 745 { |
740 dataGrid.removeEventListener(WebInspector.HeapSnapshotSortableDataGr
id.Events.SortingComplete, sortingComplete, null); | 746 dataGrid.removeEventListener(WebInspector.HeapSnapshotSortableDataGr
id.Events.SortingComplete, sortingComplete, null); |
741 callback(); | 747 callback(); |
742 } | 748 } |
743 dataGrid.addEventListener(WebInspector.HeapSnapshotSortableDataGrid.Even
ts.SortingComplete, sortingComplete, null); | 749 dataGrid.addEventListener(WebInspector.HeapSnapshotSortableDataGrid.Even
ts.SortingComplete, sortingComplete, null); |
744 } | 750 } |
745 }; | 751 }; |
746 | 752 |
747 }; | 753 }; |
OLD | NEW |