| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 }[sortColumnIdentifier]; | 1335 }[sortColumnIdentifier]; |
| 1336 return WebInspector.HeapSnapshotGridNode.createComparator(sortFields); | 1336 return WebInspector.HeapSnapshotGridNode.createComparator(sortFields); |
| 1337 }, | 1337 }, |
| 1338 | 1338 |
| 1339 __proto__: WebInspector.HeapSnapshotGenericObjectNode.prototype | 1339 __proto__: WebInspector.HeapSnapshotGenericObjectNode.prototype |
| 1340 } | 1340 } |
| 1341 | 1341 |
| 1342 | 1342 |
| 1343 /** | 1343 /** |
| 1344 * @constructor | 1344 * @constructor |
| 1345 * @extends {WebInspector.DataGridNode} | 1345 * @extends {WebInspector.HeapSnapshotGridNode} |
| 1346 * @param {!WebInspector.AllocationDataGrid} dataGrid | 1346 * @param {!WebInspector.AllocationDataGrid} dataGrid |
| 1347 * @param {!WebInspector.HeapSnapshotCommon.SerializedAllocationNode} data | 1347 * @param {!WebInspector.HeapSnapshotCommon.SerializedAllocationNode} data |
| 1348 */ | 1348 */ |
| 1349 WebInspector.AllocationGridNode = function(dataGrid, data) | 1349 WebInspector.AllocationGridNode = function(dataGrid, data) |
| 1350 { | 1350 { |
| 1351 WebInspector.DataGridNode.call(this, data, data.hasChildren); | 1351 WebInspector.HeapSnapshotGridNode.call(this, dataGrid, data.hasChildren); |
| 1352 this._dataGrid = dataGrid; | |
| 1353 this._populated = false; | 1352 this._populated = false; |
| 1353 this.data = data; |
| 1354 } | 1354 } |
| 1355 | 1355 |
| 1356 WebInspector.AllocationGridNode.prototype = { | 1356 WebInspector.AllocationGridNode.prototype = { |
| 1357 populate: function() | 1357 populate: function() |
| 1358 { | 1358 { |
| 1359 if (this._populated) | 1359 if (this._populated) |
| 1360 return; | 1360 return; |
| 1361 this._populated = true; | 1361 this._populated = true; |
| 1362 this._dataGrid.snapshot.allocationNodeCallers(this.data.id, didReceiveCa
llers.bind(this)); | 1362 this._dataGrid.snapshot.allocationNodeCallers(this.data.id, didReceiveCa
llers.bind(this)); |
| 1363 | 1363 |
| 1364 /** | 1364 /** |
| 1365 * @param {!WebInspector.HeapSnapshotCommon.AllocationNodeCallers} calle
rs | 1365 * @param {!WebInspector.HeapSnapshotCommon.AllocationNodeCallers} calle
rs |
| 1366 * @this {WebInspector.AllocationGridNode} | 1366 * @this {WebInspector.AllocationGridNode} |
| 1367 */ | 1367 */ |
| 1368 function didReceiveCallers(callers) | 1368 function didReceiveCallers(callers) |
| 1369 { | 1369 { |
| 1370 var callersChain = callers.nodesWithSingleCaller; | 1370 var callersChain = callers.nodesWithSingleCaller; |
| 1371 var parentNode = this; | 1371 var parentNode = this; |
| 1372 var dataGrid = /** @type {!WebInspector.AllocationDataGrid} */ (this
._dataGrid); |
| 1372 for (var i = 0; i < callersChain.length; i++) { | 1373 for (var i = 0; i < callersChain.length; i++) { |
| 1373 var child = new WebInspector.AllocationGridNode(this._dataGrid,
callersChain[i]); | 1374 var child = new WebInspector.AllocationGridNode(dataGrid, caller
sChain[i]); |
| 1374 parentNode.appendChild(child); | 1375 dataGrid.appendNode(parentNode, child); |
| 1375 parentNode = child; | 1376 parentNode = child; |
| 1376 parentNode._populated = true; | 1377 parentNode._populated = true; |
| 1377 if (this.expanded) | 1378 if (this.expanded) |
| 1378 parentNode.expand(); | 1379 parentNode.expand(); |
| 1379 } | 1380 } |
| 1380 | 1381 |
| 1381 var callersBranch = callers.branchingCallers; | 1382 var callersBranch = callers.branchingCallers; |
| 1382 callersBranch.sort(this._dataGrid._createComparator()); | 1383 callersBranch.sort(this._dataGrid._createComparator()); |
| 1383 for (var i = 0; i < callersBranch.length; i++) | 1384 for (var i = 0; i < callersBranch.length; i++) |
| 1384 parentNode.appendChild(new WebInspector.AllocationGridNode(this.
_dataGrid, callersBranch[i])); | 1385 dataGrid.appendNode(parentNode, new WebInspector.AllocationGridN
ode(dataGrid, callersBranch[i])); |
| 1386 dataGrid.updateVisibleNodes(true); |
| 1385 } | 1387 } |
| 1386 }, | 1388 }, |
| 1387 | 1389 |
| 1388 /** | 1390 /** |
| 1389 * @override | 1391 * @override |
| 1390 */ | 1392 */ |
| 1391 expand: function() | 1393 expand: function() |
| 1392 { | 1394 { |
| 1393 WebInspector.DataGridNode.prototype.expand.call(this); | 1395 WebInspector.HeapSnapshotGridNode.prototype.expand.call(this); |
| 1394 if (this.children.length === 1) | 1396 if (this.children.length === 1) |
| 1395 this.children[0].expand(); | 1397 this.children[0].expand(); |
| 1396 }, | 1398 }, |
| 1397 | 1399 |
| 1398 /** | 1400 /** |
| 1399 * @override | 1401 * @override |
| 1400 * @param {string} columnIdentifier | 1402 * @param {string} columnIdentifier |
| 1401 * @return {!Element} | 1403 * @return {!Element} |
| 1402 */ | 1404 */ |
| 1403 createCell: function(columnIdentifier) | 1405 createCell: function(columnIdentifier) |
| 1404 { | 1406 { |
| 1405 var cell = WebInspector.DataGridNode.prototype.createCell.call(this, col
umnIdentifier); | 1407 var cell = WebInspector.HeapSnapshotGridNode.prototype.createCell.call(t
his, columnIdentifier); |
| 1406 | 1408 |
| 1407 if (columnIdentifier !== "name") | 1409 if (columnIdentifier !== "name") |
| 1408 return cell; | 1410 return cell; |
| 1409 | 1411 |
| 1410 var functionInfo = this.data; | 1412 var functionInfo = this.data; |
| 1411 if (functionInfo.scriptName) { | 1413 if (functionInfo.scriptName) { |
| 1412 var urlElement = this._dataGrid._linkifier.linkifyLocation(functionI
nfo.scriptName, functionInfo.line - 1, functionInfo.column - 1, "profile-node-fi
le"); | 1414 var urlElement = this._dataGrid._linkifier.linkifyLocation(functionI
nfo.scriptName, functionInfo.line - 1, functionInfo.column - 1, "profile-node-fi
le"); |
| 1413 urlElement.style.maxWidth = "75%"; | 1415 urlElement.style.maxWidth = "75%"; |
| 1414 cell.insertBefore(urlElement, cell.firstChild); | 1416 cell.insertBefore(urlElement, cell.firstChild); |
| 1415 } | 1417 } |
| 1416 | 1418 |
| 1417 return cell; | 1419 return cell; |
| 1418 }, | 1420 }, |
| 1419 | 1421 |
| 1420 /** | 1422 /** |
| 1421 * @return {number} | 1423 * @return {number} |
| 1422 */ | 1424 */ |
| 1423 allocationNodeId: function() | 1425 allocationNodeId: function() |
| 1424 { | 1426 { |
| 1425 return this.data.id; | 1427 return this.data.id; |
| 1426 }, | 1428 }, |
| 1427 | 1429 |
| 1428 __proto__: WebInspector.DataGridNode.prototype | 1430 __proto__: WebInspector.HeapSnapshotGridNode.prototype |
| 1429 } | 1431 } |
| OLD | NEW |