Title: [111512] trunk
Revision
111512
Author
[email protected]
Date
2012-03-21 02:14:01 -0700 (Wed, 21 Mar 2012)

Log Message

Web Inspector: HeapProfiler: support distance column in Summary View.
https://bugs.webkit.org/show_bug.cgi?id=81675

In many cases when a page leaked an object we see not only this object
but the all objects it retains. It is quite difficult to find out which
the object is the root of leak. It'd be simpler to sort the leaked
objects by Distance column and track down the first one.

Reviewed by Yury Semikhatsky.

Source/WebCore:

* inspector/front-end/DetailedHeapshotGridNodes.js:
(WebInspector.HeapSnapshotGenericObjectNode):
(WebInspector.HeapSnapshotGenericObjectNode.prototype.get data):
(WebInspector.HeapSnapshotInstanceNode.prototype.comparator):
(WebInspector.HeapSnapshotConstructorNode):
(WebInspector.HeapSnapshotConstructorNode.prototype.comparator):
(WebInspector.HeapSnapshotConstructorNode.prototype.get data):
* inspector/front-end/DetailedHeapshotView.js:
(WebInspector.HeapSnapshotConstructorsDataGrid):
(WebInspector.HeapSnapshotConstructorsDataGrid.prototype._defaultPopulateCount.100._sortFields):
* inspector/front-end/HeapSnapshot.js:
(WebInspector.HeapSnapshotNodesProvider.prototype._serialize):

LayoutTests:

* inspector/profiler/detailed-heapshots-summary-sorting.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (111511 => 111512)


--- trunk/LayoutTests/ChangeLog	2012-03-21 08:56:53 UTC (rev 111511)
+++ trunk/LayoutTests/ChangeLog	2012-03-21 09:14:01 UTC (rev 111512)
@@ -1,3 +1,17 @@
+2012-03-21  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: HeapProfiler: support distance column in Summary View.
+        https://bugs.webkit.org/show_bug.cgi?id=81675
+
+        In many cases when a page leaked an object we see not only this object
+        but the all objects it retains. It is quite difficult to find out which
+        the object is the root of leak. It'd be simpler to sort the leaked
+        objects by Distance column and track down the first one.
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/profiler/detailed-heapshots-summary-sorting.html:
+
 2012-03-21  Keishi Hattori  <[email protected]>
 
         [chromium] Marking lost-compositor-context-permanently.html on WIN as flaky.

Modified: trunk/LayoutTests/inspector/profiler/detailed-heapshots-summary-sorting.html (111511 => 111512)


--- trunk/LayoutTests/inspector/profiler/detailed-heapshots-summary-sorting.html	2012-03-21 08:56:53 UTC (rev 111511)
+++ trunk/LayoutTests/inspector/profiler/detailed-heapshots-summary-sorting.html	2012-03-21 09:14:01 UTC (rev 111512)
@@ -49,7 +49,7 @@
                 columns[currentColumn] = newColumnState;
                 var contents = InspectorTest.columnContents(columns[currentColumn]);
                 InspectorTest.assertEquals(true, !!contents.length, "column contents");
-                var sortTypes = { object: "text", count: "number", shallowSize: "size", retainedSize: "size" };
+                var sortTypes = { object: "text", distanceToWindow: "number", count: "number", shallowSize: "size", retainedSize: "size" };
                 InspectorTest.assertEquals(true, !!sortTypes[columns[currentColumn].identifier], "sort by identifier");
                 InspectorTest.checkArrayIsSorted(contents, sortTypes[columns[currentColumn].identifier], columns[currentColumn].sort);
 

Modified: trunk/Source/WebCore/ChangeLog (111511 => 111512)


--- trunk/Source/WebCore/ChangeLog	2012-03-21 08:56:53 UTC (rev 111511)
+++ trunk/Source/WebCore/ChangeLog	2012-03-21 09:14:01 UTC (rev 111512)
@@ -1,3 +1,28 @@
+2012-03-21  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: HeapProfiler: support distance column in Summary View.
+        https://bugs.webkit.org/show_bug.cgi?id=81675
+
+        In many cases when a page leaked an object we see not only this object
+        but the all objects it retains. It is quite difficult to find out which
+        the object is the root of leak. It'd be simpler to sort the leaked
+        objects by Distance column and track down the first one.
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/DetailedHeapshotGridNodes.js:
+        (WebInspector.HeapSnapshotGenericObjectNode):
+        (WebInspector.HeapSnapshotGenericObjectNode.prototype.get data):
+        (WebInspector.HeapSnapshotInstanceNode.prototype.comparator):
+        (WebInspector.HeapSnapshotConstructorNode):
+        (WebInspector.HeapSnapshotConstructorNode.prototype.comparator):
+        (WebInspector.HeapSnapshotConstructorNode.prototype.get data):
+        * inspector/front-end/DetailedHeapshotView.js:
+        (WebInspector.HeapSnapshotConstructorsDataGrid):
+        (WebInspector.HeapSnapshotConstructorsDataGrid.prototype._defaultPopulateCount.100._sortFields):
+        * inspector/front-end/HeapSnapshot.js:
+        (WebInspector.HeapSnapshotNodesProvider.prototype._serialize):
+
 2012-03-21  Charles Wei  <[email protected]>
 
         [BlackBerry] Remove redundant code in SocketStreamHandler

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


--- trunk/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js	2012-03-21 08:56:53 UTC (rev 111511)
+++ trunk/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js	2012-03-21 09:14:01 UTC (rev 111512)
@@ -203,6 +203,7 @@
     WebInspector.HeapSnapshotGridNode.call(this, tree, false);
     this._name = node.name;
     this._type = node.type;
+    this._distanceToWindow = node.distanceToWindow;
     this._shallowSize = node.selfSize;
     this._retainedSize = node.retainedSize;
     this.snapshotNodeId = node.id;
@@ -300,6 +301,7 @@
         data["object"] = { valueStyle: valueStyle, value: value, nodeId: this.snapshotNodeId };
 
         var view = this.dataGrid.snapshotView;
+        data["distanceToWindow"] =  this._distanceToWindow;
         data["shallowSize"] = Number.withThousandsSeparator(this._shallowSize);
         data["retainedSize"] = Number.withThousandsSeparator(this._retainedSize);
         data["shallowSize-percent"] = this._toPercentString(this._shallowSizePercent);
@@ -526,6 +528,7 @@
         var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier;
         var sortFields = {
             object: ["!edgeName", sortAscending, "retainedSize", false],
+            distanceToWindow: ["distanceToWindow", sortAscending, "retainedSize", false],
             count: ["!edgeName", true, "retainedSize", false],
             addedSize: ["selfSize", sortAscending, "!edgeName", true],
             removedSize: ["selfSize", sortAscending, "!edgeName", true],
@@ -568,6 +571,7 @@
 {
     WebInspector.HeapSnapshotGridNode.call(this, tree, aggregate.count > 0);
     this._name = className;
+    this._distanceToWindow = aggregate.distanceToWindow;
     this._count = aggregate.count;
     this._shallowSize = aggregate.self;
     this._retainedSize = aggregate.maxRet;
@@ -599,6 +603,7 @@
         var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier;
         var sortFields = {
             object: ["id", sortAscending, "retainedSize", false],
+            distanceToWindow: ["distanceToWindow", true, "retainedSize", false],
             count: ["id", true, "retainedSize", false],
             shallowSize: ["selfSize", sortAscending, "id", true],
             retainedSize: ["retainedSize", sortAscending, "id", true]
@@ -621,6 +626,7 @@
         var data = { object: this._name };
         var view = this.dataGrid.snapshotView;
         data["count"] =  Number.withThousandsSeparator(this._count);
+        data["distanceToWindow"] =  this._distanceToWindow;
         data["shallowSize"] = Number.withThousandsSeparator(this._shallowSize);
         data["retainedSize"] = Number.withThousandsSeparator(this._retainedSize);
         data["count-percent"] =  this._toPercentString(this._countPercent);

Modified: trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js (111511 => 111512)


--- trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js	2012-03-21 08:56:53 UTC (rev 111511)
+++ trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js	2012-03-21 09:14:01 UTC (rev 111512)
@@ -219,6 +219,7 @@
 {
     var columns = {
         object: { title: WebInspector.UIString("Constructor"), disclosure: true, sortable: true },
+        distanceToWindow: { title: WebInspector.UIString("Distance"), width: "90px", sortable: true },
         count: { title: WebInspector.UIString("Objects Count"), width: "90px", sortable: true },
         shallowSize: { title: WebInspector.UIString("Shallow Size"), width: "120px", sortable: true },
         retainedSize: { title: WebInspector.UIString("Retained Size"), width: "120px", sort: "descending", sortable: true }
@@ -234,6 +235,7 @@
     {
         return {
             object: ["_name", sortAscending, "_count", false],
+            distanceToWindow: ["_distanceToWindow", sortAscending, "_retainedSize", true],
             count: ["_count", sortAscending, "_name", true],
             shallowSize: ["_shallowSize", sortAscending, "_name", true],
             retainedSize: ["_retainedSize", sortAscending, "_name", true]

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


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2012-03-21 08:56:53 UTC (rev 111511)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2012-03-21 09:14:01 UTC (rev 111512)
@@ -1048,14 +1048,24 @@
             if (!(classIndex in aggregates)) {
                 var nodeType = node.type;
                 var nameMatters = nodeType === "object" || nodeType === "native";
-                var value = { count: 0, self: 0, maxRet: 0, type: nodeType, name: nameMatters ? node.name : null, idxs: [] };
+                var value = {
+                    count: 1,
+                    distanceToWindow: node.distanceToWindow,
+                    self: node.selfSize,
+                    maxRet: 0,
+                    type: nodeType,
+                    name: nameMatters ? node.name : null,
+                    idxs: [node.nodeIndex]
+                };
                 aggregates[classIndex] = value;
                 aggregatesByClassName[node.className] = value;
+            } else {
+                var clss = aggregates[classIndex];
+                clss.distanceToWindow = Math.min(clss.distanceToWindow, node.distanceToWindow);
+                ++clss.count;
+                clss.self += node.selfSize;
+                clss.idxs.push(node.nodeIndex);
             }
-            var clss = aggregates[classIndex];
-            ++clss.count;
-            clss.self += node.selfSize;
-            clss.idxs.push(node.nodeIndex);
         }
 
         // Recursively visit dominators tree and sum up retained sizes
@@ -1562,6 +1572,7 @@
         return {
             id: node.id,
             name: node.name,
+            distanceToWindow: node.distanceToWindow,
             nodeIndex: node.nodeIndex,
             retainedSize: node.retainedSize,
             selfSize: node.selfSize,
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to