| 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 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 else | 1401 else |
| 1402 return "\u2212"; // Math minus sign, same width as plus. | 1402 return "\u2212"; // Math minus sign, same width as plus. |
| 1403 }, | 1403 }, |
| 1404 | 1404 |
| 1405 __proto__: WebInspector.HeapSnapshotGridNode.prototype | 1405 __proto__: WebInspector.HeapSnapshotGridNode.prototype |
| 1406 } | 1406 } |
| 1407 | 1407 |
| 1408 | 1408 |
| 1409 /** | 1409 /** |
| 1410 * @constructor | 1410 * @constructor |
| 1411 * @extends {WebInspector.HeapSnapshotGenericObjectNode} | |
| 1412 * @param {!WebInspector.HeapSnapshotSortableDataGrid} dataGrid | |
| 1413 * @param {!WebInspector.HeapSnapshotCommon.Node} node | |
| 1414 */ | |
| 1415 WebInspector.HeapSnapshotDominatorObjectNode = function(dataGrid, node) | |
| 1416 { | |
| 1417 WebInspector.HeapSnapshotGenericObjectNode.call(this, dataGrid, node); | |
| 1418 this.updateHasChildren(); | |
| 1419 }; | |
| 1420 | |
| 1421 WebInspector.HeapSnapshotDominatorObjectNode.prototype = { | |
| 1422 /** | |
| 1423 * @override | |
| 1424 * @return {!WebInspector.HeapSnapshotProviderProxy} | |
| 1425 */ | |
| 1426 createProvider: function() | |
| 1427 { | |
| 1428 return this._dataGrid.snapshot.createNodesProviderForDominator(this.snap
shotNodeIndex); | |
| 1429 }, | |
| 1430 | |
| 1431 /** | |
| 1432 * @param {number} snapshotObjectId | |
| 1433 * @param {function(?WebInspector.DataGridNode)} callback | |
| 1434 */ | |
| 1435 retrieveChildBySnapshotObjectId: function(snapshotObjectId, callback) | |
| 1436 { | |
| 1437 /** | |
| 1438 * @this {WebInspector.HeapSnapshotDominatorObjectNode} | |
| 1439 */ | |
| 1440 function didExpand() | |
| 1441 { | |
| 1442 this._provider().nodePosition(snapshotObjectId, didGetNodePosition.b
ind(this)); | |
| 1443 } | |
| 1444 | |
| 1445 /** | |
| 1446 * @this {WebInspector.HeapSnapshotDominatorObjectNode} | |
| 1447 */ | |
| 1448 function didGetNodePosition(nodePosition) | |
| 1449 { | |
| 1450 if (nodePosition === -1) { | |
| 1451 this.collapse(); | |
| 1452 callback(null); | |
| 1453 } else | |
| 1454 this._populateChildren(nodePosition, null, didPopulateChildren.b
ind(this, nodePosition)); | |
| 1455 } | |
| 1456 | |
| 1457 /** | |
| 1458 * @this {WebInspector.HeapSnapshotDominatorObjectNode} | |
| 1459 */ | |
| 1460 function didPopulateChildren(nodePosition) | |
| 1461 { | |
| 1462 var child = this.childForPosition(nodePosition); | |
| 1463 callback(child); | |
| 1464 } | |
| 1465 | |
| 1466 // Make sure hasChildren flag is updated before expanding this node as u
pdateHasChildren response | |
| 1467 // may not have been received yet. | |
| 1468 this.hasChildren = true; | |
| 1469 this.expandWithoutPopulate(didExpand.bind(this)); | |
| 1470 }, | |
| 1471 | |
| 1472 _createChildNode: function(item) | |
| 1473 { | |
| 1474 return new WebInspector.HeapSnapshotDominatorObjectNode(this._dataGrid,
item); | |
| 1475 }, | |
| 1476 | |
| 1477 /** | |
| 1478 * @param {!WebInspector.HeapSnapshotCommon.Node} node | |
| 1479 * @return {number} | |
| 1480 */ | |
| 1481 _childHashForEntity: function(node) | |
| 1482 { | |
| 1483 return node.id; | |
| 1484 }, | |
| 1485 | |
| 1486 /** | |
| 1487 * @param {!WebInspector.HeapSnapshotDominatorObjectNode} childNode | |
| 1488 * @return {number} | |
| 1489 */ | |
| 1490 _childHashForNode: function(childNode) | |
| 1491 { | |
| 1492 return childNode.snapshotNodeId; | |
| 1493 }, | |
| 1494 | |
| 1495 /** | |
| 1496 * @return {!WebInspector.HeapSnapshotCommon.ComparatorConfig} | |
| 1497 */ | |
| 1498 comparator: function() | |
| 1499 { | |
| 1500 var sortAscending = this._dataGrid.isSortOrderAscending(); | |
| 1501 var sortColumnIdentifier = this._dataGrid.sortColumnIdentifier(); | |
| 1502 var sortFields = { | |
| 1503 object: ["id", sortAscending, "retainedSize", false], | |
| 1504 shallowSize: ["selfSize", sortAscending, "id", true], | |
| 1505 retainedSize: ["retainedSize", sortAscending, "id", true] | |
| 1506 }[sortColumnIdentifier]; | |
| 1507 return WebInspector.HeapSnapshotGridNode.createComparator(sortFields); | |
| 1508 }, | |
| 1509 | |
| 1510 __proto__: WebInspector.HeapSnapshotGenericObjectNode.prototype | |
| 1511 } | |
| 1512 | |
| 1513 | |
| 1514 /** | |
| 1515 * @constructor | |
| 1516 * @extends {WebInspector.HeapSnapshotGridNode} | 1411 * @extends {WebInspector.HeapSnapshotGridNode} |
| 1517 * @param {!WebInspector.AllocationDataGrid} dataGrid | 1412 * @param {!WebInspector.AllocationDataGrid} dataGrid |
| 1518 * @param {!WebInspector.HeapSnapshotCommon.SerializedAllocationNode} data | 1413 * @param {!WebInspector.HeapSnapshotCommon.SerializedAllocationNode} data |
| 1519 */ | 1414 */ |
| 1520 WebInspector.AllocationGridNode = function(dataGrid, data) | 1415 WebInspector.AllocationGridNode = function(dataGrid, data) |
| 1521 { | 1416 { |
| 1522 WebInspector.HeapSnapshotGridNode.call(this, dataGrid, data.hasChildren); | 1417 WebInspector.HeapSnapshotGridNode.call(this, dataGrid, data.hasChildren); |
| 1523 this._populated = false; | 1418 this._populated = false; |
| 1524 this._allocationNode = data; | 1419 this._allocationNode = data; |
| 1525 this.data = { | 1420 this.data = { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1607 /** | 1502 /** |
| 1608 * @return {number} | 1503 * @return {number} |
| 1609 */ | 1504 */ |
| 1610 allocationNodeId: function() | 1505 allocationNodeId: function() |
| 1611 { | 1506 { |
| 1612 return this._allocationNode.id; | 1507 return this._allocationNode.id; |
| 1613 }, | 1508 }, |
| 1614 | 1509 |
| 1615 __proto__: WebInspector.HeapSnapshotGridNode.prototype | 1510 __proto__: WebInspector.HeapSnapshotGridNode.prototype |
| 1616 } | 1511 } |
| OLD | NEW |