Title: [141272] trunk/Source/WebCore
Revision
141272
Author
[email protected]
Date
2013-01-30 08:12:32 -0800 (Wed, 30 Jan 2013)

Log Message

Web Inspector: remove NativeHeapGraph.js
https://bugs.webkit.org/show_bug.cgi?id=108342

Reviewed by Pavel Feldman.

NativeHeapGraph.js was removed as NativeHeapSnapshot.js provides more
features and shares its implementation with JSHeapSnapshot.

* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* inspector/compile-front-end.py:
* inspector/front-end/NativeHeapGraph.js: Removed.
* inspector/front-end/NativeMemorySnapshotView.js:
(WebInspector.NativeSnapshotProfileType.prototype.buttonClicked.didReceiveMemorySnapshot):
(WebInspector.NativeSnapshotProfileType.prototype.buttonClicked):
(WebInspector.NativeSnapshotProfileHeader.prototype.startSnapshotTransfer):
* inspector/front-end/ProfilesPanel.js:
* inspector/front-end/WebKit.qrc:

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (141271 => 141272)


--- trunk/Source/WebCore/ChangeLog	2013-01-30 15:33:02 UTC (rev 141271)
+++ trunk/Source/WebCore/ChangeLog	2013-01-30 16:12:32 UTC (rev 141272)
@@ -1,3 +1,24 @@
+2013-01-30  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: remove NativeHeapGraph.js
+        https://bugs.webkit.org/show_bug.cgi?id=108342
+
+        Reviewed by Pavel Feldman.
+
+        NativeHeapGraph.js was removed as NativeHeapSnapshot.js provides more
+        features and shares its implementation with JSHeapSnapshot.
+
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * inspector/compile-front-end.py:
+        * inspector/front-end/NativeHeapGraph.js: Removed.
+        * inspector/front-end/NativeMemorySnapshotView.js:
+        (WebInspector.NativeSnapshotProfileType.prototype.buttonClicked.didReceiveMemorySnapshot):
+        (WebInspector.NativeSnapshotProfileType.prototype.buttonClicked):
+        (WebInspector.NativeSnapshotProfileHeader.prototype.startSnapshotTransfer):
+        * inspector/front-end/ProfilesPanel.js:
+        * inspector/front-end/WebKit.qrc:
+
 2013-01-30  Vladislav Kaznacheev  <[email protected]>
 
         Web Inspector: Sidebar splitter is invisible in Elements and Sources panels

Modified: trunk/Source/WebCore/WebCore.gypi (141271 => 141272)


--- trunk/Source/WebCore/WebCore.gypi	2013-01-30 15:33:02 UTC (rev 141271)
+++ trunk/Source/WebCore/WebCore.gypi	2013-01-30 16:12:32 UTC (rev 141272)
@@ -5378,7 +5378,6 @@
             'inspector/front-end/HeapSnapshotView.js',
             'inspector/front-end/HeapSnapshotWorkerDispatcher.js',
             'inspector/front-end/JSHeapSnapshot.js',
-            'inspector/front-end/NativeHeapGraph.js',
             'inspector/front-end/NativeHeapSnapshot.js',
             'inspector/front-end/NativeMemorySnapshotView.js',
             'inspector/front-end/ProfileDataGridTree.js',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (141271 => 141272)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2013-01-30 15:33:02 UTC (rev 141271)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2013-01-30 16:12:32 UTC (rev 141272)
@@ -77289,10 +77289,6 @@
 					>
 				</File>
 				<File
-					RelativePath="..\inspector\front-end\NativeHeapGraph.js"
-					>
-				</File>
-				<File
 					RelativePath="..\inspector\front-end\NativeHeapSnapshot.js"
 					>
 				</File>

Modified: trunk/Source/WebCore/inspector/compile-front-end.py (141271 => 141272)


--- trunk/Source/WebCore/inspector/compile-front-end.py	2013-01-30 15:33:02 UTC (rev 141271)
+++ trunk/Source/WebCore/inspector/compile-front-end.py	2013-01-30 16:12:32 UTC (rev 141272)
@@ -339,7 +339,6 @@
             "HeapSnapshotWorker.js",
             "HeapSnapshotWorkerDispatcher.js",
             "JSHeapSnapshot.js",
-            "NativeHeapGraph.js",
             "NativeHeapSnapshot.js",
             "NativeMemorySnapshotView.js",
             "ProfileDataGridTree.js",

Deleted: trunk/Source/WebCore/inspector/front-end/NativeHeapGraph.js (141271 => 141272)


--- trunk/Source/WebCore/inspector/front-end/NativeHeapGraph.js	2013-01-30 15:33:02 UTC (rev 141271)
+++ trunk/Source/WebCore/inspector/front-end/NativeHeapGraph.js	2013-01-30 16:12:32 UTC (rev 141272)
@@ -1,247 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-/**
- * @constructor
- */
-WebInspector.NativeHeapGraph = function(rawGraph)
-{
-    this._rawGraph = rawGraph;
-
-    this._nodeFieldCount = 5;
-    this._nodeTypeOffset = 0;
-    this._nodeClassNameOffset = 1;
-    this._nodeNameOffset = 2;
-    this._nodeSizeOffset = 3;
-    this._nodeEdgeCountOffset = 4;
-    this._nodeFirstEdgeOffset = this._nodeEdgeCountOffset;
-
-    this._edgeFieldCount = 3;
-    this._edgeTypeOffset = 0;
-    this._edgeNameOffset = 1;
-    this._edgeTargetOffset = 2;
-
-    this._nodeCount = rawGraph.nodes.length / this._nodeFieldCount;
-    this._nodes = rawGraph.nodes;
-    this._edges = rawGraph.edges;
-    this._strings = rawGraph.strings;
-
-    this._rootNodeIndex = this._nodes.length - this._nodeFieldCount;
-    this._calculateNodeEdgeIndexes();
-    this._addDummyNode();
-}
-
-WebInspector.NativeHeapGraph.prototype = {
-    root: function()
-    {
-        return new WebInspector.NativeHeapGraph.Node(this, this._rootNodeIndex);
-    },
-
-    _calculateNodeEdgeIndexes: function()
-    {
-        var nodes = this._nodes;
-        var nodeFieldCount = this._nodeFieldCount;
-        var nodeLength = nodes.length;
-        var firstEdgeIndex = 0;
-        for (var i = this._nodeEdgeCountOffset; i < nodeLength; i += nodeFieldCount) {
-            var count = nodes[i];
-            nodes[i] = firstEdgeIndex;
-            firstEdgeIndex += count;
-        }
-    },
-
-    _addDummyNode: function()
-    {
-        var firstEdgePosition = this._nodes.length + this._nodeFirstEdgeOffset;
-        for (var i = 0; i < this._nodeFieldCount; i++)
-            this._nodes.push(0);
-        this._nodes[firstEdgePosition] = this._edges.length / this._edgeFieldCount;
-    }
-}
-
-
-/**
- * @constructor
- * @param {WebInspector.NativeHeapGraph} graph
- * @param {number} position
- */
-WebInspector.NativeHeapGraph.Edge = function(graph, position)
-{
-    this._graph = graph;
-    this._position = position;
-}
-
-WebInspector.NativeHeapGraph.Edge.prototype = {
-    type: function()
-    {
-        return this._getStringField(this._graph._edgeTypeOffset);
-    },
-
-    name: function()
-    {
-        return this._getStringField(this._graph._edgeNameOffset);
-    },
-
-    target: function()
-    {
-        var edges = this._graph._edges;
-        var targetPosition = edges[this._position + this._graph._edgeTargetOffset];
-        return new WebInspector.NativeHeapGraph.Node(this._graph, targetPosition);
-    },
-
-    _getStringField: function(offset)
-    {
-        var typeIndex = this._graph._edges[this._position + offset];
-        return this._graph._rawGraph.strings[typeIndex];
-    },
-
-    toString: function()
-    {
-        return "Edge#" + this._position + " -" + this.name() + "-> " + this.target();
-    }
-
-}
-
-
-/**
- * @constructor
- * @param {WebInspector.NativeHeapGraph} graph
- * @param {number} position
- */
-WebInspector.NativeHeapGraph.Node = function(graph, position)
-{
-    this._graph = graph;
-    this._position = position;
-}
-
-WebInspector.NativeHeapGraph.Node.prototype = {
-    id: function()
-    {
-        return this._position / this._graph._nodeFieldCount;
-    },
-
-    type: function()
-    {
-        return this._getStringField(this._graph._nodeTypeOffset);
-    },
-
-    size: function()
-    {
-        return this._graph._nodes[this._position + this._graph._nodeSizeOffset];
-    },
-
-    className: function()
-    {
-        return this._getStringField(this._graph._nodeClassNameOffset);
-    },
-
-    name: function()
-    {
-        return this._getStringField(this._graph._nodeNameOffset);
-    },
-
-    hasReferencedNodes: function()
-    {
-        return this._afterLastEdgePosition() > this._firstEdgePoistion();
-    },
-
-    referencedNodes: function()
-    {
-        var edges = this._graph._edges;
-        var nodes = this._graph._nodes;
-        var edgeFieldCount = this._graph._edgeFieldCount;
-        var nodeFieldCount = this._graph._nodeFieldCount;
-
-        var firstEdgePosition = this._firstEdgePoistion();
-        var afterLastEdgePosition = this._afterLastEdgePosition();
-        var result = [];
-        for (var i = firstEdgePosition + this._graph._edgeTargetOffset; i < afterLastEdgePosition; i += edgeFieldCount)
-            result.push(new WebInspector.NativeHeapGraph.Node(this._graph, edges[i]));
-        return result;
-    },
-
-    outgoingEdges: function()
-    {
-        var edges = this._graph._edges;
-        var edgeFieldCount = this._graph._edgeFieldCount;
-
-        var firstEdgePosition = this._firstEdgePoistion();
-        var afterLastEdgePosition = this._afterLastEdgePosition();
-        var result = [];
-        for (var i = firstEdgePosition; i < afterLastEdgePosition; i += edgeFieldCount)
-            result.push(new WebInspector.NativeHeapGraph.Edge(this._graph, i));
-        return result;
-    },
-
-    targetOfEdge: function(edgeName)
-    {
-        return this.targetsOfAllEdges(edgeName)[0];
-    },
-
-    targetsOfAllEdges: function(edgeName)
-    {
-        var edges = this._graph._edges;
-        var edgeFieldCount = this._graph._edgeFieldCount;
-
-        var firstEdgePosition = this._firstEdgePoistion();
-        var afterLastEdgePosition = this._afterLastEdgePosition();
-
-        var edge = new WebInspector.NativeHeapGraph.Edge(this._graph, firstEdgePosition)
-        var result = [];
-        for (var i = firstEdgePosition; i < afterLastEdgePosition; i += edgeFieldCount) {
-            edge._position = i;
-            if (edge.name() === edgeName)
-                result.push(edge.target());
-        }
-        return result;
-    },
-
-    _firstEdgePoistion: function()
-    {
-        return this._graph._nodes[this._position + this._graph._nodeFirstEdgeOffset] * this._graph._edgeFieldCount;
-    },
-
-    _afterLastEdgePosition: function()
-    {
-        return this._graph._nodes[this._position + this._graph._nodeFieldCount + this._graph._nodeFirstEdgeOffset] * this._graph._edgeFieldCount;
-    },
-
-    _getStringField: function(offset)
-    {
-        var typeIndex = this._graph._nodes[this._position + offset];
-        return this._graph._rawGraph.strings[typeIndex];
-    },
-
-    toString: function()
-    {
-        return "Node#" + this.id() + " " + this.name() + "(" + this.className() + ")";
-    }
-}

Modified: trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js (141271 => 141272)


--- trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js	2013-01-30 15:33:02 UTC (rev 141271)
+++ trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js	2013-01-30 16:12:32 UTC (rev 141272)
@@ -271,7 +271,7 @@
          */
         function didReceiveMemorySnapshot(error, memoryBlock, graph)
         {
-            profileHeader._graph = new WebInspector.NativeHeapGraph(graph);
+            profileHeader._graph = graph;
             profileHeader.isTemporary = false;
             profileHeader.sidebarElement.subtitle = Number.bytesToString(/** @type{number} */(memoryBlock.size));
         }
@@ -338,7 +338,69 @@
 
     startSnapshotTransfer: function()
     {
-        setTimeout(this._takeNativeSnapshot.bind(this), 0);
+        var meta = {
+          "node_fields": [
+            "type",
+            "name",
+            "id",
+            "self_size",
+            "edge_count"
+          ],
+          "node_types": [
+            [
+              "hidden",
+              "array",
+              "string",
+              "object",
+              "code",
+              "closure",
+              "regexp",
+              "number",
+              "native",
+              "synthetic"
+            ],
+            "string",
+            "number",
+            "number",
+            "number",
+            "number",
+            "number"
+          ],
+          "edge_fields": [
+            "type",
+            "name_or_index",
+            "to_node"
+          ],
+          "edge_types": [
+            [
+              "context",
+              "element",
+              "property",
+              "internal",
+              "hidden",
+              "shortcut",
+              "weak"
+            ],
+            "string_or_number",
+            "node"
+          ]
+        };
+        var graph = this._graph;
+        var heapSnapshot = {
+            "snapshot": {
+                "meta": meta,
+                node_count: graph.nodes.length / 5,
+                edge_count: graph.edges.length / 3,
+                root_index: graph.nodes.length - 5
+            },
+            nodes: graph.nodes,
+            edges: graph.edges,
+            strings: graph.strings
+        };
+
+        var chunk = JSON.stringify(heapSnapshot);
+        this.transferChunk(chunk);
+        this.finishHeapSnapshot();
     },
 
     snapshotConstructorName: function()
@@ -346,82 +408,6 @@
         return "NativeHeapSnapshot";
     },
 
-    _takeNativeSnapshot: function()
-    {
-        /**
-         * @param {?string} error
-         * @param {?MemoryAgent.MemoryBlock} memoryBlock
-         * @param {?Object=} graph
-         */
-        function didReceiveMemorySnapshot(error, memoryBlock, graph)
-        {
-            var meta = {
-              "node_fields": [
-                "type",
-                "name",
-                "id",
-                "self_size",
-                "edge_count"
-              ],
-              "node_types": [
-                [
-                  "hidden",
-                  "array",
-                  "string",
-                  "object",
-                  "code",
-                  "closure",
-                  "regexp",
-                  "number",
-                  "native",
-                  "synthetic"
-                ],
-                "string",
-                "number",
-                "number",
-                "number",
-                "number",
-                "number"
-              ],
-              "edge_fields": [
-                "type",
-                "name_or_index",
-                "to_node"
-              ],
-              "edge_types": [
-                [
-                  "context",
-                  "element",
-                  "property",
-                  "internal",
-                  "hidden",
-                  "shortcut",
-                  "weak"
-                ],
-                "string_or_number",
-                "node"
-              ]
-            };
-            var heapSnapshot = {
-                "snapshot": {
-                    "meta": meta,
-                    node_count: graph.nodes.length / 5,
-                    edge_count: graph.edges.length / 3,
-                    root_index: graph.nodes.length - 5
-                },
-                nodes: graph.nodes,
-                edges: graph.edges,
-                strings: graph.strings
-            };
-
-            var chunk = JSON.stringify(heapSnapshot);
-            this.transferChunk(chunk);
-            this.finishHeapSnapshot();
-        }
-        MemoryAgent.getProcessMemoryDistribution(true, didReceiveMemorySnapshot.bind(this));
-
-    },
-
     __proto__: WebInspector.HeapProfileHeader.prototype
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js (141271 => 141272)


--- trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js	2013-01-30 15:33:02 UTC (rev 141271)
+++ trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js	2013-01-30 16:12:32 UTC (rev 141272)
@@ -1414,7 +1414,6 @@
 importScript("HeapSnapshotView.js");
 importScript("HeapSnapshotWorkerDispatcher.js");
 importScript("JSHeapSnapshot.js");
-importScript("NativeHeapGraph.js");
 importScript("NativeHeapSnapshot.js");
 importScript("NativeMemorySnapshotView.js");
 importScript("ProfileLauncherView.js");

Modified: trunk/Source/WebCore/inspector/front-end/WebKit.qrc (141271 => 141272)


--- trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2013-01-30 15:33:02 UTC (rev 141271)
+++ trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2013-01-30 16:12:32 UTC (rev 141272)
@@ -113,7 +113,6 @@
     <file>MemoryStatistics.js</file>
     <file>MetricsSidebarPane.js</file>
     <file>NativeBreakpointsSidebarPane.js</file>
-    <file>NativeHeapGraph.js</file>
     <file>NativeHeapSnapshot.js</file>
     <file>NativeMemorySnapshotView.js</file>
     <file>NavigatorOverlayController.js</file>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to