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

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

Issue 203403002: Show live objects with given allocation call stack (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added more annotations 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 | « no previous file | Source/devtools/front_end/HeapSnapshot.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/AllocationProfile.js
diff --git a/Source/devtools/front_end/AllocationProfile.js b/Source/devtools/front_end/AllocationProfile.js
index bbba6e6d90ce3974a8eef9252d8cf701540cff3e..4980590a6a568f4ec13b36be251e2583cca95d83 100644
--- a/Source/devtools/front_end/AllocationProfile.js
+++ b/Source/devtools/front_end/AllocationProfile.js
@@ -146,19 +146,12 @@ WebInspector.AllocationProfile.prototype = {
},
/**
- * @param {string} nodeId
+ * @param {number} nodeId
* @return {!WebInspector.HeapSnapshotCommon.AllocationNodeCallers}
*/
serializeCallers: function(nodeId)
{
- var node = this._idToNode[nodeId];
- if (!node) {
- var functionInfo = this._collapsedTopNodeIdToFunctionInfo[nodeId];
- node = functionInfo.bottomUpRoot();
- delete this._collapsedTopNodeIdToFunctionInfo[nodeId];
- this._idToNode[nodeId] = node;
- }
-
+ var node = this._ensureBottomUpNode(nodeId);
var nodesWithSingleCaller = [];
while (node.callers().length === 1) {
node = node.callers()[0];
@@ -173,6 +166,31 @@ WebInspector.AllocationProfile.prototype = {
return new WebInspector.HeapSnapshotCommon.AllocationNodeCallers(nodesWithSingleCaller, branchingCallers);
},
+ /**
+ * @param {number} allocationNodeId
+ * @return {!Array.<number>}
+ */
+ traceIds: function(allocationNodeId)
+ {
+ return this._ensureBottomUpNode(allocationNodeId).traceTopIds;
+ },
+
+ /**
+ * @param {number} nodeId
+ * @return {!WebInspector.BottomUpAllocationNode}
+ */
+ _ensureBottomUpNode: function(nodeId)
+ {
+ var node = this._idToNode[nodeId];
+ if (!node) {
+ var functionInfo = this._collapsedTopNodeIdToFunctionInfo[nodeId];
+ node = functionInfo.bottomUpRoot();
+ delete this._collapsedTopNodeIdToFunctionInfo[nodeId];
+ this._idToNode[nodeId] = node;
+ }
+ return node;
+ },
+
_serializeCaller: function(node)
{
var callerId = this._nextNodeId++;
@@ -249,6 +267,7 @@ WebInspector.BottomUpAllocationNode = function(functionInfo)
this.allocationSize = 0;
this.liveCount = 0;
this.liveSize = 0;
+ this.traceTopIds = [];
this._callers = [];
}
@@ -256,7 +275,7 @@ WebInspector.BottomUpAllocationNode = function(functionInfo)
WebInspector.BottomUpAllocationNode.prototype = {
/**
* @param {!WebInspector.TopDownAllocationNode} traceNode
- * @return {!WebInspector.TopDownAllocationNode}
+ * @return {!WebInspector.BottomUpAllocationNode}
*/
addCaller: function(traceNode)
{
@@ -354,11 +373,13 @@ WebInspector.FunctionAllocationInfo.prototype = {
var size = node.allocationSize;
var liveCount = node.liveCount;
var liveSize = node.liveSize;
+ var traceId = node.id;
while (true) {
bottomUpNode.allocationCount += count;
bottomUpNode.allocationSize += size;
bottomUpNode.liveCount += liveCount;
bottomUpNode.liveSize += liveSize;
+ bottomUpNode.traceTopIds.push(traceId);
node = node.parent;
if (node === null) {
break;
« no previous file with comments | « no previous file | Source/devtools/front_end/HeapSnapshot.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698