Commit 9ff527c8 authored by yurys@chromium.org's avatar yurys@chromium.org

Move AllocationGridNode into HeapSnapshotGridNodes.js

BUG=None

Review URL: https://codereview.chromium.org/209813003

git-svn-id: svn://svn.chromium.org/blink/trunk@169848 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 048e5748
......@@ -1128,93 +1128,3 @@ WebInspector.AllocationDataGrid.prototype = {
__proto__: WebInspector.DataGrid.prototype
}
/**
* @constructor
* @extends {WebInspector.DataGridNode}
* @param {!WebInspector.AllocationDataGrid} dataGrid
* @param {!WebInspector.HeapSnapshotCommon.SerializedAllocationNode} data
*/
WebInspector.AllocationGridNode = function(dataGrid, data)
{
WebInspector.DataGridNode.call(this, data, data.hasChildren);
this._dataGrid = dataGrid;
this._populated = false;
}
WebInspector.AllocationGridNode.prototype = {
populate: function()
{
if (this._populated)
return;
this._populated = true;
this._dataGrid.snapshot.allocationNodeCallers(this.data.id, didReceiveCallers.bind(this));
/**
* @param {!WebInspector.HeapSnapshotCommon.AllocationNodeCallers} callers
* @this {WebInspector.AllocationGridNode}
*/
function didReceiveCallers(callers)
{
var callersChain = callers.nodesWithSingleCaller;
var parentNode = this;
for (var i = 0; i < callersChain.length; i++) {
var child = new WebInspector.AllocationGridNode(this._dataGrid, callersChain[i]);
parentNode.appendChild(child);
parentNode = child;
parentNode._populated = true;
if (this.expanded)
parentNode.expand();
}
var callersBranch = callers.branchingCallers;
callersBranch.sort(this._dataGrid._createComparator());
for (var i = 0; i < callersBranch.length; i++)
parentNode.appendChild(new WebInspector.AllocationGridNode(this._dataGrid, callersBranch[i]));
}
},
/**
* @override
*/
expand: function()
{
WebInspector.DataGridNode.prototype.expand.call(this);
if (this.children.length === 1)
this.children[0].expand();
},
/**
* @override
* @param {string} columnIdentifier
* @return {!Element}
*/
createCell: function(columnIdentifier)
{
var cell = WebInspector.DataGridNode.prototype.createCell.call(this, columnIdentifier);
if (columnIdentifier !== "name")
return cell;
var functionInfo = this.data;
if (functionInfo.scriptName) {
var urlElement = this._dataGrid._linkifier.linkifyLocation(functionInfo.scriptName, functionInfo.line - 1, functionInfo.column - 1, "profile-node-file");
urlElement.style.maxWidth = "75%";
cell.insertBefore(urlElement, cell.firstChild);
}
return cell;
},
/**
* @return {number}
*/
allocationNodeId: function()
{
return this.data.id;
},
__proto__: WebInspector.DataGridNode.prototype
}
......@@ -1351,3 +1351,91 @@ WebInspector.HeapSnapshotDominatorObjectNode.prototype = {
__proto__: WebInspector.HeapSnapshotGenericObjectNode.prototype
}
/**
* @constructor
* @extends {WebInspector.DataGridNode}
* @param {!WebInspector.AllocationDataGrid} dataGrid
* @param {!WebInspector.HeapSnapshotCommon.SerializedAllocationNode} data
*/
WebInspector.AllocationGridNode = function(dataGrid, data)
{
WebInspector.DataGridNode.call(this, data, data.hasChildren);
this._dataGrid = dataGrid;
this._populated = false;
}
WebInspector.AllocationGridNode.prototype = {
populate: function()
{
if (this._populated)
return;
this._populated = true;
this._dataGrid.snapshot.allocationNodeCallers(this.data.id, didReceiveCallers.bind(this));
/**
* @param {!WebInspector.HeapSnapshotCommon.AllocationNodeCallers} callers
* @this {WebInspector.AllocationGridNode}
*/
function didReceiveCallers(callers)
{
var callersChain = callers.nodesWithSingleCaller;
var parentNode = this;
for (var i = 0; i < callersChain.length; i++) {
var child = new WebInspector.AllocationGridNode(this._dataGrid, callersChain[i]);
parentNode.appendChild(child);
parentNode = child;
parentNode._populated = true;
if (this.expanded)
parentNode.expand();
}
var callersBranch = callers.branchingCallers;
callersBranch.sort(this._dataGrid._createComparator());
for (var i = 0; i < callersBranch.length; i++)
parentNode.appendChild(new WebInspector.AllocationGridNode(this._dataGrid, callersBranch[i]));
}
},
/**
* @override
*/
expand: function()
{
WebInspector.DataGridNode.prototype.expand.call(this);
if (this.children.length === 1)
this.children[0].expand();
},
/**
* @override
* @param {string} columnIdentifier
* @return {!Element}
*/
createCell: function(columnIdentifier)
{
var cell = WebInspector.DataGridNode.prototype.createCell.call(this, columnIdentifier);
if (columnIdentifier !== "name")
return cell;
var functionInfo = this.data;
if (functionInfo.scriptName) {
var urlElement = this._dataGrid._linkifier.linkifyLocation(functionInfo.scriptName, functionInfo.line - 1, functionInfo.column - 1, "profile-node-file");
urlElement.style.maxWidth = "75%";
cell.insertBefore(urlElement, cell.firstChild);
}
return cell;
},
/**
* @return {number}
*/
allocationNodeId: function()
{
return this.data.id;
},
__proto__: WebInspector.DataGridNode.prototype
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment