Index: Source/devtools/front_end/HeapSnapshot.js |
diff --git a/Source/devtools/front_end/HeapSnapshot.js b/Source/devtools/front_end/HeapSnapshot.js |
index 9116d5c980a9914787332c93ebd31b6065af11e0..bfad0652cf41161e1c9026656435d8978dac992c 100644 |
--- a/Source/devtools/front_end/HeapSnapshot.js |
+++ b/Source/devtools/front_end/HeapSnapshot.js |
@@ -1301,7 +1301,7 @@ WebInspector.HeapSnapshot.prototype = { |
{ |
var nodeFieldCount = this._nodeFieldCount; |
var nodeCount = this.nodeCount; |
- var distances = new Int32Array(nodeCount); |
+ var distances = this._nodeDistances = new Int32Array(nodeCount); |
var noDistance = this._noDistance; |
for (var i = 0; i < nodeCount; ++i) |
distances[i] = noDistance; |
@@ -1310,26 +1310,25 @@ WebInspector.HeapSnapshot.prototype = { |
var nodesToVisitLength = 0; |
/** |
+ * @param {number} distance |
* @param {!WebInspector.HeapSnapshotNode} node |
*/ |
- function enqueueNode(node) |
+ function enqueueNode(distance, node) |
{ |
var ordinal = node._ordinal(); |
if (distances[ordinal] !== noDistance) |
return; |
- distances[ordinal] = 0; |
+ distances[ordinal] = distance; |
nodesToVisit[nodesToVisitLength++] = node.nodeIndex; |
} |
- this.forEachRoot(enqueueNode, true); |
+ this.forEachRoot(enqueueNode.bind(null, 1), true); |
this._bfs(nodesToVisit, nodesToVisitLength, distances); |
// bfs for the rest of objects |
nodesToVisitLength = 0; |
- this.forEachRoot(enqueueNode); |
+ this.forEachRoot(enqueueNode.bind(null, 0), false); |
this._bfs(nodesToVisit, nodesToVisitLength, distances); |
- |
- this._nodeDistances = distances; |
}, |
/** |