Index: Source/devtools/front_end/HeapSnapshot.js |
diff --git a/Source/devtools/front_end/HeapSnapshot.js b/Source/devtools/front_end/HeapSnapshot.js |
index 12b186b808ba0a92f771c70ff81ec941b48b62a4..bd30745c4b9f24182c844736b26bc84eba82ba56 100644 |
--- a/Source/devtools/front_end/HeapSnapshot.js |
+++ b/Source/devtools/front_end/HeapSnapshot.js |
@@ -30,8 +30,42 @@ |
/** |
* @constructor |
- * @param {!WebInspector.HeapSnapshot} snapshot |
- * @param {!Uint32Array} edges |
+ * @param {!Uint32Array} array |
+ * @param {number} start |
+ * @param {number} end |
+ */ |
+WebInspector.HeapSnapshotArraySlice = function(array, start, end) |
+{ |
+ this._array = array; |
+ this._start = start; |
+ this.length = end - start; |
+} |
+ |
+WebInspector.HeapSnapshotArraySlice.prototype = { |
+ /** |
+ * @param {number} index |
+ * @return {number} |
+ */ |
+ item: function(index) |
+ { |
+ return this._array[this._start + index]; |
+ }, |
+ |
+ /** |
+ * @param {number} start |
+ * @param {number=} end |
+ * @return {!Uint32Array} |
+ */ |
+ slice: function(start, end) |
+ { |
+ if (typeof end === "undefined") |
+ end = this.length; |
+ return this._array.subarray(this._start + start, this._start + end); |
+ } |
+} |
+ |
+/** |
+ * @constructor |
* @param {number=} edgeIndex |
*/ |
WebInspector.HeapSnapshotEdge = function(snapshot, edges, edgeIndex) |
@@ -95,7 +129,15 @@ |
*/ |
nodeIndex: function() |
{ |
- return this._edges[this.edgeIndex + this._snapshot._edgeToNodeOffset]; |
+ return this._edges.item(this.edgeIndex + this._snapshot._edgeToNodeOffset); |
+ }, |
+ |
+ /** |
+ * @return {!Array.<number>} |
+ */ |
+ rawEdges: function() |
+ { |
+ return this._edges; |
}, |
/** |
@@ -125,7 +167,7 @@ |
_type: function() |
{ |
- return this._edges[this.edgeIndex + this._snapshot._edgeTypeOffset]; |
+ return this._edges.item(this.edgeIndex + this._snapshot._edgeTypeOffset); |
} |
}; |
@@ -481,11 +523,11 @@ |
}, |
/** |
- * @return {!Uint32Array} |
+ * @return {!WebInspector.HeapSnapshotArraySlice} |
*/ |
rawEdges: function() |
{ |
- return this._snapshot._containmentEdges.subarray(this._edgeIndexesStart(), this._edgeIndexesEnd()); |
+ return new WebInspector.HeapSnapshotArraySlice(this._snapshot._containmentEdges, this._edgeIndexesStart(), this._edgeIndexesEnd()); |
}, |
/** |
@@ -956,15 +998,11 @@ |
return this._firstDominatedNodeIndex[nodeIndex / this._nodeFieldCount]; |
}, |
- /** |
- * @param {!WebInspector.HeapSnapshotNode} node |
- * @return {!Uint32Array} |
- */ |
_dominatedNodesOfNode: function(node) |
{ |
var dominatedIndexFrom = this._getDominatedIndex(node.nodeIndex); |
var dominatedIndexTo = this._getDominatedIndex(node._nextNodeIndex()); |
- return this._dominatedNodes.subarray(dominatedIndexFrom, dominatedIndexTo); |
+ return new WebInspector.HeapSnapshotArraySlice(this._dominatedNodes, dominatedIndexFrom, dominatedIndexTo); |
}, |
/** |
@@ -1892,14 +1930,13 @@ |
/** |
* @constructor |
- * @param {(!Array.<number>|!Uint32Array)=} unfilteredIterationOrder |
+ * @param {!Array.<number>=} unfilteredIterationOrder |
*/ |
WebInspector.HeapSnapshotFilteredOrderedIterator = function(iterator, filter, unfilteredIterationOrder) |
{ |
this._filter = filter; |
this._iterator = iterator; |
this._unfilteredIterationOrder = unfilteredIterationOrder; |
- /** @type {?Array.<number>|?Uint32Array} */ |
this._iterationOrder = null; |
this._position = 0; |
this._currentComparator = null; |
@@ -1913,7 +1950,7 @@ |
if (this._iterationOrder) |
return; |
if (this._unfilteredIterationOrder && !this._filter) { |
- this._iterationOrder = this._unfilteredIterationOrder; |
+ this._iterationOrder = this._unfilteredIterationOrder.slice(0); |
this._unfilteredIterationOrder = null; |
return; |
} |
@@ -1928,7 +1965,8 @@ |
this._iterationOrder.push(iterator.index()); |
} |
} else { |
- var order = this._unfilteredIterationOrder; |
+ var order = this._unfilteredIterationOrder.constructor === Array ? |
+ this._unfilteredIterationOrder : this._unfilteredIterationOrder.slice(0); |
for (var i = 0, l = order.length; i < l; ++i) { |
iterator.setIndex(order[i]); |
if (this._filter(iterator.item())) |
@@ -1969,7 +2007,8 @@ |
if (this._filter(iterator.item())) |
return false; |
} else { |
- var order = this._unfilteredIterationOrder; |
+ var order = this._unfilteredIterationOrder.constructor === Array ? |
+ this._unfilteredIterationOrder : this._unfilteredIterationOrder.slice(0); |
for (var i = 0, l = order.length; i < l; ++i) { |
iterator.setIndex(order[i]); |
if (this._filter(iterator.item())) |
@@ -2139,7 +2178,7 @@ |
/** |
* @constructor |
* @extends {WebInspector.HeapSnapshotFilteredOrderedIterator} |
- * @param {(!Array.<number>|!Uint32Array)=} nodeIndexes |
+ * @param {!Array.<number>=} nodeIndexes |
*/ |
WebInspector.HeapSnapshotNodesProvider = function(snapshot, filter, nodeIndexes) |
{ |