Chromium Code Reviews| 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 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 928 */ | 928 */ |
| 929 function HeapSnapshotHeader() | 929 function HeapSnapshotHeader() |
| 930 { | 930 { |
| 931 // New format. | 931 // New format. |
| 932 this.title = ""; | 932 this.title = ""; |
| 933 this.meta = new HeapSnapshotMetainfo(); | 933 this.meta = new HeapSnapshotMetainfo(); |
| 934 this.node_count = 0; | 934 this.node_count = 0; |
| 935 this.edge_count = 0; | 935 this.edge_count = 0; |
| 936 } | 936 } |
| 937 | 937 |
| 938 WebInspector.HeapSnapshot._baseSystemDistance = 100000000; | |
|
yurys
2014/04/03 09:15:12
You can place this constant into HeapSnapshotCommo
alph
2014/04/03 09:30:48
Done.
| |
| 939 | |
| 938 WebInspector.HeapSnapshot.prototype = { | 940 WebInspector.HeapSnapshot.prototype = { |
| 939 _init: function() | 941 _init: function() |
| 940 { | 942 { |
| 941 var meta = this._metaNode; | 943 var meta = this._metaNode; |
| 942 | 944 |
| 943 this._nodeTypeOffset = meta.node_fields.indexOf("type"); | 945 this._nodeTypeOffset = meta.node_fields.indexOf("type"); |
| 944 this._nodeNameOffset = meta.node_fields.indexOf("name"); | 946 this._nodeNameOffset = meta.node_fields.indexOf("name"); |
| 945 this._nodeIdOffset = meta.node_fields.indexOf("id"); | 947 this._nodeIdOffset = meta.node_fields.indexOf("id"); |
| 946 this._nodeSelfSizeOffset = meta.node_fields.indexOf("self_size"); | 948 this._nodeSelfSizeOffset = meta.node_fields.indexOf("self_size"); |
| 947 this._nodeEdgeCountOffset = meta.node_fields.indexOf("edge_count"); | 949 this._nodeEdgeCountOffset = meta.node_fields.indexOf("edge_count"); |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1322 return; | 1324 return; |
| 1323 distances[ordinal] = distance; | 1325 distances[ordinal] = distance; |
| 1324 nodesToVisit[nodesToVisitLength++] = node.nodeIndex; | 1326 nodesToVisit[nodesToVisitLength++] = node.nodeIndex; |
| 1325 } | 1327 } |
| 1326 | 1328 |
| 1327 this.forEachRoot(enqueueNode.bind(null, 1), true); | 1329 this.forEachRoot(enqueueNode.bind(null, 1), true); |
| 1328 this._bfs(nodesToVisit, nodesToVisitLength, distances); | 1330 this._bfs(nodesToVisit, nodesToVisitLength, distances); |
| 1329 | 1331 |
| 1330 // bfs for the rest of objects | 1332 // bfs for the rest of objects |
| 1331 nodesToVisitLength = 0; | 1333 nodesToVisitLength = 0; |
| 1332 this.forEachRoot(enqueueNode.bind(null, 0), false); | 1334 this.forEachRoot(enqueueNode.bind(null, WebInspector.HeapSnapshot._baseS ystemDistance), false); |
| 1333 this._bfs(nodesToVisit, nodesToVisitLength, distances); | 1335 this._bfs(nodesToVisit, nodesToVisitLength, distances); |
| 1334 }, | 1336 }, |
| 1335 | 1337 |
| 1336 /** | 1338 /** |
| 1337 * @param {!Uint32Array} nodesToVisit | 1339 * @param {!Uint32Array} nodesToVisit |
| 1338 * @param {!number} nodesToVisitLength | 1340 * @param {!number} nodesToVisitLength |
| 1339 * @param {!Int32Array} distances | 1341 * @param {!Int32Array} distances |
| 1340 */ | 1342 */ |
| 1341 _bfs: function(nodesToVisit, nodesToVisitLength, distances) | 1343 _bfs: function(nodesToVisit, nodesToVisitLength, distances) |
| 1342 { | 1344 { |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2036 id = nextId; | 2038 id = nextId; |
| 2037 } | 2039 } |
| 2038 return id; | 2040 return id; |
| 2039 }, | 2041 }, |
| 2040 | 2042 |
| 2041 /** | 2043 /** |
| 2042 * @return {!WebInspector.HeapSnapshotCommon.StaticData} | 2044 * @return {!WebInspector.HeapSnapshotCommon.StaticData} |
| 2043 */ | 2045 */ |
| 2044 updateStaticData: function() | 2046 updateStaticData: function() |
| 2045 { | 2047 { |
| 2046 return new WebInspector.HeapSnapshotCommon.StaticData(this.nodeCount, th is._rootNodeIndex, this.totalSize, this._maxJsNodeId()); | 2048 return new WebInspector.HeapSnapshotCommon.StaticData( |
| 2049 this.nodeCount, | |
| 2050 this._rootNodeIndex, | |
| 2051 this.totalSize, | |
| 2052 this._maxJsNodeId(), | |
| 2053 WebInspector.HeapSnapshot._baseSystemDistance); | |
| 2047 } | 2054 } |
| 2048 }; | 2055 }; |
| 2049 | 2056 |
| 2050 /** | 2057 /** |
| 2051 * @constructor | 2058 * @constructor |
| 2052 * @param {!WebInspector.HeapSnapshotItemIterator} iterator | 2059 * @param {!WebInspector.HeapSnapshotItemIterator} iterator |
| 2053 * @param {!WebInspector.HeapSnapshotItemIndexProvider} indexProvider | 2060 * @param {!WebInspector.HeapSnapshotItemIndexProvider} indexProvider |
| 2054 */ | 2061 */ |
| 2055 WebInspector.HeapSnapshotItemProvider = function(iterator, indexProvider) | 2062 WebInspector.HeapSnapshotItemProvider = function(iterator, indexProvider) |
| 2056 { | 2063 { |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2311 * @param {number} windowRight | 2318 * @param {number} windowRight |
| 2312 */ | 2319 */ |
| 2313 sort: function(comparator, leftBound, rightBound, windowLeft, windowRight) | 2320 sort: function(comparator, leftBound, rightBound, windowLeft, windowRight) |
| 2314 { | 2321 { |
| 2315 this._iterationOrder.sortRange(this._buildCompareFunction(comparator), l eftBound, rightBound, windowLeft, windowRight); | 2322 this._iterationOrder.sortRange(this._buildCompareFunction(comparator), l eftBound, rightBound, windowLeft, windowRight); |
| 2316 }, | 2323 }, |
| 2317 | 2324 |
| 2318 __proto__: WebInspector.HeapSnapshotItemProvider.prototype | 2325 __proto__: WebInspector.HeapSnapshotItemProvider.prototype |
| 2319 } | 2326 } |
| 2320 | 2327 |
| OLD | NEW |