Web Inspector: get rid of cycles in retaining tree
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Feb 2012 10:20:07 +0000 (10:20 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Feb 2012 10:20:07 +0000 (10:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=77801

Drive by fix: 'retained by' prefix was removed.

Reviewed by Yury Semikhatsky.

* inspector/front-end/DetailedHeapshotGridNodes.js:
(WebInspector.HeapSnapshotObjectNode):
(WebInspector.HeapSnapshotObjectNode.prototype._updateHasChildren):
(WebInspector.HeapSnapshotObjectNode.prototype._createChildNode):
(WebInspector.HeapSnapshotObjectNode.prototype._prefixObjectCell):
* inspector/front-end/profilesPanel.css:
(.cycled-ancessor-node):

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

Source/WebCore/ChangeLog
Source/WebCore/English.lproj/localizedStrings.js
Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js
Source/WebCore/inspector/front-end/profilesPanel.css

index 7561bdf9077890abddb2a1ab5691332816c8d724..11ed763255fa3e8dd84f5ae372eeedbf9f50e2f5 100644 (file)
@@ -1,3 +1,20 @@
+2012-02-03  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: get rid of cycles in retaining tree
+        https://bugs.webkit.org/show_bug.cgi?id=77801
+
+        Drive by fix: 'retained by' prefix was removed.
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/DetailedHeapshotGridNodes.js:
+        (WebInspector.HeapSnapshotObjectNode):
+        (WebInspector.HeapSnapshotObjectNode.prototype._updateHasChildren):
+        (WebInspector.HeapSnapshotObjectNode.prototype._createChildNode):
+        (WebInspector.HeapSnapshotObjectNode.prototype._prefixObjectCell):
+        * inspector/front-end/profilesPanel.css:
+        (.cycled-ancessor-node):
+
 2012-02-04  Kentaro Hara  <haraken@chromium.org>
 
         Add the "JS" prefix to JSC specific IDL attributes
index cdae270c93952a1e946319e0b5767d0c2ba136a6..2abdf86946bd7f907867114ee08e35b03d8e5333 100644 (file)
Binary files a/Source/WebCore/English.lproj/localizedStrings.js and b/Source/WebCore/English.lproj/localizedStrings.js differ
index 93333568e9b735008530ef1025f71ce82d333851..47a71806a34312ef812b37555302d993a9359610 100644 (file)
@@ -328,7 +328,7 @@ WebInspector.HeapSnapshotGenericObjectNode.prototype = {
         return this._shallowSize / this.dataGrid.snapshot.totalSize * 100.0;
     },
 
-    _updateHasChildren: function()
+    updateHasChildren: function()
     {
         function isEmptyCallback(isEmpty)
         {
@@ -359,7 +359,7 @@ WebInspector.HeapSnapshotGenericObjectNode.prototype = {
 
 WebInspector.HeapSnapshotGenericObjectNode.prototype.__proto__ = WebInspector.HeapSnapshotGridNode.prototype;
 
-WebInspector.HeapSnapshotObjectNode = function(tree, isFromBaseSnapshot, edge)
+WebInspector.HeapSnapshotObjectNode = function(tree, isFromBaseSnapshot, edge, parentGridNode)
 {
     WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, edge.node);
     this._referenceName = edge.name;
@@ -368,13 +368,29 @@ WebInspector.HeapSnapshotObjectNode = function(tree, isFromBaseSnapshot, edge)
     this._retainerNode = tree.showRetainingEdges;
     this._isFromBaseSnapshot = isFromBaseSnapshot;
     this._provider = this._createProvider(!isFromBaseSnapshot ? tree.snapshot : tree.baseSnapshot, edge.nodeIndex, tree);
-    this._updateHasChildren();
+    this.updateHasChildren(parentGridNode);
 }
 
 WebInspector.HeapSnapshotObjectNode.prototype = {
+    updateHasChildren: function(parentGridNode)
+    {
+        if (this._retainerNode) {
+            this._parentGridNode = parentGridNode;
+            var ancestor = parentGridNode;
+            while (ancestor) {
+                if (ancestor.snapshotNodeId === this.snapshotNodeId) {
+                    this._cycledWithAncestorGridNode = ancestor;
+                    return;
+                }
+                ancestor = ancestor._parentGridNode;
+            }
+        }
+        WebInspector.HeapSnapshotGenericObjectNode.prototype.updateHasChildren.call(this);
+    },
+
     _createChildNode: function(item)
     {
-        return new WebInspector.HeapSnapshotObjectNode(this.dataGrid, this._isFromBaseSnapshot, item);
+        return new WebInspector.HeapSnapshotObjectNode(this.dataGrid, this._isFromBaseSnapshot, item, this);
     },
 
     _createProvider: function(snapshot, nodeIndex, tree)
@@ -440,9 +456,8 @@ WebInspector.HeapSnapshotObjectNode.prototype = {
     _prefixObjectCell: function(div, data)
     {
         if (this._retainerNode) {
-            var prefixSpan = document.createElement("span");
-            prefixSpan.textContent = WebInspector.UIString("retained by ");
-            div.appendChild(prefixSpan);
+            if (this._cycledWithAncestorGridNode)
+                div.className += " cycled-ancessor-node";
             return;
         }
 
@@ -475,7 +490,7 @@ WebInspector.HeapSnapshotInstanceNode = function(tree, baseSnapshot, snapshot, n
     WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, node);
     this._isDeletedNode = !!baseSnapshot;
     this._provider = this._createProvider(baseSnapshot || snapshot, node.nodeIndex);
-    this._updateHasChildren();
+    this.updateHasChildren();
 };
 
 WebInspector.HeapSnapshotInstanceNode.prototype = {
@@ -805,7 +820,7 @@ WebInspector.HeapSnapshotDominatorObjectNode = function(tree, node)
 {
     WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, node);
     this._provider = this._createProvider(tree.snapshot, node.nodeIndex);
-    this._updateHasChildren();
+    this.updateHasChildren();
 };
 
 WebInspector.HeapSnapshotDominatorObjectNode.prototype = {
index 10f6b49fedf37b5d7585ea9ffa3cae81c7a23bdd..7faec3b2d23221e050fb557a05704d49f7ec7099 100644 (file)
     margin-left: 22px;
 }
 
+.cycled-ancessor-node {
+    color: lightgray;
+}
+
 .panel-enabler-view.profile-launcher-view button:not(.status-bar-item) {
     color: rgb(6, 6, 6);
     margin: 16px 0;