Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Unified Diff: Source/devtools/front_end/HeapSnapshot.js

Issue 214713004: DevTools: Calculate user object distances from Window not from NativeContext. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/inspector/profiler/heap-snapshot-test.js ('k') | Source/devtools/front_end/JSHeapSnapshot.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
},
/**
« no previous file with comments | « LayoutTests/inspector/profiler/heap-snapshot-test.js ('k') | Source/devtools/front_end/JSHeapSnapshot.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698