Web Inspector: Move meta node out of nodes in snapshot serialization.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Apr 2012 15:57:19 +0000 (15:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Apr 2012 15:57:19 +0000 (15:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=83701

Patch by Alexei Filippov <alexeif@chromium.org> on 2012-04-12
Reviewed by Yury Semikhatsky.

Source/WebCore:

* inspector/front-end/HeapSnapshot.js:
(WebInspector.HeapSnapshotLoader.prototype.pushJSONChunk):
(WebInspector.HeapSnapshot):

LayoutTests:

* inspector/profiler/heap-snapshot-test.js:
(initialize_HeapSnapshotTest.InspectorTest.createHeapSnapshotSplitNodesEdgesMockRaw):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113988 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/inspector/profiler/heap-snapshot-test.js
Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/HeapSnapshot.js

index c10cccb..1232876 100644 (file)
@@ -1,3 +1,13 @@
+2012-04-12  Alexei Filippov  <alexeif@chromium.org>
+
+        Web Inspector: Move meta node out of nodes in snapshot serialization.
+        https://bugs.webkit.org/show_bug.cgi?id=83701
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/profiler/heap-snapshot-test.js:
+        (initialize_HeapSnapshotTest.InspectorTest.createHeapSnapshotSplitNodesEdgesMockRaw):
+
 2012-04-12  Philippe Normand  <pnormand@igalia.com>
 
         Unreviewed, GTK test_expectations post-Skipped-migration update.
index 10e1439..e0d25ac 100644 (file)
@@ -78,15 +78,16 @@ InspectorTest.createHeapSnapshotSplitNodesEdgesMockRaw = function()
     // Return the same snapshot as above but having the nodes and edges
     // separated.
     return {
-        snapshot: {},
-        nodes: [
-            {
-                separate_edges: true,
+        snapshot: {
+            meta: {
                 node_fields: ["type", "name", "id", "self_size", "retained_size", "dominator", "edges_index"],
                 node_types: [["hidden", "object"], "", "", "", "", "", ""],
                 edge_fields: ["type", "name_or_index", "to_node"],
                 edge_types: [["element", "property"], "", ""]
             },
+            node_count: 6,
+            edge_count: 7},
+        nodes: [
             0, 0, 1, 0, 20,  0,  0,
             1, 1, 2, 2,  2,  0,  6,
             1, 2, 3, 3,  8,  0, 12,
@@ -104,7 +105,7 @@ InspectorTest.createHeapSnapshotSplitNodesEdgesMockRaw = function()
 
 InspectorTest._postprocessHeapSnapshotMock = function(mock)
 {
-    mock.metaNode = mock.nodes[0];
+    mock.snapshot.meta = mock.nodes[0];
     mock.nodes[0] = 0;
     var tempNodes = new Int32Array(1000);
     tempNodes.set(mock.nodes);
index 1db6095..db093d6 100644 (file)
@@ -1,3 +1,14 @@
+2012-04-12  Alexei Filippov  <alexeif@chromium.org>
+
+        Web Inspector: Move meta node out of nodes in snapshot serialization.
+        https://bugs.webkit.org/show_bug.cgi?id=83701
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/HeapSnapshot.js:
+        (WebInspector.HeapSnapshotLoader.prototype.pushJSONChunk):
+        (WebInspector.HeapSnapshot):
+
 2012-04-12  Yael Aharon  <yael.aharon@nokia.com>
 
         [Qt][WK2] Nested fixed elements scroll too fast
index 11036a1..94d8bf5 100644 (file)
@@ -176,7 +176,15 @@ WebInspector.HeapSnapshotLoader.prototype = {
             if (bracketIndex === -1)
                 return;
             this._json = this._json.slice(bracketIndex + 1);
-            this._state = "parse-nodes-meta-info";
+            if (this._snapshot.snapshot.meta) {
+                var node_fields_count = this._snapshot.snapshot.meta.node_fields.length;
+                var nodes_length = this._snapshot.snapshot.node_count * node_fields_count;
+                this._array = new WebInspector.Uint32Array(nodes_length);
+                this._snapshot.snapshot.meta.separate_edges = true;
+                this._state = "parse-nodes";
+            } else {
+                this._state = "parse-nodes-meta-info";
+            }
             this.pushJSONChunk("");
             break;
         }
@@ -184,11 +192,10 @@ WebInspector.HeapSnapshotLoader.prototype = {
             var closingBracketIndex = this._findBalancedCurlyBrackets();
             if (closingBracketIndex === -1)
                 return;
-            this._snapshot.metaNode = JSON.parse(this._json.slice(0, closingBracketIndex));
+            this._snapshot.snapshot.meta = JSON.parse(this._json.slice(0, closingBracketIndex));
             this._json = this._json.slice(closingBracketIndex);
             this._array = new WebInspector.Uint32Array();
-            if (!this._snapshot.metaNode.separate_edges)
-                this._array.push(0);
+            this._array.push(0);
             this._state = "parse-nodes";
             this.pushJSONChunk("");
             break;
@@ -196,7 +203,7 @@ WebInspector.HeapSnapshotLoader.prototype = {
         case "parse-nodes": {
             if (this._parseUintArray())
                 return;
-            if (this._snapshot.metaNode.separate_edges) {
+            if (this._snapshot.snapshot.meta.separate_edges) {
                 this._snapshot.onlyNodes = this._array.array;
                 this._state = "find-edges";
             } else {
@@ -216,7 +223,9 @@ WebInspector.HeapSnapshotLoader.prototype = {
             if (bracketIndex === -1)
                 return;
             this._json = this._json.slice(bracketIndex + 1);
-            this._array = new WebInspector.Uint32Array();
+            var edge_fields_count = this._snapshot.snapshot.meta.edge_fields.length;
+            var edges_length = this._snapshot.snapshot.edge_count * edge_fields_count;
+            this._array = new WebInspector.Uint32Array(edges_length);
             this._state = "parse-edges";
             this.pushJSONChunk("");
             break;
@@ -823,7 +832,7 @@ WebInspector.HeapSnapshot = function(profile)
     this._onlyNodes = profile.onlyNodes;
     this._containmentEdges = profile.containmentEdges;
     /** @type{HeapSnapshotMetainfo} */
-    this._metaNode = profile.metaNode;
+    this._metaNode = profile.snapshot.meta;
     this._strings = profile.strings;
 
     this._init();