Title: [140953] trunk
Revision
140953
Author
yu...@chromium.org
Date
2013-01-28 01:21:57 -0800 (Mon, 28 Jan 2013)

Log Message

Web Inspector: remove unused isElement and similar methods from HeapProfiler
https://bugs.webkit.org/show_bug.cgi?id=107940

Reviewed by Vsevolod Vlasov.

Source/WebCore:

- Removed some unused methods.
- Moved JS specific edge filters to JSHeapSnapshot.

* inspector/front-end/HeapSnapshot.js:
(WebInspector.HeapSnapshot.prototype.createEdgesProvider):
(WebInspector.HeapSnapshot.prototype.createEdgesProviderForTest):
(WebInspector.HeapSnapshot.prototype.retainingEdgesFilter):
(WebInspector.HeapSnapshot.prototype.containmentEdgesFilter):
(WebInspector.HeapSnapshot.prototype.createRetainingEdgesProvider):
(WebInspector.HeapSnapshot.prototype.classNodesFilter):
(WebInspector.HeapSnapshot.prototype.createNodesProviderForClass):
* inspector/front-end/HeapSnapshotGridNodes.js:
(WebInspector.HeapSnapshotGenericObjectNode):
* inspector/front-end/HeapSnapshotProxy.js:
(WebInspector.HeapSnapshotProxy.prototype.createEdgesProvider):
(WebInspector.HeapSnapshotProxy.prototype.createRetainingEdgesProvider):
* inspector/front-end/JSHeapSnapshot.js:
(WebInspector.JSHeapSnapshot.prototype.classNodesFilter):
(WebInspector.JSHeapSnapshot.prototype._markDetachedDOMTreeNodes):
* inspector/front-end/NativeHeapSnapshot.js:

LayoutTests:

* inspector/profiler/heap-snapshot.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (140952 => 140953)


--- trunk/LayoutTests/ChangeLog	2013-01-28 09:02:32 UTC (rev 140952)
+++ trunk/LayoutTests/ChangeLog	2013-01-28 09:21:57 UTC (rev 140953)
@@ -1,3 +1,12 @@
+2013-01-25  Yury Semikhatsky  <yu...@chromium.org>
+
+        Web Inspector: remove unused isElement and similar methods from HeapProfiler
+        https://bugs.webkit.org/show_bug.cgi?id=107940
+
+        Reviewed by Vsevolod Vlasov.
+
+        * inspector/profiler/heap-snapshot.html:
+
 2013-01-27  Keishi Hattori  <kei...@webkit.org>
 
         [Chromium] Marking two fast/forms tests as slow on debug mac.

Modified: trunk/LayoutTests/inspector/profiler/heap-snapshot.html (140952 => 140953)


--- trunk/LayoutTests/inspector/profiler/heap-snapshot.html	2013-01-28 09:02:32 UTC (rev 140952)
+++ trunk/LayoutTests/inspector/profiler/heap-snapshot.html	2013-01-28 09:21:57 UTC (rev 140953)
@@ -312,7 +312,7 @@
                 return edge.name() === "b";
             }
          
-            var provider = snapshot.createEdgesProvider(snapshot.rootNodeIndex, edgeFilter);
+            var provider = snapshot.createEdgesProviderForTest(snapshot.rootNodeIndex, edgeFilter);
             InspectorTest.assertEquals(1, provider.length, "edges provider length");
             provider.sort(WebInspector.HeapSnapshotFilteredOrderedIterator.prototype.createComparator(["!edgeName", false, "id", false]), 0, 0, 1);
             InspectorTest.assertEquals(1, provider.length, "edges provider length");

Modified: trunk/Source/WebCore/ChangeLog (140952 => 140953)


--- trunk/Source/WebCore/ChangeLog	2013-01-28 09:02:32 UTC (rev 140952)
+++ trunk/Source/WebCore/ChangeLog	2013-01-28 09:21:57 UTC (rev 140953)
@@ -1,3 +1,31 @@
+2013-01-25  Yury Semikhatsky  <yu...@chromium.org>
+
+        Web Inspector: remove unused isElement and similar methods from HeapProfiler
+        https://bugs.webkit.org/show_bug.cgi?id=107940
+
+        Reviewed by Vsevolod Vlasov.
+
+        - Removed some unused methods.
+        - Moved JS specific edge filters to JSHeapSnapshot.
+
+        * inspector/front-end/HeapSnapshot.js:
+        (WebInspector.HeapSnapshot.prototype.createEdgesProvider):
+        (WebInspector.HeapSnapshot.prototype.createEdgesProviderForTest):
+        (WebInspector.HeapSnapshot.prototype.retainingEdgesFilter):
+        (WebInspector.HeapSnapshot.prototype.containmentEdgesFilter):
+        (WebInspector.HeapSnapshot.prototype.createRetainingEdgesProvider):
+        (WebInspector.HeapSnapshot.prototype.classNodesFilter):
+        (WebInspector.HeapSnapshot.prototype.createNodesProviderForClass):
+        * inspector/front-end/HeapSnapshotGridNodes.js:
+        (WebInspector.HeapSnapshotGenericObjectNode):
+        * inspector/front-end/HeapSnapshotProxy.js:
+        (WebInspector.HeapSnapshotProxy.prototype.createEdgesProvider):
+        (WebInspector.HeapSnapshotProxy.prototype.createRetainingEdgesProvider):
+        * inspector/front-end/JSHeapSnapshot.js:
+        (WebInspector.JSHeapSnapshot.prototype.classNodesFilter):
+        (WebInspector.JSHeapSnapshot.prototype._markDetachedDOMTreeNodes):
+        * inspector/front-end/NativeHeapSnapshot.js:
+
 2013-01-28  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r140554.

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js (140952 => 140953)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2013-01-28 09:02:32 UTC (rev 140952)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2013-01-28 09:21:57 UTC (rev 140953)
@@ -316,11 +316,6 @@
 }
 
 WebInspector.HeapSnapshotNode.prototype = {
-    isUserObject: function()
-    {
-        return true;
-    },
-
     distance: function()
     {
         return this._snapshot._nodeDistances[this.nodeIndex / this._snapshot._nodeFieldCount];
@@ -1365,18 +1360,36 @@
         return parsedFilter.bind(this);
     },
 
-    createEdgesProvider: function(nodeIndex, filter)
+    createEdgesProvider: function(nodeIndex, showHiddenData)
     {
         var node = this.createNode(nodeIndex);
-        return new WebInspector.HeapSnapshotEdgesProvider(this, this._parseFilter(filter), node.edges());
+        var filter = this.containmentEdgesFilter(showHiddenData);
+        return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edges());
     },
 
-    createRetainingEdgesProvider: function(nodeIndex, filter)
+    createEdgesProviderForTest: function(nodeIndex, filter)
     {
         var node = this.createNode(nodeIndex);
-        return new WebInspector.HeapSnapshotEdgesProvider(this, this._parseFilter(filter), node.retainers());
+        return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edges());
     },
 
+    retainingEdgesFilter: function(showHiddenData)
+    {
+        return null;
+    },
+
+    containmentEdgesFilter: function(showHiddenData)
+    {
+        return null;
+    },
+
+    createRetainingEdgesProvider: function(nodeIndex, showHiddenData)
+    {
+        var node = this.createNode(nodeIndex);
+        var filter = this.retainingEdgesFilter(showHiddenData);
+        return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.retainers());
+    },
+
     createAddedNodesProvider: function(baseSnapshotId, className)
     {
         var snapshotDiff = this._snapshotDiffs[baseSnapshotId];
@@ -1389,12 +1402,14 @@
         return new WebInspector.HeapSnapshotNodesProvider(this, null, nodeIndexes);
     },
 
+    classNodesFilter: function()
+    {
+        return null;
+    },
+
     createNodesProviderForClass: function(className, aggregatesKey)
     {
-        function filter(node) {
-            return node.isUserObject();
-        }
-        return new WebInspector.HeapSnapshotNodesProvider(this, filter, this.aggregates(false, aggregatesKey)[className].idxs);
+        return new WebInspector.HeapSnapshotNodesProvider(this, this.classNodesFilter(), this.aggregates(false, aggregatesKey)[className].idxs);
     },
 
     createNodesProviderForDominator: function(nodeIndex)

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js (140952 => 140953)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js	2013-01-28 09:02:32 UTC (rev 140952)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js	2013-01-28 09:21:57 UTC (rev 140953)
@@ -358,7 +358,7 @@
     this.snapshotNodeIndex = node.nodeIndex;
     if (this._type === "string")
         this._reachableFromWindow = true;
-    else if (this._type === "object" && this.isWindow(this._name)) {
+    else if (this._type === "object" && this._name.startsWith("Window")) {
         this._name = this.shortenWindowURL(this._name, false);
         this._reachableFromWindow = true;
     } else if (node.canBeQueried)
@@ -488,11 +488,6 @@
         this._provider().isEmpty(isEmptyCallback.bind(this));
     },
 
-    isWindow: function(fullName)
-    {
-        return fullName.substr(0, 9) === "Window";
-    },
-
     shortenWindowURL: function(fullName, hasObjectId)
     {
         var startPos = fullName.indexOf("/");
@@ -539,16 +534,11 @@
     {
         var tree = this._dataGrid;
         var showHiddenData = WebInspector.settings.showHeapSnapshotObjectsHiddenProperties.get();
-        var filter = "function(edge) {\n" +
-                     "    return !edge.isInvisible()\n" +
-                     "        && (" + !tree.showRetainingEdges + " || (edge.node().id() !== 1 && !edge.node().isSynthetic() && !edge.isWeak()))\n" +
-                     "        && (" + showHiddenData + " || (!edge.isHidden() && !edge.node().isHidden()));\n" +
-                     "}\n";
         var snapshot = this._isFromBaseSnapshot ? tree.baseSnapshot : tree.snapshot;
         if (this.showRetainingEdges)
-            return snapshot.createRetainingEdgesProvider(this.snapshotNodeIndex, filter);
+            return snapshot.createRetainingEdgesProvider(this.snapshotNodeIndex, showHiddenData);
         else
-            return snapshot.createEdgesProvider(this.snapshotNodeIndex, filter);
+            return snapshot.createEdgesProvider(this.snapshotNodeIndex, showHiddenData);
     },
 
     _findAncestorWithSameSnapshotNodeId: function()
@@ -658,10 +648,7 @@
         var showHiddenData = WebInspector.settings.showHeapSnapshotObjectsHiddenProperties.get();
         return this._baseSnapshotOrSnapshot.createEdgesProvider(
             this.snapshotNodeIndex,
-            "function(edge) {" +
-            "    return !edge.isInvisible()" +
-            "        && (" + showHiddenData + " || (!edge.isHidden() && !edge.node().isHidden()));" +
-            "}");
+            showHiddenData);
     },
 
     _createChildNode: function(item)

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js (140952 => 140953)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js	2013-01-28 09:02:32 UTC (rev 140952)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js	2013-01-28 09:21:57 UTC (rev 140953)
@@ -443,14 +443,14 @@
         this.callMethod(callback, "dominatorIdsForNode", nodeIndex);
     },
 
-    createEdgesProvider: function(nodeIndex, filter)
+    createEdgesProvider: function(nodeIndex, showHiddenData)
     {
-        return this.callFactoryMethod(null, "createEdgesProvider", "WebInspector.HeapSnapshotProviderProxy", nodeIndex, filter);
+        return this.callFactoryMethod(null, "createEdgesProvider", "WebInspector.HeapSnapshotProviderProxy", nodeIndex, showHiddenData);
     },
 
-    createRetainingEdgesProvider: function(nodeIndex, filter)
+    createRetainingEdgesProvider: function(nodeIndex, showHiddenData)
     {
-        return this.callFactoryMethod(null, "createRetainingEdgesProvider", "WebInspector.HeapSnapshotProviderProxy", nodeIndex, filter);
+        return this.callFactoryMethod(null, "createRetainingEdgesProvider", "WebInspector.HeapSnapshotProviderProxy", nodeIndex, showHiddenData);
     },
 
     createAddedNodesProvider: function(baseSnapshotId, className)

Modified: trunk/Source/WebCore/inspector/front-end/JSHeapSnapshot.js (140952 => 140953)


--- trunk/Source/WebCore/inspector/front-end/JSHeapSnapshot.js	2013-01-28 09:02:32 UTC (rev 140952)
+++ trunk/Source/WebCore/inspector/front-end/JSHeapSnapshot.js	2013-01-28 09:21:57 UTC (rev 140953)
@@ -61,6 +61,38 @@
         return new WebInspector.JSHeapSnapshotRetainerEdge(this, retainedNodeIndex, retainerIndex);
     },
 
+    classNodesFilter: function()
+    {
+        function filter(node)
+        {
+            return node.isUserObject();
+        }
+        return filter;
+    },
+
+    containmentEdgesFilter: function(showHiddenData)
+    {
+        function filter(edge) {
+            if (edge.isInvisible())
+                return false;
+            if (showHiddenData)
+                return true;
+            return !edge.isHidden() && !edge.node().isHidden();
+        }
+        return filter;
+    },
+
+    retainingEdgesFilter: function(showHiddenData)
+    {
+        var containmentEdgesFilter = this.containmentEdgesFilter(showHiddenData);
+        function filter(edge) {
+            if (!containmentEdgesFilter(edge))
+                return false;
+            return edge.node().id() !== 1 && !edge.node().isSynthetic() && !edge.isWeak();
+        }
+        return filter;
+    },
+
     dispose: function()
     {
         WebInspector.HeapSnapshot.prototype.dispose.call(this);
@@ -130,7 +162,7 @@
         var detachedDOMTreesRoot;
         for (var iter = this.rootNode().edges(); iter.hasNext(); iter.next()) {
             var node = iter.edge.node();
-            if (node.isDetachedDOMTreesRoot()) {
+            if (node.name() === "(Detached DOM trees)") {
                 detachedDOMTreesRoot = node;
                 break;
             }
@@ -139,9 +171,10 @@
         if (!detachedDOMTreesRoot)
             return;
 
+        var detachedDOMTreeRE = /^Detached DOM tree/;
         for (var iter = detachedDOMTreesRoot.edges(); iter.hasNext(); iter.next()) {
             var node = iter.edge.node();
-            if (node.isDetachedDOMTree()) {
+            if (detachedDOMTreeRE.test(node.className())) {
                 for (var edgesIter = node.edges(); edgesIter.hasNext(); edgesIter.next())
                     this._flags[edgesIter.edge.node().nodeIndex / this._nodeFieldCount] |= flag;
             }
@@ -332,22 +365,11 @@
         return windowRE.test(this.name());
     },
 
-    isDetachedDOMTreesRoot: function()
-    {
-        return this.name() === "(Detached DOM trees)";
-    },
-
     isDocumentDOMTreesRoot: function()
     {
         return this.isSynthetic() && this.name() === "(Document DOM trees)";
     },
 
-    isDetachedDOMTree: function()
-    {
-        const detachedDOMTreeRE = /^Detached DOM tree/;
-        return detachedDOMTreeRE.test(this.className());
-    },
-
     serialize: function()
     {
         var result = WebInspector.HeapSnapshotNode.prototype.serialize.call(this);
@@ -487,11 +509,6 @@
         return new WebInspector.JSHeapSnapshotRetainerEdge(this._snapshot, this._retainedNodeIndex, this.retainerIndex());
     },
 
-    isElement: function()
-    {
-        return this._edge().isElement();
-    },
-
     isHidden: function()
     {
         return this._edge().isHidden();

Modified: trunk/Source/WebCore/inspector/front-end/NativeHeapSnapshot.js (140952 => 140953)


--- trunk/Source/WebCore/inspector/front-end/NativeHeapSnapshot.js	2013-01-28 09:02:32 UTC (rev 140952)
+++ trunk/Source/WebCore/inspector/front-end/NativeHeapSnapshot.js	2013-01-28 09:21:57 UTC (rev 140953)
@@ -61,11 +61,6 @@
     {
     },
 
-    canHaveDistanceOne: function(node)
-    {
-        return true;
-    },
-
     userObjectsMapAndFlag: function()
     {
         return null;
@@ -86,16 +81,6 @@
 }
 
 WebInspector.NativeHeapSnapshotNode.prototype = {
-    canBeQueried: function()
-    {
-        return false;
-    },
-
-    isUserObject: function()
-    {
-        return true;
-    },
-
     className: function()
     {
         return this._snapshot._strings[this.classIndex()];
@@ -128,21 +113,6 @@
         return false;
     },
 
-    isWindow: function()
-    {
-        return false;
-    },
-
-    isDetachedDOMTreesRoot: function()
-    {
-        return false;
-    },
-
-    isDetachedDOMTree: function()
-    {
-        return false;
-    },
-
     __proto__: WebInspector.HeapSnapshotNode.prototype
 };
 
@@ -169,11 +139,6 @@
         return true;
     },
 
-    isElement: function()
-    {
-        return false;
-    },
-
     isHidden: function()
     {
         return false;
@@ -234,11 +199,6 @@
         return new WebInspector.NativeHeapSnapshotRetainerEdge(this._snapshot, this._retainedNodeIndex, this.retainerIndex());
     },
 
-    isElement: function()
-    {
-        return this._edge().isElement();
-    },
-
     isHidden: function()
     {
         return this._edge().isHidden();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to