Title: [112268] trunk
Revision
112268
Author
[email protected]
Date
2012-03-27 07:55:27 -0700 (Tue, 27 Mar 2012)

Log Message

Web Inspector: simplify heap profiler front-end
https://bugs.webkit.org/show_bug.cgi?id=82338

Source/WebCore:

Simplify constructors of WebInspector.HeapSnapshotArraySlice and
WebInspector.HeapSnapshotEdgesProvider.

Reviewed by Pavel Feldman.

* inspector/front-end/HeapSnapshot.js:
(WebInspector.HeapSnapshotArraySlice):
(WebInspector.HeapSnapshotArraySlice.prototype.item):
(WebInspector.HeapSnapshotArraySlice.prototype.slice):
(WebInspector.HeapSnapshotNode.prototype.get rawEdges):
(WebInspector.HeapSnapshot.prototype._retainersForNode):
(WebInspector.HeapSnapshot.prototype._dominatedNodesOfNode):
(WebInspector.HeapSnapshot.prototype.createEdgesProvider):
(WebInspector.HeapSnapshotEdgesProvider):

LayoutTests:

Reviewed by Pavel Feldman.

* inspector/profiler/heap-snapshot.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (112267 => 112268)


--- trunk/LayoutTests/ChangeLog	2012-03-27 14:51:03 UTC (rev 112267)
+++ trunk/LayoutTests/ChangeLog	2012-03-27 14:55:27 UTC (rev 112268)
@@ -1,3 +1,12 @@
+2012-03-27  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: simplify heap profiler front-end
+        https://bugs.webkit.org/show_bug.cgi?id=82338
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/profiler/heap-snapshot.html:
+
 2012-03-27  Pavel Podivilov  <[email protected]>
 
         Web Inspector: dispatch breakpoint-added and breakpoint-removed events on UISourceCode.

Modified: trunk/LayoutTests/inspector/profiler/heap-snapshot.html (112267 => 112268)


--- trunk/LayoutTests/inspector/profiler/heap-snapshot.html	2012-03-27 14:51:03 UTC (rev 112267)
+++ trunk/LayoutTests/inspector/profiler/heap-snapshot.html	2012-03-27 14:55:27 UTC (rev 112268)
@@ -216,7 +216,7 @@
                 return edge.name === "b";
             }
          
-            var provider = new WebInspector.HeapSnapshotEdgesProvider(snapshot, snapshot.rootNodeIndex, edgeFilter);
+            var provider = snapshot.createEdgesProvider(snapshot.rootNodeIndex, edgeFilter);
             InspectorTest.assertEquals(1, provider.length, "edges provider length");
             provider.sort(WebInspector.HeapSnapshotFilteredOrderedIterator.prototype.createComparator(["!edgeName", false, "id", false]), 0, 0, 1);
             InspectorTest.assertEquals(1, provider.length, "edges provider length");

Modified: trunk/Source/WebCore/ChangeLog (112267 => 112268)


--- trunk/Source/WebCore/ChangeLog	2012-03-27 14:51:03 UTC (rev 112267)
+++ trunk/Source/WebCore/ChangeLog	2012-03-27 14:55:27 UTC (rev 112268)
@@ -1,3 +1,23 @@
+2012-03-27  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: simplify heap profiler front-end
+        https://bugs.webkit.org/show_bug.cgi?id=82338
+
+        Simplify constructors of WebInspector.HeapSnapshotArraySlice and
+        WebInspector.HeapSnapshotEdgesProvider.
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/front-end/HeapSnapshot.js:
+        (WebInspector.HeapSnapshotArraySlice):
+        (WebInspector.HeapSnapshotArraySlice.prototype.item):
+        (WebInspector.HeapSnapshotArraySlice.prototype.slice):
+        (WebInspector.HeapSnapshotNode.prototype.get rawEdges):
+        (WebInspector.HeapSnapshot.prototype._retainersForNode):
+        (WebInspector.HeapSnapshot.prototype._dominatedNodesOfNode):
+        (WebInspector.HeapSnapshot.prototype.createEdgesProvider):
+        (WebInspector.HeapSnapshotEdgesProvider):
+
 2012-03-27  Vsevolod Vlasov  <[email protected]>
 
         Web Inspector: Tabbed pane should set focus on its contents on tab click.

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


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2012-03-27 14:51:03 UTC (rev 112267)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2012-03-27 14:55:27 UTC (rev 112268)
@@ -211,12 +211,9 @@
     }
 };
 
-WebInspector.HeapSnapshotArraySlice = function(snapshot, arrayName, start, end)
+WebInspector.HeapSnapshotArraySlice = function(array, start, end)
 {
-    // Note: we don't reference snapshot contents directly to avoid
-    // holding references to big chunks of data.
-    this._snapshot = snapshot;
-    this._arrayName = arrayName;
+    this._array = array;
     this._start = start;
     this.length = end - start;
 }
@@ -224,14 +221,14 @@
 WebInspector.HeapSnapshotArraySlice.prototype = {
     item: function(index)
     {
-        return this._snapshot[this._arrayName][this._start + index];
+        return this._array[this._start + index];
     },
 
     slice: function(start, end)
     {
         if (typeof end === "undefined")
             end = this.length;
-        return this._snapshot[this._arrayName].subarray(this._start + start, this._start + end);
+        return this._array.subarray(this._start + start, this._start + end);
     }
 }
 
@@ -657,7 +654,7 @@
     get rawEdges()
     {
         var firstEdgeIndex = this._firstEdgeIndex();
-        return new WebInspector.HeapSnapshotArraySlice(this._snapshot, "_nodes", firstEdgeIndex, firstEdgeIndex + this.edgesCount * this._snapshot._edgeFieldsCount);
+        return new WebInspector.HeapSnapshotArraySlice(this._snapshot._nodes, firstEdgeIndex, firstEdgeIndex + this.edgesCount * this._snapshot._edgeFieldsCount);
     },
 
     get retainedSize()
@@ -986,14 +983,14 @@
     {
         var retIndexFrom = this._getRetainerIndex(node.nodeIndex);
         var retIndexTo = this._getRetainerIndex(node._nextNodeIndex);
-        return new WebInspector.HeapSnapshotArraySlice(this, "_retainers", retIndexFrom, retIndexTo);
+        return new WebInspector.HeapSnapshotArraySlice(this._retainers, retIndexFrom, retIndexTo);
     },
 
     _dominatedNodesOfNode: function(node)
     {
         var dominatedIndexFrom = this._getDominatedIndex(node.nodeIndex);
         var dominatedIndexTo = this._getDominatedIndex(node._nextNodeIndex);
-        return new WebInspector.HeapSnapshotArraySlice(this, "_dominatedNodes", dominatedIndexFrom, dominatedIndexTo);
+        return new WebInspector.HeapSnapshotArraySlice(this._dominatedNodes, dominatedIndexFrom, dominatedIndexTo);
     },
 
     _flagsOfNode: function(node)
@@ -1447,7 +1444,8 @@
 
     createEdgesProvider: function(nodeIndex, filter)
     {
-        return new WebInspector.HeapSnapshotEdgesProvider(this, nodeIndex, this._parseFilter(filter));
+        var node = new WebInspector.HeapSnapshotNode(this, nodeIndex);
+        return new WebInspector.HeapSnapshotEdgesProvider(this, nodeIndex, this._parseFilter(filter), node.edges);
     },
 
     createRetainingEdgesProvider: function(nodeIndex, filter)
@@ -1604,11 +1602,9 @@
     return {fieldName1:fieldNames[0], ascending1:fieldNames[1], fieldName2:fieldNames[2], ascending2:fieldNames[3]};
 }
 
-WebInspector.HeapSnapshotEdgesProvider = function(snapshot, nodeIndex, filter, iter)
+WebInspector.HeapSnapshotEdgesProvider = function(snapshot, nodeIndex, filter, edgesIter)
 {
     this.snapshot = snapshot;
-    var node = new WebInspector.HeapSnapshotNode(snapshot, nodeIndex);
-    var edgesIter = iter || new WebInspector.HeapSnapshotEdgeIterator(new WebInspector.HeapSnapshotEdge(snapshot, node.rawEdges));
     WebInspector.HeapSnapshotFilteredOrderedIterator.call(this, edgesIter, filter);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to