Title: [106738] trunk/Source/WebCore
Revision
106738
Author
[email protected]
Date
2012-02-04 02:20:07 -0800 (Sat, 04 Feb 2012)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106737 => 106738)


--- trunk/Source/WebCore/ChangeLog	2012-02-04 10:12:47 UTC (rev 106737)
+++ trunk/Source/WebCore/ChangeLog	2012-02-04 10:20:07 UTC (rev 106738)
@@ -1,3 +1,20 @@
+2012-02-03  Ilya Tikhonovsky  <[email protected]>
+
+        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  <[email protected]>
 
         Add the "JS" prefix to JSC specific IDL attributes

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js


(Binary files differ)

Modified: trunk/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js (106737 => 106738)


--- trunk/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js	2012-02-04 10:12:47 UTC (rev 106737)
+++ trunk/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js	2012-02-04 10:20:07 UTC (rev 106738)
@@ -328,7 +328,7 @@
         return this._shallowSize / this.dataGrid.snapshot.totalSize * 100.0;
     },
 
-    _updateHasChildren: function()
+    updateHasChildren: function()
     {
         function isEmptyCallback(isEmpty)
         {
@@ -359,7 +359,7 @@
 
 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 @@
     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 @@
     _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.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.HeapSnapshotGenericObjectNode.call(this, tree, node);
     this._provider = this._createProvider(tree.snapshot, node.nodeIndex);
-    this._updateHasChildren();
+    this.updateHasChildren();
 };
 
 WebInspector.HeapSnapshotDominatorObjectNode.prototype = {

Modified: trunk/Source/WebCore/inspector/front-end/profilesPanel.css (106737 => 106738)


--- trunk/Source/WebCore/inspector/front-end/profilesPanel.css	2012-02-04 10:12:47 UTC (rev 106737)
+++ trunk/Source/WebCore/inspector/front-end/profilesPanel.css	2012-02-04 10:20:07 UTC (rev 106738)
@@ -174,6 +174,10 @@
     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;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to