Title: [105598] trunk/Source/WebCore
Revision
105598
Author
[email protected]
Date
2012-01-23 01:23:48 -0800 (Mon, 23 Jan 2012)

Log Message

Web Inspector: DetailedHeapSnapshot: Replace the list of retainers with the expandable tree (to get rid of cycles)
https://bugs.webkit.org/show_bug.cgi?id=76813

Reviewed by Pavel Feldman.

* English.lproj/localizedStrings.js:
* inspector/front-end/DetailedHeapshotGridNodes.js:
(WebInspector.HeapSnapshotObjectNode):
* inspector/front-end/DetailedHeapshotView.js:
(WebInspector.HeapSnapshotContainmentDataGrid.prototype.setDataSource):
(WebInspector.HeapSnapshotRetainmentDataGrid):
(WebInspector.HeapSnapshotRetainmentDataGrid.prototype.reset):
(WebInspector.DetailedHeapshotView.prototype._startRetainersHeaderDragging):
* inspector/front-end/HeapSnapshot.js:
(WebInspector.HeapSnapshot.prototype.createRetainingEdgesProvider):
(WebInspector.HeapSnapshotEdgesProvider):
* inspector/front-end/HeapSnapshotProxy.js:
(WebInspector.HeapSnapshotProxy.prototype.createEdgesProvider):
(WebInspector.HeapSnapshotProxy.prototype.createRetainingEdgesProvider):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (105597 => 105598)


--- trunk/Source/WebCore/ChangeLog	2012-01-23 09:13:23 UTC (rev 105597)
+++ trunk/Source/WebCore/ChangeLog	2012-01-23 09:23:48 UTC (rev 105598)
@@ -1,3 +1,25 @@
+2012-01-23  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: DetailedHeapSnapshot: Replace the list of retainers with the expandable tree (to get rid of cycles)
+        https://bugs.webkit.org/show_bug.cgi?id=76813
+
+        Reviewed by Pavel Feldman.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/front-end/DetailedHeapshotGridNodes.js:
+        (WebInspector.HeapSnapshotObjectNode):
+        * inspector/front-end/DetailedHeapshotView.js:
+        (WebInspector.HeapSnapshotContainmentDataGrid.prototype.setDataSource):
+        (WebInspector.HeapSnapshotRetainmentDataGrid):
+        (WebInspector.HeapSnapshotRetainmentDataGrid.prototype.reset):
+        (WebInspector.DetailedHeapshotView.prototype._startRetainersHeaderDragging):
+        * inspector/front-end/HeapSnapshot.js:
+        (WebInspector.HeapSnapshot.prototype.createRetainingEdgesProvider):
+        (WebInspector.HeapSnapshotEdgesProvider):
+        * inspector/front-end/HeapSnapshotProxy.js:
+        (WebInspector.HeapSnapshotProxy.prototype.createEdgesProvider):
+        (WebInspector.HeapSnapshotProxy.prototype.createRetainingEdgesProvider):
+
 2012-01-20  Andrey Kosyakov  <[email protected]>
 
         Web Inspector: HAR pageref attributes are wrong and inconsistent with pages array

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


(Binary files differ)

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


--- trunk/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js	2012-01-23 09:13:23 UTC (rev 105597)
+++ trunk/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js	2012-01-23 09:23:48 UTC (rev 105598)
@@ -110,7 +110,7 @@
                         continue;
                     }
                 }
-                this.insertChild(this._createChildNode(item, provider), atIndex++);
+                this.insertChild(this._createChildNode(item, provider, this), atIndex++);
             }
             provider.instanceCount += items.length;
             if (part < howMany) {
@@ -335,7 +335,7 @@
     this._referenceName = edge.name;
     this._referenceType = edge.type;
     this._isFromBaseSnapshot = isFromBaseSnapshot;
-    this._provider = this._createProvider(!isFromBaseSnapshot ? tree.snapshot : tree.baseSnapshot, edge.nodeIndex);
+    this._provider = this._createProvider(!isFromBaseSnapshot ? tree.snapshot : tree.baseSnapshot, edge.nodeIndex, tree);
     this._updateHasChildren();
 }
 
@@ -345,15 +345,17 @@
         return new WebInspector.HeapSnapshotObjectNode(this.dataGrid, this._isFromBaseSnapshot, item);
     },
 
-    _createProvider: function(snapshot, nodeIndex)
+    _createProvider: function(snapshot, nodeIndex, tree)
     {
         var showHiddenData = WebInspector.settings.showHeapSnapshotObjectsHiddenProperties.get();
-        return snapshot.createEdgesProvider(
-            nodeIndex,
-            "function(edge) {" +
+        var filter = "function(edge) {" +
             "    return !edge.isInvisible" +
             "        && (" + showHiddenData + " || (!edge.isHidden && !edge.node.isHidden));" +
-            "}");
+            "}";
+        if (tree.showRetainingEdges)
+            return snapshot.createRetainingEdgesProvider(nodeIndex, filter);
+        else
+            return snapshot.createEdgesProvider(nodeIndex, filter);
     },
 
     _childHashForEntity: function(edge)

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


--- trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js	2012-01-23 09:13:23 UTC (rev 105597)
+++ trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js	2012-01-23 09:23:48 UTC (rev 105598)
@@ -162,12 +162,12 @@
         nextStep(this, 0);
     },
 
-    setDataSource: function(snapshotView, snapshot)
+    setDataSource: function(snapshotView, snapshot, nodeIndex)
     {
         this.snapshotView = snapshotView;
         this.snapshot = snapshot;
-        this.snapshotNodeIndex = this.snapshot.rootNodeIndex;
-        this._provider = this._createProvider(snapshot, this.snapshotNodeIndex);
+        this.snapshotNodeIndex = nodeIndex || this.snapshot.rootNodeIndex;
+        this._provider = this._createProvider(snapshot, this.snapshotNodeIndex, this);
         this.sort();
     },
 
@@ -180,6 +180,22 @@
 MixInSnapshotNodeFunctions(WebInspector.HeapSnapshotObjectNode.prototype, WebInspector.HeapSnapshotContainmentDataGrid.prototype);
 WebInspector.HeapSnapshotContainmentDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotSortableDataGrid.prototype;
 
+WebInspector.HeapSnapshotRetainmentDataGrid = function()
+{
+    this.showRetainingEdges = true;
+    WebInspector.HeapSnapshotContainmentDataGrid.call(this);
+}
+
+WebInspector.HeapSnapshotRetainmentDataGrid.prototype = {
+    reset: function()
+    {
+        this.removeChildren();
+        this.resetSortingCache();
+    },
+}
+
+WebInspector.HeapSnapshotRetainmentDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotContainmentDataGrid.prototype;
+
 WebInspector.HeapSnapshotConstructorsDataGrid = function()
 {
     var columns = {
@@ -392,176 +408,6 @@
 MixInSnapshotNodeFunctions(WebInspector.HeapSnapshotDominatorObjectNode.prototype, WebInspector.HeapSnapshotDominatorsDataGrid.prototype);
 WebInspector.HeapSnapshotDominatorsDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotSortableDataGrid.prototype;
 
-WebInspector.HeapSnapshotPathFinderState = function(snapshot, nodeIndex, rootFilter)
-{
-    this._pathFinder = snapshot.createPathFinder(nodeIndex, !WebInspector.settings.showHeapSnapshotObjectsHiddenProperties.get());
-    this._pathFinder.updateRoots(rootFilter);
-    this._foundCount = 0;
-    this._foundCountMax = null;
-    this._totalFoundCount = 0;
-    this._cancelled = false;
-}
-
-WebInspector.HeapSnapshotPathFinderState.prototype = {
-    batchDone: function(status)
-    {
-    },
-
-    pathFound: function(path)
-    {
-    },
-
-    cancel: function()
-    {
-        this._cancelled = true;
-        this._pathFinder.dispose();
-    },
-
-    startBatch: function(count)
-    {
-        if (this._cancelled)
-            return;
-        this._foundCount = 0;
-        this._foundCountMax = count;
-        this._pathFinder.findNext(this._pathFound.bind(this));
-    },
-
-    _pathFound: function(result)
-    {
-        if (this._cancelled)
-            return;
-        if (result === null) {
-            if (!this._totalFoundCount)
-                this.batchDone("no-paths-at-all");
-        } else if (result !== false) {
-            this.pathFound(result);
-            ++this._foundCount;
-            ++this._totalFoundCount;
-            if (this._foundCount < this._foundCountMax)
-                this._pathFinder.findNext(this._pathFound.bind(this));
-            else
-                this.batchDone("have-more-paths");
-        } else {
-            this.batchDone("no-more-paths");
-        }
-    }
-};
-
-WebInspector.HeapSnapshotRetainingPathsList = function()
-{
-    var columns = {
-        path: { title: WebInspector.UIString("Retaining path"), sortable: true },
-        len: { title: WebInspector.UIString("Length"), width: "90px", sortable: true, sort: "ascending" }
-    };
-    WebInspector.HeapSnapshotSortableDataGrid.call(this, columns);
-    this._defaultPopulateCount = 100;
-    this._nodeIndex = null;
-    this._state = null;
-    this._prefix = null;
-}
-
-WebInspector.HeapSnapshotRetainingPathsList.prototype = {
-    dispose: function()
-    {
-        if (this._state)
-            this._state.cancel();
-    },
-
-    _sortFields: function(sortColumn, sortAscending)
-    {
-        return {
-            path: ["path", sortAscending, "len", true],
-            len: ["len", sortAscending, "path", true]
-        }[sortColumn];
-    },
-
-    _resetPaths: function()
-    {
-        var rootFilter = this.snapshotView.isTracingToWindowObjects ?
-            "function (node) { return node.name.substr(0, 9) === \"DOMWindow\"; }" : null;
-        if (this._state)
-            this._state.cancel();
-        this._state = new WebInspector.HeapSnapshotPathFinderState(this._snapshot, this._nodeIndex, rootFilter);
-        this._state.batchDone = this._batchDone.bind(this);
-        this._state.pathFound = this._pathFound.bind(this);
-        this.removeChildren();
-        this.resetSortingCache();
-        this.showNext(this._defaultPopulateCount);
-    },
-
-    setDataSource: function(snapshotView, snapshot, nodeIndex, prefix)
-    {
-        if (this._nodeIndex === nodeIndex)
-            return;
-        this.snapshotView = snapshotView;
-        this._snapshot = snapshot;
-        this._nodeIndex = nodeIndex;
-        this._prefix = prefix;
-        this._resetPaths();
-    },
-
-    refresh: function()
-    {
-        if (this.snapshotView)
-            this._resetPaths();
-    },
-
-    reset: function()
-    {
-        if (this._state)
-            this._state.cancel();
-        this.removeChildren();
-        this.resetSortingCache();
-        this.appendChild(new WebInspector.DataGridNode({path:WebInspector.UIString("Click on an object to show retaining paths"), len:""}, false));
-    },
-
-    _batchDone: function(state)
-    {
-        switch (state) {
-        case "no-paths-at-all":
-            this.appendChild(new WebInspector.DataGridNode({path:WebInspector.UIString("Can't find any paths."), len:""}, false));
-            break;
-        case "have-more-paths":
-            this.appendChild(new WebInspector.ShowMoreDataGridNode(this.showNext.bind(this), this._defaultPopulateCount));
-            this.resetSortingCache();
-            this.sortingChanged();
-            break;
-        case "no-more-paths":
-            // Nothing to do.
-            break;
-        }
-    },
-
-    _pathFound: function(result)
-    {
-        if (WebInspector.HeapSnapshotGenericObjectNode.prototype.isDOMWindow(result.path))
-            result.path = WebInspector.HeapSnapshotGenericObjectNode.prototype.shortenWindowURL(result.path, true);
-        if (this._prefix)
-            result.path = this._prefix + result.path;
-        var node = new WebInspector.DataGridNode(result, false);
-        node.route = result.route;
-        this.appendChild(node);
-    },
-
-    showNext: function(pathsCount)
-    {
-        this._state.startBatch(pathsCount);
-    },
-
-    _performSorting: function(sortFunction)
-    {
-        function DataExtractorWrapper(nodeA, nodeB)
-        {
-            return sortFunction(nodeA.data, nodeB.data);
-        }
-        this.recursiveSortingEnter();
-        this.sortNodes(DataExtractorWrapper);
-        this.recursiveSortingLeave();
-    }
-};
-
-WebInspector.HeapSnapshotRetainingPathsList.prototype.__proto__ = WebInspector.HeapSnapshotSortableDataGrid.prototype;
-
 WebInspector.DetailedHeapshotView = function(parent, profile)
 {
     WebInspector.View.call(this);
@@ -613,25 +459,15 @@
     var retainingPathsTitleDiv = document.createElement("div");
     retainingPathsTitleDiv.className = "title";
     var retainingPathsTitle = document.createElement("span");
-    retainingPathsTitle.textContent = WebInspector.UIString("Paths from the selected object");
-    this.retainingPathsRoot = document.createElement("select");
-    this.retainingPathsRoot.className = "status-bar-item";
-    this.retainingPathsRoot.addEventListener("change", this._changeRetainingPathsRoot.bind(this), false);
-    var toGCRootsTraceOption = document.createElement("option");
-    toGCRootsTraceOption.label = WebInspector.UIString("to GC roots");
-    var toWindowObjectsTraceOption = document.createElement("option");
-    toWindowObjectsTraceOption.label = WebInspector.UIString("to window objects");
-    this.retainingPathsRoot.appendChild(toWindowObjectsTraceOption);
-    this.retainingPathsRoot.appendChild(toGCRootsTraceOption);
+    retainingPathsTitle.textContent = WebInspector.UIString("Object's retaining tree");
     retainingPathsTitleDiv.appendChild(retainingPathsTitle);
-    retainingPathsTitleDiv.appendChild(this.retainingPathsRoot);
     this.retainmentViewHeader.appendChild(retainingPathsTitleDiv);
     this.element.appendChild(this.retainmentViewHeader);
 
     this.retainmentView = new WebInspector.View();
     this.retainmentView.element.addStyleClass("view");
     this.retainmentView.element.addStyleClass("retaining-paths-view");
-    this.retainmentDataGrid = new WebInspector.HeapSnapshotRetainingPathsList();
+    this.retainmentDataGrid = new WebInspector.HeapSnapshotRetainmentDataGrid();
     this.retainmentDataGrid.element.addEventListener("click", this._mouseClickInRetainmentGrid.bind(this), true);
     this.retainmentDataGrid.show(this.retainmentView.element);
     this.retainmentView.show(this.element);
@@ -1093,13 +929,6 @@
         this.performSearch(this.currentQuery, this._searchFinishedCallback);
     },
 
-    _changeRetainingPathsRoot: function(event)
-    {
-        if (!event)
-            return;
-        this.retainmentDataGrid.refresh();
-    },
-
     _getHoverAnchor: function(target)
     {
         var span = target.enclosingNodeOrSelfWithNodeName("span");
@@ -1115,11 +944,6 @@
         return span;
     },
 
-    get isTracingToWindowObjects()
-    {
-        return this.retainingPathsRoot.selectedIndex === 0;
-    },
-
     get _isShowingAsPercent()
     {
         return this.showCountAsPercent && this.showShallowSizeAsPercent && this.showRetainedSizeAsPercent;
@@ -1202,7 +1026,7 @@
 
     _startRetainersHeaderDragging: function(event)
     {
-        if (!this.isShowing() || event.target === this.retainingPathsRoot)
+        if (!this.isShowing())
             return;
 
         WebInspector.elementDragStart(this.retainmentViewHeader, this._retainersHeaderDragging.bind(this), this._endRetainersHeaderDragging.bind(this), event, "row-resize");

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


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2012-01-23 09:13:23 UTC (rev 105597)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2012-01-23 09:23:48 UTC (rev 105598)
@@ -1148,6 +1148,12 @@
         return new WebInspector.HeapSnapshotEdgesProvider(this, nodeIndex, this._parseFilter(filter));
     },
 
+    createRetainingEdgesProvider: function(nodeIndex, filter)
+    {
+        var node = new WebInspector.HeapSnapshotNode(this, nodeIndex);
+        return new WebInspector.HeapSnapshotEdgesProvider(this, nodeIndex, this._parseFilter(filter), node.retainers);
+    },
+
     createNodesProvider: function(filter)
     {
         return new WebInspector.HeapSnapshotNodesProvider(this, this._parseFilter(filter));
@@ -1301,11 +1307,12 @@
     return {fieldName1:fieldNames[0], ascending1:fieldNames[1], fieldName2:fieldNames[2], ascending2:fieldNames[3]};
 }
 
-WebInspector.HeapSnapshotEdgesProvider = function(snapshot, nodeIndex, filter)
+WebInspector.HeapSnapshotEdgesProvider = function(snapshot, nodeIndex, filter, iter)
 {
     this.snapshot = snapshot;
     var node = new WebInspector.HeapSnapshotNode(snapshot, nodeIndex);
-    WebInspector.HeapSnapshotFilteredOrderedIterator.call(this, new WebInspector.HeapSnapshotEdgeIterator(new WebInspector.HeapSnapshotEdge(snapshot, node.rawEdges)), filter);
+    var edgesIter = iter || new WebInspector.HeapSnapshotEdgeIterator(new WebInspector.HeapSnapshotEdge(snapshot, node.rawEdges));
+    WebInspector.HeapSnapshotFilteredOrderedIterator.call(this, edgesIter, filter);
 }
 
 WebInspector.HeapSnapshotEdgesProvider.prototype = {

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


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js	2012-01-23 09:13:23 UTC (rev 105597)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js	2012-01-23 09:23:48 UTC (rev 105598)
@@ -325,6 +325,11 @@
         return this.callFactoryMethod(null, "createEdgesProvider", "WebInspector.HeapSnapshotProviderProxy", nodeIndex, filter);
     },
 
+    createRetainingEdgesProvider: function(nodeIndex, filter)
+    {
+        return this.callFactoryMethod(null, "createRetainingEdgesProvider", "WebInspector.HeapSnapshotProviderProxy", nodeIndex, filter);
+    },
+
     createNodesProvider: function(filter)
     {
         return this.callFactoryMethod(null, "createNodesProvider", "WebInspector.HeapSnapshotProviderProxy", filter);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to