Changeset 112268 in webkit


Ignore:
Timestamp:
Mar 27, 2012 7:55:27 AM (12 years ago)
Author:
yurys@chromium.org
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:
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r112266 r112268  
     12012-03-27  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Web Inspector: simplify heap profiler front-end
     4        https://bugs.webkit.org/show_bug.cgi?id=82338
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/profiler/heap-snapshot.html:
     9
    1102012-03-27  Pavel Podivilov  <podivilov@chromium.org>
    211
  • trunk/LayoutTests/inspector/profiler/heap-snapshot.html

    r112262 r112268  
    217217            }
    218218         
    219             var provider = new WebInspector.HeapSnapshotEdgesProvider(snapshot, snapshot.rootNodeIndex, edgeFilter);
     219            var provider = snapshot.createEdgesProvider(snapshot.rootNodeIndex, edgeFilter);
    220220            InspectorTest.assertEquals(1, provider.length, "edges provider length");
    221221            provider.sort(WebInspector.HeapSnapshotFilteredOrderedIterator.prototype.createComparator(["!edgeName", false, "id", false]), 0, 0, 1);
  • trunk/Source/WebCore/ChangeLog

    r112267 r112268  
     12012-03-27  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Web Inspector: simplify heap profiler front-end
     4        https://bugs.webkit.org/show_bug.cgi?id=82338
     5
     6        Simplify constructors of WebInspector.HeapSnapshotArraySlice and
     7        WebInspector.HeapSnapshotEdgesProvider.
     8
     9        Reviewed by Pavel Feldman.
     10
     11        * inspector/front-end/HeapSnapshot.js:
     12        (WebInspector.HeapSnapshotArraySlice):
     13        (WebInspector.HeapSnapshotArraySlice.prototype.item):
     14        (WebInspector.HeapSnapshotArraySlice.prototype.slice):
     15        (WebInspector.HeapSnapshotNode.prototype.get rawEdges):
     16        (WebInspector.HeapSnapshot.prototype._retainersForNode):
     17        (WebInspector.HeapSnapshot.prototype._dominatedNodesOfNode):
     18        (WebInspector.HeapSnapshot.prototype.createEdgesProvider):
     19        (WebInspector.HeapSnapshotEdgesProvider):
     20
    1212012-03-27  Vsevolod Vlasov  <vsevik@chromium.org>
    222
  • trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js

    r112262 r112268  
    212212};
    213213
    214 WebInspector.HeapSnapshotArraySlice = function(snapshot, arrayName, start, end)
     214WebInspector.HeapSnapshotArraySlice = function(array, start, end)
    215215{
    216     // Note: we don't reference snapshot contents directly to avoid
    217     // holding references to big chunks of data.
    218     this._snapshot = snapshot;
    219     this._arrayName = arrayName;
     216    this._array = array;
    220217    this._start = start;
    221218    this.length = end - start;
     
    225222    item: function(index)
    226223    {
    227         return this._snapshot[this._arrayName][this._start + index];
     224        return this._array[this._start + index];
    228225    },
    229226
     
    232229        if (typeof end === "undefined")
    233230            end = this.length;
    234         return this._snapshot[this._arrayName].subarray(this._start + start, this._start + end);
     231        return this._array.subarray(this._start + start, this._start + end);
    235232    }
    236233}
     
    658655    {
    659656        var firstEdgeIndex = this._firstEdgeIndex();
    660         return new WebInspector.HeapSnapshotArraySlice(this._snapshot, "_nodes", firstEdgeIndex, firstEdgeIndex + this.edgesCount * this._snapshot._edgeFieldsCount);
     657        return new WebInspector.HeapSnapshotArraySlice(this._snapshot._nodes, firstEdgeIndex, firstEdgeIndex + this.edgesCount * this._snapshot._edgeFieldsCount);
    661658    },
    662659
     
    987984        var retIndexFrom = this._getRetainerIndex(node.nodeIndex);
    988985        var retIndexTo = this._getRetainerIndex(node._nextNodeIndex);
    989         return new WebInspector.HeapSnapshotArraySlice(this, "_retainers", retIndexFrom, retIndexTo);
     986        return new WebInspector.HeapSnapshotArraySlice(this._retainers, retIndexFrom, retIndexTo);
    990987    },
    991988
     
    994991        var dominatedIndexFrom = this._getDominatedIndex(node.nodeIndex);
    995992        var dominatedIndexTo = this._getDominatedIndex(node._nextNodeIndex);
    996         return new WebInspector.HeapSnapshotArraySlice(this, "_dominatedNodes", dominatedIndexFrom, dominatedIndexTo);
     993        return new WebInspector.HeapSnapshotArraySlice(this._dominatedNodes, dominatedIndexFrom, dominatedIndexTo);
    997994    },
    998995
     
    14481445    createEdgesProvider: function(nodeIndex, filter)
    14491446    {
    1450         return new WebInspector.HeapSnapshotEdgesProvider(this, nodeIndex, this._parseFilter(filter));
     1447        var node = new WebInspector.HeapSnapshotNode(this, nodeIndex);
     1448        return new WebInspector.HeapSnapshotEdgesProvider(this, nodeIndex, this._parseFilter(filter), node.edges);
    14511449    },
    14521450
     
    16051603}
    16061604
    1607 WebInspector.HeapSnapshotEdgesProvider = function(snapshot, nodeIndex, filter, iter)
     1605WebInspector.HeapSnapshotEdgesProvider = function(snapshot, nodeIndex, filter, edgesIter)
    16081606{
    16091607    this.snapshot = snapshot;
    1610     var node = new WebInspector.HeapSnapshotNode(snapshot, nodeIndex);
    1611     var edgesIter = iter || new WebInspector.HeapSnapshotEdgeIterator(new WebInspector.HeapSnapshotEdge(snapshot, node.rawEdges));
    16121608    WebInspector.HeapSnapshotFilteredOrderedIterator.call(this, edgesIter, filter);
    16131609}
Note: See TracChangeset for help on using the changeset viewer.