Title: [114649] trunk
Revision
114649
Author
[email protected]
Date
2012-04-19 10:11:15 -0700 (Thu, 19 Apr 2012)

Log Message

Web Inspector: make constructors and diff heap snapshot data grids use viewport
https://bugs.webkit.org/show_bug.cgi?id=84348

HeapSnapshotViewportDataGrid is introduced which allows to add to the tbody only
visible rows. HeapSnapshotConstructorsDataGrid and HeapSnapshotDiffDataGrid are
inherited from this class which makes them operate well on large amounts of nodes.

Reviewed by Pavel Feldman.

Source/WebCore:

* inspector/front-end/DataGrid.js:
(WebInspector.DataGridNode.prototype.nodeHeight):
(WebInspector.DataGridNode.prototype._attach):
* inspector/front-end/HeapSnapshotDataGrids.js:
(WebInspector.HeapSnapshotSortableDataGrid):
(WebInspector.HeapSnapshotSortableDataGrid.prototype.nodesForNameFilter):
(WebInspector.HeapSnapshotSortableDataGrid.prototype.changeNameFilter):
(WebInspector.HeapSnapshotSortableDataGrid.prototype._performSorting):
(WebInspector.HeapSnapshotSortableDataGrid.prototype.appendChildAfterSorting):
(WebInspector.HeapSnapshotSortableDataGrid.prototype.updateVisibleNodes):
(WebInspector.HeapSnapshotSortableDataGrid.prototype.recursiveSortingEnter):
(WebInspector.HeapSnapshotSortableDataGrid.prototype.recursiveSortingLeave):
(WebInspector.HeapSnapshotViewportDataGrid):
(WebInspector.HeapSnapshotViewportDataGrid.prototype.nodesForNameFilter):
(WebInspector.HeapSnapshotViewportDataGrid.prototype.appendChildAfterSorting):
(WebInspector.HeapSnapshotViewportDataGrid.prototype.updateVisibleNodes):
(WebInspector.HeapSnapshotViewportDataGrid.prototype.appendTopLevelNode):
(WebInspector.HeapSnapshotViewportDataGrid.prototype._addPaddingRows):
(WebInspector.HeapSnapshotViewportDataGrid.prototype._removePaddingRows):
(WebInspector.HeapSnapshotViewportDataGrid.prototype.onResize):
(WebInspector.HeapSnapshotViewportDataGrid.prototype._onScroll):
(WebInspector.HeapSnapshotPaddingNode):
(WebInspector.HeapSnapshotPaddingNode.prototype.setHeight):
(WebInspector.HeapSnapshotPaddingNode.prototype.removeFromTable):
(WebInspector.HeapSnapshotConstructorsDataGrid):
(WebInspector.HeapSnapshotConstructorsDataGrid.prototype.populateChildren):
(WebInspector.HeapSnapshotDiffDataGrid):
(WebInspector.HeapSnapshotDiffDataGrid.prototype.populateChildren.baseAggregatesReceived.aggregatesReceived.addNodeIfNonZeroDiff):
(WebInspector.HeapSnapshotDiffDataGrid.prototype.populateChildren.baseAggregatesReceived.aggregatesReceived):
(WebInspector.HeapSnapshotDiffDataGrid.prototype.populateChildren):
* inspector/front-end/HeapSnapshotGridNodes.js:
(WebInspector.HeapSnapshotGridNode):
(WebInspector.HeapSnapshotGridNode.prototype.collapse):
(WebInspector.HeapSnapshotGridNode.prototype.sort.afterSort.afterPopulate):
(WebInspector.HeapSnapshotGridNode.prototype.sort.afterSort):
(WebInspector.HeapSnapshotGridNode.prototype.sort):
(WebInspector.HeapSnapshotObjectNode.prototype._createChildNode):
(WebInspector.HeapSnapshotObjectNode.prototype.comparator):
(WebInspector.HeapSnapshotInstanceNode.prototype._createChildNode):
(WebInspector.HeapSnapshotInstanceNode.prototype.comparator):
(WebInspector.HeapSnapshotConstructorNode):
(WebInspector.HeapSnapshotConstructorNode.prototype._createChildNode):
(WebInspector.HeapSnapshotConstructorNode.prototype.comparator):
(WebInspector.HeapSnapshotDiffNode):
(WebInspector.HeapSnapshotDiffNode.prototype._createChildNode):
(WebInspector.HeapSnapshotDiffNode.prototype.comparator):
(WebInspector.HeapSnapshotDominatorObjectNode.prototype._createChildNode):
(WebInspector.HeapSnapshotDominatorObjectNode.prototype.comparator):
* inspector/front-end/ShowMoreDataGridNode.js:
(WebInspector.ShowMoreDataGridNode.prototype.createCells):
(WebInspector.ShowMoreDataGridNode.prototype.nodeHeight):

LayoutTests:

* inspector/profiler/heap-snapshot-test.js: since summary and containment views are
now viewports, we should make sure all lazy clean up is done before collecting visible
rows content.
(initialize_HeapSnapshotTest):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (114648 => 114649)


--- trunk/LayoutTests/ChangeLog	2012-04-19 17:07:10 UTC (rev 114648)
+++ trunk/LayoutTests/ChangeLog	2012-04-19 17:11:15 UTC (rev 114649)
@@ -1,3 +1,19 @@
+2012-04-19  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: make constructors and diff heap snapshot data grids use viewport
+        https://bugs.webkit.org/show_bug.cgi?id=84348
+
+        HeapSnapshotViewportDataGrid is introduced which allows to add to the tbody only
+        visible rows. HeapSnapshotConstructorsDataGrid and HeapSnapshotDiffDataGrid are
+        inherited from this class which makes them operate well on large amounts of nodes.
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/profiler/heap-snapshot-test.js: since summary and containment views are
+        now viewports, we should make sure all lazy clean up is done before collecting visible
+        rows content.
+        (initialize_HeapSnapshotTest):
+
 2012-04-19  Sudarsana Nagineni  <[email protected]>
 
         [EFL] [DRT] Unskip KeyEvent related tests which are passing now

Modified: trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js (114648 => 114649)


--- trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js	2012-04-19 17:07:10 UTC (rev 114648)
+++ trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js	2012-04-19 17:11:15 UTC (rev 114649)
@@ -349,6 +349,8 @@
 
 InspectorTest.columnContents = function(column, row)
 {
+    // Make sure invisible nodes are removed from the view port.
+    this._currentGrid().updateVisibleNodes();
     var result = [];
     var parent = row || this._currentGrid().rootNode();
     for (var node = parent.children[0]; node; node = node.traverseNextNode(true, parent, true)) {

Modified: trunk/Source/WebCore/ChangeLog (114648 => 114649)


--- trunk/Source/WebCore/ChangeLog	2012-04-19 17:07:10 UTC (rev 114648)
+++ trunk/Source/WebCore/ChangeLog	2012-04-19 17:11:15 UTC (rev 114649)
@@ -1,3 +1,66 @@
+2012-04-19  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: make constructors and diff heap snapshot data grids use viewport
+        https://bugs.webkit.org/show_bug.cgi?id=84348
+
+        HeapSnapshotViewportDataGrid is introduced which allows to add to the tbody only
+        visible rows. HeapSnapshotConstructorsDataGrid and HeapSnapshotDiffDataGrid are
+        inherited from this class which makes them operate well on large amounts of nodes.
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/front-end/DataGrid.js:
+        (WebInspector.DataGridNode.prototype.nodeHeight):
+        (WebInspector.DataGridNode.prototype._attach):
+        * inspector/front-end/HeapSnapshotDataGrids.js:
+        (WebInspector.HeapSnapshotSortableDataGrid):
+        (WebInspector.HeapSnapshotSortableDataGrid.prototype.nodesForNameFilter):
+        (WebInspector.HeapSnapshotSortableDataGrid.prototype.changeNameFilter):
+        (WebInspector.HeapSnapshotSortableDataGrid.prototype._performSorting):
+        (WebInspector.HeapSnapshotSortableDataGrid.prototype.appendChildAfterSorting):
+        (WebInspector.HeapSnapshotSortableDataGrid.prototype.updateVisibleNodes):
+        (WebInspector.HeapSnapshotSortableDataGrid.prototype.recursiveSortingEnter):
+        (WebInspector.HeapSnapshotSortableDataGrid.prototype.recursiveSortingLeave):
+        (WebInspector.HeapSnapshotViewportDataGrid):
+        (WebInspector.HeapSnapshotViewportDataGrid.prototype.nodesForNameFilter):
+        (WebInspector.HeapSnapshotViewportDataGrid.prototype.appendChildAfterSorting):
+        (WebInspector.HeapSnapshotViewportDataGrid.prototype.updateVisibleNodes):
+        (WebInspector.HeapSnapshotViewportDataGrid.prototype.appendTopLevelNode):
+        (WebInspector.HeapSnapshotViewportDataGrid.prototype._addPaddingRows):
+        (WebInspector.HeapSnapshotViewportDataGrid.prototype._removePaddingRows):
+        (WebInspector.HeapSnapshotViewportDataGrid.prototype.onResize):
+        (WebInspector.HeapSnapshotViewportDataGrid.prototype._onScroll):
+        (WebInspector.HeapSnapshotPaddingNode):
+        (WebInspector.HeapSnapshotPaddingNode.prototype.setHeight):
+        (WebInspector.HeapSnapshotPaddingNode.prototype.removeFromTable):
+        (WebInspector.HeapSnapshotConstructorsDataGrid):
+        (WebInspector.HeapSnapshotConstructorsDataGrid.prototype.populateChildren):
+        (WebInspector.HeapSnapshotDiffDataGrid):
+        (WebInspector.HeapSnapshotDiffDataGrid.prototype.populateChildren.baseAggregatesReceived.aggregatesReceived.addNodeIfNonZeroDiff):
+        (WebInspector.HeapSnapshotDiffDataGrid.prototype.populateChildren.baseAggregatesReceived.aggregatesReceived):
+        (WebInspector.HeapSnapshotDiffDataGrid.prototype.populateChildren):
+        * inspector/front-end/HeapSnapshotGridNodes.js:
+        (WebInspector.HeapSnapshotGridNode):
+        (WebInspector.HeapSnapshotGridNode.prototype.collapse):
+        (WebInspector.HeapSnapshotGridNode.prototype.sort.afterSort.afterPopulate):
+        (WebInspector.HeapSnapshotGridNode.prototype.sort.afterSort):
+        (WebInspector.HeapSnapshotGridNode.prototype.sort):
+        (WebInspector.HeapSnapshotObjectNode.prototype._createChildNode):
+        (WebInspector.HeapSnapshotObjectNode.prototype.comparator):
+        (WebInspector.HeapSnapshotInstanceNode.prototype._createChildNode):
+        (WebInspector.HeapSnapshotInstanceNode.prototype.comparator):
+        (WebInspector.HeapSnapshotConstructorNode):
+        (WebInspector.HeapSnapshotConstructorNode.prototype._createChildNode):
+        (WebInspector.HeapSnapshotConstructorNode.prototype.comparator):
+        (WebInspector.HeapSnapshotDiffNode):
+        (WebInspector.HeapSnapshotDiffNode.prototype._createChildNode):
+        (WebInspector.HeapSnapshotDiffNode.prototype.comparator):
+        (WebInspector.HeapSnapshotDominatorObjectNode.prototype._createChildNode):
+        (WebInspector.HeapSnapshotDominatorObjectNode.prototype.comparator):
+        * inspector/front-end/ShowMoreDataGridNode.js:
+        (WebInspector.ShowMoreDataGridNode.prototype.createCells):
+        (WebInspector.ShowMoreDataGridNode.prototype.nodeHeight):
+
 2012-04-19  Kentaro Hara  <[email protected]>
 
         Unreviewed, rolling out r114421.

Modified: trunk/Source/WebCore/inspector/front-end/DataGrid.js (114648 => 114649)


--- trunk/Source/WebCore/inspector/front-end/DataGrid.js	2012-04-19 17:07:10 UTC (rev 114648)
+++ trunk/Source/WebCore/inspector/front-end/DataGrid.js	2012-04-19 17:11:15 UTC (rev 114649)
@@ -1234,6 +1234,22 @@
     },
 
     /**
+     * @return {number}
+     */
+    nodeHeight: function()
+    {
+        var rowHeight = 16;
+        if (!this.revealed)
+            return 0;
+        if (!this.expanded)
+            return rowHeight;
+        var result = rowHeight;
+        for (var i = 0; i < this.children.length; i++)
+            result += this.children[i].nodeHeight();
+        return result;
+    },
+
+    /**
      * @param {WebInspector.DataGridNode} child
      */
     appendChild: function(child)
@@ -1569,7 +1585,7 @@
         if (previousNode && previousNode.element.parentNode && previousNode.element.nextSibling)
             nextNode = previousNode.element.nextSibling;
         if (!nextNode)
-            nextNode = this.dataGrid.dataTableBody.lastChild;
+            nextNode = this.dataGrid.dataTableBody.firstChild;
         this.dataGrid.dataTableBody.insertBefore(this.element, nextNode);
 
         if (this.expanded)

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js (114648 => 114649)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js	2012-04-19 17:07:10 UTC (rev 114648)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js	2012-04-19 17:11:15 UTC (rev 114649)
@@ -31,16 +31,11 @@
 /**
  * @constructor
  * @extends {WebInspector.DataGrid}
- * @param {boolean=} deferNodeContentCreation
  */
-WebInspector.HeapSnapshotSortableDataGrid = function(columns, deferNodeContentCreation)
+WebInspector.HeapSnapshotSortableDataGrid = function(columns)
 {
     WebInspector.DataGrid.call(this, columns);
     this.addEventListener("sorting changed", this.sortingChanged, this);
-
-    this._deferNodeContentCreation = deferNodeContentCreation;
-    if (deferNodeContentCreation)
-        this.scrollContainer.addEventListener("scroll", this._onScroll.bind(this), true);
 }
 
 WebInspector.HeapSnapshotSortableDataGrid.prototype = {
@@ -56,10 +51,15 @@
         delete this._lastSortAscending;
     },
 
+    nodesForNameFilter: function()
+    {
+        return this.rootNode().children;
+    },
+
     changeNameFilter: function(filter)
     {
         filter = filter.toLowerCase();
-        var children = this.rootNode().children;
+        var children = this.nodesForNameFilter();
         for (var i = 0, l = children.length; i < l; ++i) {
             var node = children[i];
             if (node.depth === 0)
@@ -97,88 +97,181 @@
         this._performSorting(SortByTwoFields);
     },
 
+    _performSorting: function(sortFunction)
+    {
+        this.recursiveSortingEnter();
+        var children = this._topLevelNodes;
+        this.rootNode().removeChildren();
+        children.sort(sortFunction);
+        for (var i = 0, l = children.length; i < l; ++i) {
+            var child = children[i];
+            this.appendChildAfterSorting(child);
+            if (child.expanded)
+                child.sort();
+        }
+        this.recursiveSortingLeave();
+        this.updateVisibleNodes();
+    },
+
+    appendChildAfterSorting: function(child)
+    {
+        var revealed = child.revealed;
+        this.rootNode().appendChild(child);
+        child.revealed = revealed;
+    },
+
     updateVisibleNodes: function()
     {
-        if (!this._deferNodeContentCreation)
+    },
+
+    recursiveSortingEnter: function()
+    {
+        if (!("_recursiveSortingDepth" in this))
+            this._recursiveSortingDepth = 1;
+        else
+            ++this._recursiveSortingDepth;
+    },
+
+    recursiveSortingLeave: function()
+    {
+        if (!("_recursiveSortingDepth" in this))
             return;
+        if (!--this._recursiveSortingDepth) {
+            delete this._recursiveSortingDepth;
+            this.dispatchEventToListeners("sorting complete");
+        }
+    }
+};
+
+WebInspector.HeapSnapshotSortableDataGrid.prototype.__proto__ = WebInspector.DataGrid.prototype;
+
+
+/**
+ * @constructor
+ * @extends {WebInspector.HeapSnapshotSortableDataGrid}
+ */
+WebInspector.HeapSnapshotViewportDataGrid = function(columns)
+{
+    WebInspector.HeapSnapshotSortableDataGrid.call(this, columns);
+    this.scrollContainer.addEventListener("scroll", this._onScroll.bind(this), true);
+    this._topLevelNodes = [];
+    this._topPadding = new WebInspector.HeapSnapshotPaddingNode();
+    this._bottomPadding = new WebInspector.HeapSnapshotPaddingNode();
+}
+
+WebInspector.HeapSnapshotViewportDataGrid.prototype = {
+    nodesForNameFilter: function()
+    {
+        return this._topLevelNodes;
+    },
+
+    appendChildAfterSorting: function(child)
+    {
+        // Do nothing here, it will be added in updateVisibleNodes.
+    },
+
+    updateVisibleNodes: function()
+    {
         var scrollTop = this.scrollContainer.scrollTop;
-        var rowHeight = 16;
 
-        var height = this.scrollContainer.offsetHeight;
-        var visibleRowsCount = Math.round(height / rowHeight) + 1;
+        var viewPortHeight = this.scrollContainer.offsetHeight;
 
-        var children = this.rootNode().children;
+        this._removePaddingRows();
 
+        var children = this._topLevelNodes;
+
         var i = 0;
+        var topPadding = 0;
         while (i < children.length) {
             if (children[i].revealed) {
-                var top = children[i].element.offsetTop;
-                if (top >= scrollTop)
+                var newTop = topPadding + children[i].nodeHeight();
+                if (newTop > scrollTop)
                     break;
+                topPadding = newTop;
             }
             ++i;
         }
 
-        while (i < children.length && visibleRowsCount) {
+        this.rootNode().removeChildren();
+        // The height of the view port + invisible top part.
+        var heightToFill = viewPortHeight + (scrollTop - topPadding);
+        var filledHeight = 0;
+        while (i < children.length && filledHeight < heightToFill) {
             if (children[i].revealed) {
-                children[i].ensureContentCreated();
-                --visibleRowsCount;
+                this.rootNode().appendChild(children[i]);
+                filledHeight += children[i].nodeHeight();
             }
             ++i;
         }
+
+        var bottomPadding = 0;
+        while (i < children.length) {
+            bottomPadding += children[i].nodeHeight();
+            ++i;
+        }
+
+        this._addPaddingRows(topPadding, bottomPadding);
     },
 
-    onResize: function()
+    appendTopLevelNode: function(node)
     {
-        this.updateVisibleNodes();
+        this._topLevelNodes.push(node);
     },
 
-    _onScroll: function(event)
+    _addPaddingRows: function(top, bottom)
     {
-        this.updateVisibleNodes();
+        if (this._topPadding.element.parentNode !== this.dataTableBody)
+            this.dataTableBody.insertBefore(this._topPadding.element, this.dataTableBody.firstChild);
+        if (this._bottomPadding.element.parentNode !== this.dataTableBody)
+            this.dataTableBody.insertBefore(this._bottomPadding.element, this.dataTableBody.lastChild);
+        this._topPadding.setHeight(top);
+        this._bottomPadding.setHeight(bottom);
     },
 
-    _performSorting: function(sortFunction)
+    _removePaddingRows: function()
     {
-        this.recursiveSortingEnter();
-        var children = this.rootNode().children;
-        this.rootNode().removeChildren();
-        children.sort(sortFunction);
-        for (var i = 0, l = children.length; i < l; ++i) {
-            var child = children[i];
-            var revealed = child.revealed;
-            this.rootNode().appendChild(child);
-            child.revealed = revealed;
-            if (child.expanded)
-                child.sort();
-        }
-        this.recursiveSortingLeave();
-        this.updateVisibleNodes();
+        this._bottomPadding.removeFromTable();
+        this._topPadding.removeFromTable();
     },
 
-    recursiveSortingEnter: function()
+    onResize: function()
     {
-        if (!("_recursiveSortingDepth" in this))
-            this._recursiveSortingDepth = 1;
-        else
-            ++this._recursiveSortingDepth;
+        this.updateVisibleNodes();
     },
 
-    recursiveSortingLeave: function()
+    _onScroll: function(event)
     {
-        if (!("_recursiveSortingDepth" in this))
-            return;
-        if (!--this._recursiveSortingDepth) {
-            delete this._recursiveSortingDepth;
-            this.dispatchEventToListeners("sorting complete");
-        }
+        this.updateVisibleNodes();
     }
-};
+}
 
-WebInspector.HeapSnapshotSortableDataGrid.prototype.__proto__ = WebInspector.DataGrid.prototype;
+WebInspector.HeapSnapshotViewportDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotSortableDataGrid.prototype;
 
 /**
  * @constructor
+ */
+WebInspector.HeapSnapshotPaddingNode = function()
+{
+    this.element = document.createElement("tr");
+    this.element.addStyleClass("revealed");
+}
+
+WebInspector.HeapSnapshotPaddingNode.prototype = {
+   setHeight: function(height)
+   {
+       this.element.style.height = height + "px";
+   },
+   removeFromTable: function()
+   {
+        var parent = this.element.parentNode;
+        if (parent)
+            parent.removeChild(this.element);
+   }
+}
+
+
+/**
+ * @constructor
  * @extends {WebInspector.HeapSnapshotSortableDataGrid}
  * @param {Object=} columns
  */
@@ -288,7 +381,7 @@
 
 /**
  * @constructor
- * @extends {WebInspector.HeapSnapshotSortableDataGrid}
+ * @extends {WebInspector.HeapSnapshotViewportDataGrid}
  */
 WebInspector.HeapSnapshotConstructorsDataGrid = function()
 {
@@ -299,8 +392,9 @@
         shallowSize: { title: WebInspector.UIString("Shallow Size"), width: "120px", sortable: true },
         retainedSize: { title: WebInspector.UIString("Retained Size"), width: "120px", sort: "descending", sortable: true }
     };
-    WebInspector.HeapSnapshotSortableDataGrid.call(this, columns, true);
+    WebInspector.HeapSnapshotViewportDataGrid.call(this, columns);
     this._profileIndex = -1;
+    this._topLevelNodes = [];
 }
 
 WebInspector.HeapSnapshotConstructorsDataGrid.prototype = {
@@ -330,7 +424,7 @@
         function aggregatesReceived(key, aggregates)
         {
             for (var constructor in aggregates)
-                this.rootNode().appendChild(new WebInspector.HeapSnapshotConstructorNode(this, constructor, aggregates[constructor], key));
+                this.appendTopLevelNode(new WebInspector.HeapSnapshotConstructorNode(this, constructor, aggregates[constructor], key));
             this.sortingChanged();
         }
 
@@ -361,11 +455,11 @@
 
 };
 
-WebInspector.HeapSnapshotConstructorsDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotSortableDataGrid.prototype;
+WebInspector.HeapSnapshotConstructorsDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotViewportDataGrid.prototype;
 
 /**
  * @constructor
- * @extends {WebInspector.HeapSnapshotSortableDataGrid}
+ * @extends {WebInspector.HeapSnapshotViewportDataGrid}
  */
 WebInspector.HeapSnapshotDiffDataGrid = function()
 {
@@ -378,7 +472,7 @@
         removedSize: { title: WebInspector.UIString("Freed Size"), width: "72px", sortable: true },
         sizeDelta: { title: "Size Delta", width: "72px", sortable: true }
     };
-    WebInspector.HeapSnapshotSortableDataGrid.call(this, columns, true);
+    WebInspector.HeapSnapshotViewportDataGrid.call(this, columns);
 }
 
 WebInspector.HeapSnapshotDiffDataGrid.prototype = {
@@ -439,7 +533,7 @@
                 function addNodeIfNonZeroDiff(boundNode, zeroDiff)
                 {
                     if (!zeroDiff)
-                        this.rootNode().appendChild(boundNode);
+                        this.appendTopLevelNode(boundNode);
                     if (!--nodeCount)
                         this.sortingChanged();
                 }
@@ -454,7 +548,7 @@
     }
 };
 
-WebInspector.HeapSnapshotDiffDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotSortableDataGrid.prototype;
+WebInspector.HeapSnapshotDiffDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotViewportDataGrid.prototype;
 
 /**
  * @constructor

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


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js	2012-04-19 17:07:10 UTC (rev 114648)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js	2012-04-19 17:11:15 UTC (rev 114649)
@@ -31,21 +31,19 @@
 /**
  * @constructor
  * @extends {WebInspector.DataGridNode}
+ * @param {WebInspector.HeapSnapshotSortableDataGrid} tree
+ * @param {boolean} hasChildren
  */
 WebInspector.HeapSnapshotGridNode = function(tree, hasChildren)
 {
     WebInspector.DataGridNode.call(this, null, hasChildren);
     this._defaultPopulateCount = tree._defaultPopulateCount;
     this._provider = null;
+    this._dataGrid = tree;
     this.addEventListener("populate", this._populate, this);
 }
 
 WebInspector.HeapSnapshotGridNode.prototype = {
-    ensureContentCreated: function()
-    {
-        // May be overriden in descendants with lazy content.
-    },
-
     createCell: function(columnIdentifier)
     {
         var cell = WebInspector.DataGridNode.prototype.createCell.call(this, columnIdentifier);
@@ -54,6 +52,12 @@
         return cell;
     },
 
+    collapse: function()
+    {
+        WebInspector.DataGridNode.prototype.collapse.call(this);
+        this._dataGrid.updateVisibleNodes();
+    },
+
     dispose: function()
     {
         if (this._provider)
@@ -180,11 +184,11 @@
 
     sort: function()
     {
-        this.dataGrid.recursiveSortingEnter();
+        this._dataGrid.recursiveSortingEnter();
         function afterSort(sorted)
         {
             if (!sorted) {
-                this.dataGrid.recursiveSortingLeave();
+                this._dataGrid.recursiveSortingLeave();
                 return;
             }
             this._saveChildren();
@@ -197,7 +201,7 @@
                     if (child.expanded)
                         child.sort();
                 }
-                this.dataGrid.recursiveSortingLeave();
+                this._dataGrid.recursiveSortingLeave();
             }
             this.populateChildren(this._provider, null, null, afterPopulate.bind(this));
         }
@@ -211,35 +215,6 @@
  * @constructor
  * @extends {WebInspector.HeapSnapshotGridNode}
  */
-WebInspector.HeapSnapshotLazyGridNode = function(tree, hasChildren)
-{
-    WebInspector.HeapSnapshotGridNode.call(this, tree, hasChildren);
-    this._deferContentCreation = true;
-}
-
-WebInspector.HeapSnapshotLazyGridNode.prototype = {
-    ensureContentCreated: function()
-    {
-        if (!this._deferContentCreation)
-            return;
-        this._deferContentCreation = false;
-        this.createCells();
-    },
-
-    createCells: function()
-    {
-        if (this._deferContentCreation)
-            return;
-        WebInspector.HeapSnapshotGridNode.prototype.createCells.call(this);
-    }
-};
-
-WebInspector.HeapSnapshotLazyGridNode.prototype.__proto__ = WebInspector.HeapSnapshotGridNode.prototype;
-
-/**
- * @constructor
- * @extends {WebInspector.HeapSnapshotGridNode}
- */
 WebInspector.HeapSnapshotGenericObjectNode = function(tree, node)
 {
     WebInspector.HeapSnapshotGridNode.call(this, tree, false);
@@ -441,7 +416,7 @@
 
     _createChildNode: function(item)
     {
-        return new WebInspector.HeapSnapshotObjectNode(this.dataGrid, this._isFromBaseSnapshot, item, this);
+        return new WebInspector.HeapSnapshotObjectNode(this._dataGrid, this._isFromBaseSnapshot, item, this);
     },
 
     _createProvider: function(snapshot, nodeIndex, tree)
@@ -472,8 +447,8 @@
 
     comparator: function()
     {
-        var sortAscending = this.dataGrid.sortOrder === "ascending";
-        var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier;
+        var sortAscending = this._dataGrid.sortOrder === "ascending";
+        var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier;
         var sortFields = {
             object: ["!edgeName", sortAscending, "retainedSize", false],
             count: ["!edgeName", true, "retainedSize", false],
@@ -546,7 +521,7 @@
 WebInspector.HeapSnapshotInstanceNode.prototype = {
     _createChildNode: function(item)
     {
-        return new WebInspector.HeapSnapshotObjectNode(this.dataGrid, this._isDeletedNode, item, null);
+        return new WebInspector.HeapSnapshotObjectNode(this._dataGrid, this._isDeletedNode, item, null);
     },
 
     _createProvider: function(snapshot, nodeIndex)
@@ -572,8 +547,8 @@
 
     comparator: function()
     {
-        var sortAscending = this.dataGrid.sortOrder === "ascending";
-        var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier;
+        var sortAscending = this._dataGrid.sortOrder === "ascending";
+        var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier;
         var sortFields = {
             object: ["!edgeName", sortAscending, "retainedSize", false],
             distanceToWindow: ["distanceToWindow", sortAscending, "retainedSize", false],
@@ -617,11 +592,11 @@
 
 /**
  * @constructor
- * @extends {WebInspector.HeapSnapshotLazyGridNode}
+ * @extends {WebInspector.HeapSnapshotGridNode}
  */
 WebInspector.HeapSnapshotConstructorNode = function(tree, className, aggregate, aggregatesKey)
 {
-    WebInspector.HeapSnapshotLazyGridNode.call(this, tree, aggregate.count > 0);
+    WebInspector.HeapSnapshotGridNode.call(this, tree, aggregate.count > 0);
     this._name = className;
     this._distanceToWindow = aggregate.distanceToWindow;
     this._count = aggregate.count;
@@ -641,7 +616,7 @@
 
     _createChildNode: function(item)
     {
-        return new WebInspector.HeapSnapshotInstanceNode(this.dataGrid, null, this.dataGrid.snapshot, item);
+        return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid, null, this._dataGrid.snapshot, item);
     },
 
     _createNodesProvider: function(snapshot, className, aggregatesKey)
@@ -651,8 +626,8 @@
 
     comparator: function()
     {
-        var sortAscending = this.dataGrid.sortOrder === "ascending";
-        var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier;
+        var sortAscending = this._dataGrid.sortOrder === "ascending";
+        var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier;
         var sortFields = {
             object: ["id", sortAscending, "retainedSize", false],
             distanceToWindow: ["distanceToWindow", true, "retainedSize", false],
@@ -703,7 +678,7 @@
     }
 };
 
-WebInspector.HeapSnapshotConstructorNode.prototype.__proto__ = WebInspector.HeapSnapshotLazyGridNode.prototype;
+WebInspector.HeapSnapshotConstructorNode.prototype.__proto__ = WebInspector.HeapSnapshotGridNode.prototype;
 
 /**
  * @constructor
@@ -733,11 +708,11 @@
 
 /**
  * @constructor
- * @extends {WebInspector.HeapSnapshotLazyGridNode}
+ * @extends {WebInspector.HeapSnapshotGridNode}
  */
 WebInspector.HeapSnapshotDiffNode = function(tree, className, baseAggregate, aggregate)
 {
-    WebInspector.HeapSnapshotLazyGridNode.call(this, tree, true);
+    WebInspector.HeapSnapshotGridNode.call(this, tree, true);
     this._name = className;
     this._baseIndexes = baseAggregate ? baseAggregate.idxs : [];
     this._indexes = aggregate ? aggregate.idxs : [];
@@ -784,9 +759,9 @@
     _createChildNode: function(item, provider)
     {
         if (provider === this._provider._it1)
-            return new WebInspector.HeapSnapshotInstanceNode(this.dataGrid, null, provider.snapshot, item);
+            return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid, null, provider.snapshot, item);
         else
-            return new WebInspector.HeapSnapshotInstanceNode(this.dataGrid, provider.snapshot, null, item);
+            return new WebInspector.HeapSnapshotInstanceNode(this._dataGrid, provider.snapshot, null, item);
     },
 
     _createNodesProvider: function(baseSnapshot, snapshot, nodeType, nodeClassName)
@@ -821,8 +796,8 @@
 
     comparator: function()
     {
-        var sortAscending = this.dataGrid.sortOrder === "ascending";
-        var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier;
+        var sortAscending = this._dataGrid.sortOrder === "ascending";
+        var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier;
         var sortFields = {
             object: ["id", sortAscending, "selfSize", false],
             addedCount: ["selfSize", sortAscending, "id", true],
@@ -878,7 +853,7 @@
     }
 };
 
-WebInspector.HeapSnapshotDiffNode.prototype.__proto__ = WebInspector.HeapSnapshotLazyGridNode.prototype;
+WebInspector.HeapSnapshotDiffNode.prototype.__proto__ = WebInspector.HeapSnapshotGridNode.prototype;
 
 /**
  * @constructor
@@ -894,7 +869,7 @@
 WebInspector.HeapSnapshotDominatorObjectNode.prototype = {
     _createChildNode: function(item)
     {
-        return new WebInspector.HeapSnapshotDominatorObjectNode(this.dataGrid, item);
+        return new WebInspector.HeapSnapshotDominatorObjectNode(this._dataGrid, item);
     },
 
     _createProvider: function(snapshot, nodeIndex)
@@ -915,8 +890,8 @@
 
     comparator: function()
     {
-        var sortAscending = this.dataGrid.sortOrder === "ascending";
-        var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier;
+        var sortAscending = this._dataGrid.sortOrder === "ascending";
+        var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier;
         var sortFields = {
             object: ["id", sortAscending, "retainedSize", false],
             shallowSize: ["selfSize", sortAscending, "id", true],

Modified: trunk/Source/WebCore/inspector/front-end/ShowMoreDataGridNode.js (114648 => 114649)


--- trunk/Source/WebCore/inspector/front-end/ShowMoreDataGridNode.js	2012-04-19 17:07:10 UTC (rev 114648)
+++ trunk/Source/WebCore/inspector/front-end/ShowMoreDataGridNode.js	2012-04-19 17:11:15 UTC (rev 114649)
@@ -76,6 +76,15 @@
             cell = document.createElement("td");
             this._element.appendChild(cell);
         }
+    },
+
+    /**
+     * @override
+     * @return {number}
+     */
+    nodeHeight: function()
+    {
+        return 33;
     }
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to