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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 */ | 135 */ |
| 136 WebInspector.HeapSnapshotItemIterator = function() { } | 136 WebInspector.HeapSnapshotItemIterator = function() { } |
| 137 | 137 |
| 138 WebInspector.HeapSnapshotItemIterator.prototype = { | 138 WebInspector.HeapSnapshotItemIterator.prototype = { |
| 139 /** | 139 /** |
| 140 * @return {boolean} | 140 * @return {boolean} |
| 141 */ | 141 */ |
| 142 hasNext: function() { }, | 142 hasNext: function() { }, |
| 143 | 143 |
| 144 /** | 144 /** |
| 145 * @return {number} | |
| 146 */ | |
| 147 index: function() { }, | |
| 148 | |
| 149 /** | |
| 150 * @param {number} newIndex | |
| 151 */ | |
| 152 setIndex: function(newIndex) { }, | |
| 153 | |
| 154 /** | |
| 155 * @return {!WebInspector.HeapSnapshotEdge|!WebInspector.HeapSnapshotNode|!W ebInspector.HeapSnapshotRetainerEdge} | 145 * @return {!WebInspector.HeapSnapshotEdge|!WebInspector.HeapSnapshotNode|!W ebInspector.HeapSnapshotRetainerEdge} |
| 156 */ | 146 */ |
| 157 item: function() { }, | 147 item: function() { }, |
| 158 | 148 |
| 159 next: function() { } | 149 next: function() { } |
| 160 }; | 150 }; |
| 161 | 151 |
| 162 | 152 |
| 153 /** | |
| 154 * @interface | |
| 155 */ | |
| 156 WebInspector.HeapSnapshotItemIndexProvider = function() { } | |
| 157 | |
| 158 WebInspector.HeapSnapshotItemIndexProvider.prototype = { | |
| 159 /** | |
| 160 * @param {!WebInspector.HeapSnapshotEdge|!WebInspector.HeapSnapshotNode|!We bInspector.HeapSnapshotRetainerEdge} item | |
| 161 * @return {number} | |
| 162 */ | |
| 163 indexForItem: function(item) { }, | |
| 164 | |
| 165 /** | |
| 166 * @param {number} newIndex | |
| 167 * @return {!WebInspector.HeapSnapshotEdge|!WebInspector.HeapSnapshotNode|!W ebInspector.HeapSnapshotRetainerEdge} | |
| 168 */ | |
| 169 itemForIndex: function(newIndex) { }, | |
| 170 }; | |
| 171 | |
| 172 /** | |
| 173 * @constructor | |
| 174 * @implements {WebInspector.HeapSnapshotItemIndexProvider} | |
| 175 * @param {!WebInspector.HeapSnapshot} snapshot | |
| 176 */ | |
| 177 WebInspector.HeapSnapshotNodeIndexProvider = function(snapshot) | |
| 178 { | |
| 179 this._node = snapshot.createNode(); | |
| 180 } | |
| 181 | |
| 182 WebInspector.HeapSnapshotNodeIndexProvider.prototype = { | |
| 183 /** | |
| 184 * @param {!WebInspector.HeapSnapshotEdge|!WebInspector.HeapSnapshotNode|!We bInspector.HeapSnapshotRetainerEdge} item | |
| 185 * @return {number} | |
| 186 */ | |
| 187 indexForItem: function(item) | |
| 188 { | |
| 189 var node = /** @type {!WebInspector.HeapSnapshotNode} */ (item); | |
| 190 return node.nodeIndex; | |
| 191 }, | |
| 192 | |
| 193 /** | |
| 194 * @param {number} index | |
| 195 * @return {!WebInspector.HeapSnapshotNode} | |
| 196 */ | |
| 197 itemForIndex: function(index) | |
| 198 { | |
| 199 this._node.nodeIndex = index; | |
| 200 return this._node; | |
| 201 } | |
| 202 }; | |
| 203 | |
| 204 | |
| 205 /** | |
| 206 * @constructor | |
| 207 * @implements {WebInspector.HeapSnapshotItemIndexProvider} | |
| 208 * @param {!WebInspector.HeapSnapshot} snapshot | |
| 209 */ | |
| 210 WebInspector.HeapSnapshotEdgeIndexProvider = function(snapshot) | |
| 211 { | |
| 212 this._edge = snapshot.createEdge(0); | |
| 213 } | |
| 214 | |
| 215 WebInspector.HeapSnapshotEdgeIndexProvider.prototype = { | |
| 216 /** | |
| 217 * @param {!WebInspector.HeapSnapshotEdge|!WebInspector.HeapSnapshotNode|!We bInspector.HeapSnapshotRetainerEdge} item | |
| 218 * @return {number} | |
| 219 */ | |
| 220 indexForItem: function(item) | |
| 221 { | |
| 222 var edge = /** @type {!WebInspector.HeapSnapshotEdge} */ (item); | |
| 223 return edge.edgeIndex; | |
| 224 }, | |
| 225 | |
| 226 /** | |
| 227 * @param {number} index | |
| 228 * @return {!WebInspector.HeapSnapshotEdge} | |
| 229 */ | |
| 230 itemForIndex: function(index) | |
| 231 { | |
| 232 this._edge.edgeIndex = index; | |
| 233 return this._edge; | |
| 234 } | |
| 235 }; | |
| 236 | |
| 237 | |
| 238 /** | |
| 239 * @constructor | |
| 240 * @implements {WebInspector.HeapSnapshotItemIndexProvider} | |
| 241 * @param {!WebInspector.HeapSnapshot} snapshot | |
| 242 */ | |
| 243 WebInspector.HeapSnapshotRetainerEdgeIndexProvider = function(snapshot) | |
| 244 { | |
| 245 this._retainerEdge = snapshot.createRetainingEdge(0); | |
| 246 } | |
| 247 | |
| 248 WebInspector.HeapSnapshotRetainerEdgeIndexProvider.prototype = { | |
| 249 /** | |
| 250 * @param {!WebInspector.HeapSnapshotEdge|!WebInspector.HeapSnapshotNode|!We bInspector.HeapSnapshotRetainerEdge} item | |
| 251 * @return {number} | |
| 252 */ | |
| 253 indexForItem: function(item) | |
| 254 { | |
| 255 var edge = /** @type {!WebInspector.HeapSnapshotRetainerEdge} */ (item); | |
| 256 return edge.retainerIndex(); | |
| 257 }, | |
| 258 | |
| 259 /** | |
| 260 * @param {number} index | |
| 261 * @return {!WebInspector.HeapSnapshotRetainerEdge} | |
| 262 */ | |
| 263 itemForIndex: function(index) | |
| 264 { | |
| 265 this._retainerEdge.setRetainerIndex(index); | |
| 266 return this._retainerEdge; | |
| 267 } | |
| 268 }; | |
| 269 | |
| 163 | 270 |
| 164 /** | 271 /** |
| 165 * @constructor | 272 * @constructor |
| 166 * @implements {WebInspector.HeapSnapshotItemIterator} | 273 * @implements {WebInspector.HeapSnapshotItemIterator} |
| 167 * @param {!WebInspector.HeapSnapshotNode} node | 274 * @param {!WebInspector.HeapSnapshotNode} node |
| 168 */ | 275 */ |
| 169 WebInspector.HeapSnapshotEdgeIterator = function(node) | 276 WebInspector.HeapSnapshotEdgeIterator = function(node) |
| 170 { | 277 { |
| 171 this._sourceNode = node; | 278 this._sourceNode = node; |
| 172 this.edge = node._snapshot.createEdge(node._edgeIndexesStart()); | 279 this.edge = node._snapshot.createEdge(node._edgeIndexesStart()); |
| 173 } | 280 } |
| 174 | 281 |
| 175 WebInspector.HeapSnapshotEdgeIterator.prototype = { | 282 WebInspector.HeapSnapshotEdgeIterator.prototype = { |
| 176 /** | 283 /** |
| 177 * @return {boolean} | 284 * @return {boolean} |
| 178 */ | 285 */ |
| 179 hasNext: function() | 286 hasNext: function() |
| 180 { | 287 { |
| 181 return this.edge.edgeIndex < this._sourceNode._edgeIndexesEnd(); | 288 return this.edge.edgeIndex < this._sourceNode._edgeIndexesEnd(); |
| 182 }, | 289 }, |
| 183 | 290 |
| 184 /** | 291 /** |
| 185 * @return {number} | |
| 186 */ | |
| 187 index: function() | |
| 188 { | |
| 189 return this.edge.edgeIndex; | |
| 190 }, | |
| 191 | |
| 192 /** | |
| 193 * @param {number} newIndex | |
| 194 */ | |
| 195 setIndex: function(newIndex) | |
| 196 { | |
| 197 this.edge.edgeIndex = newIndex; | |
| 198 }, | |
| 199 | |
| 200 /** | |
| 201 * @return {!WebInspector.HeapSnapshotEdge} | 292 * @return {!WebInspector.HeapSnapshotEdge} |
| 202 */ | 293 */ |
| 203 item: function() | 294 item: function() |
| 204 { | 295 { |
| 205 return this.edge; | 296 return this.edge; |
| 206 }, | 297 }, |
| 207 | 298 |
| 208 next: function() | 299 next: function() |
| 209 { | 300 { |
| 210 this.edge.edgeIndex += this.edge._snapshot._edgeFieldsCount; | 301 this.edge.edgeIndex += this.edge._snapshot._edgeFieldsCount; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 WebInspector.HeapSnapshotRetainerEdgeIterator.prototype = { | 457 WebInspector.HeapSnapshotRetainerEdgeIterator.prototype = { |
| 367 /** | 458 /** |
| 368 * @return {boolean} | 459 * @return {boolean} |
| 369 */ | 460 */ |
| 370 hasNext: function() | 461 hasNext: function() |
| 371 { | 462 { |
| 372 return this.retainer.retainerIndex() < this._retainersEnd; | 463 return this.retainer.retainerIndex() < this._retainersEnd; |
| 373 }, | 464 }, |
| 374 | 465 |
| 375 /** | 466 /** |
| 376 * @return {number} | |
| 377 */ | |
| 378 index: function() | |
| 379 { | |
| 380 return this.retainer.retainerIndex(); | |
| 381 }, | |
| 382 | |
| 383 /** | |
| 384 * @param {number} newIndex | |
| 385 */ | |
| 386 setIndex: function(newIndex) | |
| 387 { | |
| 388 this.retainer.setRetainerIndex(newIndex); | |
| 389 }, | |
| 390 | |
| 391 /** | |
| 392 * @return {!WebInspector.HeapSnapshotRetainerEdge} | 467 * @return {!WebInspector.HeapSnapshotRetainerEdge} |
| 393 */ | 468 */ |
| 394 item: function() | 469 item: function() |
| 395 { | 470 { |
| 396 return this.retainer; | 471 return this.retainer; |
| 397 }, | 472 }, |
| 398 | 473 |
| 399 next: function() | 474 next: function() |
| 400 { | 475 { |
| 401 this.retainer.setRetainerIndex(this.retainer.retainerIndex() + 1); | 476 this.retainer.setRetainerIndex(this.retainer.retainerIndex() + 1); |
| 402 } | 477 } |
| 403 }; | 478 }; |
| 404 | 479 |
| 405 /** | 480 /** |
| 406 * @constructor | 481 * @constructor |
| 407 * @param {number=} nodeIndex | 482 * @param {number=} nodeIndex |
| 408 */ | 483 */ |
| 409 WebInspector.HeapSnapshotNode = function(snapshot, nodeIndex) | 484 WebInspector.HeapSnapshotNode = function(snapshot, nodeIndex) |
| 410 { | 485 { |
| 411 this._snapshot = snapshot; | 486 this._snapshot = snapshot; |
| 412 this._firstNodeIndex = nodeIndex; | |
| 413 this.nodeIndex = nodeIndex; | 487 this.nodeIndex = nodeIndex; |
| 414 } | 488 } |
| 415 | 489 |
| 416 /** | 490 /** |
| 417 * @constructor | 491 * @constructor |
| 418 * @param {string} id | 492 * @param {string} id |
| 419 * @param {string} name | 493 * @param {string} name |
| 420 * @param {number} distance | 494 * @param {number} distance |
| 421 * @param {number|undefined} nodeIndex | 495 * @param {number|undefined} nodeIndex |
| 422 * @param {number} retainedSize | 496 * @param {number} retainedSize |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 629 WebInspector.HeapSnapshotNodeIterator.prototype = { | 703 WebInspector.HeapSnapshotNodeIterator.prototype = { |
| 630 /** | 704 /** |
| 631 * @return {boolean} | 705 * @return {boolean} |
| 632 */ | 706 */ |
| 633 hasNext: function() | 707 hasNext: function() |
| 634 { | 708 { |
| 635 return this.node.nodeIndex < this._nodesLength; | 709 return this.node.nodeIndex < this._nodesLength; |
| 636 }, | 710 }, |
| 637 | 711 |
| 638 /** | 712 /** |
| 639 * @return {number} | |
| 640 */ | |
| 641 index: function() | |
| 642 { | |
| 643 return /** @type{number} */ (this.node.nodeIndex); | |
| 644 }, | |
| 645 | |
| 646 /** | |
| 647 * @param {number} newIndex | |
| 648 */ | |
| 649 setIndex: function(newIndex) | |
| 650 { | |
| 651 this.node.nodeIndex = newIndex; | |
| 652 }, | |
| 653 | |
| 654 /** | |
| 655 * @return {!WebInspector.HeapSnapshotNode} | 713 * @return {!WebInspector.HeapSnapshotNode} |
| 656 */ | 714 */ |
| 657 item: function() | 715 item: function() |
| 658 { | 716 { |
| 659 return this.node; | 717 return this.node; |
| 660 }, | 718 }, |
| 661 | 719 |
| 662 next: function() | 720 next: function() |
| 663 { | 721 { |
| 664 this.node.nodeIndex = this.node._nextNodeIndex(); | 722 this.node.nodeIndex = this.node._nextNodeIndex(); |
| 665 } | 723 } |
| 666 } | 724 } |
| 667 | 725 |
| 668 | 726 |
| 669 /** | 727 /** |
| 670 * @constructor | 728 * @constructor |
| 671 * @implements {WebInspector.HeapSnapshotItemIterator} | 729 * @implements {WebInspector.HeapSnapshotItemIterator} |
| 672 * @param {!WebInspector.HeapSnapshotItemIterator} iterator | 730 * @param {!WebInspector.HeapSnapshotItemIndexProvider} indexProvider |
| 673 * @param {!Array.<number>|!Uint32Array} indexes | 731 * @param {!Array.<number>|!Uint32Array} indexes |
| 674 */ | 732 */ |
| 675 WebInspector.HeapSnapshotIndexRangeIterator = function(iterator, indexes) | 733 WebInspector.HeapSnapshotIndexRangeIterator = function(indexProvider, indexes) |
|
alph
2014/03/21 15:11:27
itemProvider?
yurys
2014/03/24 06:10:18
Done.
| |
| 676 { | 734 { |
| 677 this._iterator = iterator; | 735 this._indexProvider = indexProvider; |
| 678 this._indexes = indexes; | 736 this._indexes = indexes; |
| 679 this._position = 0; | 737 this._position = 0; |
| 680 this._forcedIndex = -1; | |
| 681 } | 738 } |
| 682 | 739 |
| 683 WebInspector.HeapSnapshotIndexRangeIterator.prototype = { | 740 WebInspector.HeapSnapshotIndexRangeIterator.prototype = { |
| 684 /** | 741 /** |
| 685 * @return {boolean} | 742 * @return {boolean} |
| 686 */ | 743 */ |
| 687 hasNext: function() | 744 hasNext: function() |
| 688 { | 745 { |
| 689 return this._position < this._indexes.length | 746 return this._position < this._indexes.length |
| 690 }, | 747 }, |
| 691 | 748 |
| 692 /** | 749 /** |
| 693 * @return {number} | |
| 694 */ | |
| 695 index: function() | |
| 696 { | |
| 697 if (this._forcedIndex !== -1) | |
| 698 return this._forcedIndex; | |
| 699 return this._indexes[this._position]; | |
| 700 }, | |
| 701 | |
| 702 /** | |
| 703 * @param {number} newIndex | |
| 704 */ | |
| 705 setIndex: function(newIndex) | |
| 706 { | |
| 707 this._forcedIndex = newIndex; | |
| 708 }, | |
| 709 | |
| 710 /** | |
| 711 * @return {!WebInspector.HeapSnapshotEdge|!WebInspector.HeapSnapshotNode|!W ebInspector.HeapSnapshotRetainerEdge} | 750 * @return {!WebInspector.HeapSnapshotEdge|!WebInspector.HeapSnapshotNode|!W ebInspector.HeapSnapshotRetainerEdge} |
| 712 */ | 751 */ |
| 713 item: function() | 752 item: function() |
| 714 { | 753 { |
| 715 this._iterator.setIndex(this.index()); | 754 var index = this._indexes[this._position]; |
| 716 return this._iterator.item(); | 755 return this._indexProvider.itemForIndex(index); |
| 717 }, | 756 }, |
| 718 | 757 |
| 719 next: function() | 758 next: function() |
| 720 { | 759 { |
| 721 ++this._position; | 760 ++this._position; |
| 722 } | 761 } |
| 723 } | 762 } |
| 724 | 763 |
| 725 | 764 |
| 726 /** | 765 /** |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 738 WebInspector.HeapSnapshotFilteredIterator.prototype = { | 777 WebInspector.HeapSnapshotFilteredIterator.prototype = { |
| 739 /** | 778 /** |
| 740 * @return {boolean} | 779 * @return {boolean} |
| 741 */ | 780 */ |
| 742 hasNext: function() | 781 hasNext: function() |
| 743 { | 782 { |
| 744 return this._iterator.hasNext(); | 783 return this._iterator.hasNext(); |
| 745 }, | 784 }, |
| 746 | 785 |
| 747 /** | 786 /** |
| 748 * @return {number} | |
| 749 */ | |
| 750 index: function() | |
| 751 { | |
| 752 return this._iterator.index(); | |
| 753 }, | |
| 754 | |
| 755 /** | |
| 756 * @param {number} newIndex | |
| 757 */ | |
| 758 setIndex: function(newIndex) | |
| 759 { | |
| 760 this._iterator.setIndex(newIndex); | |
| 761 }, | |
| 762 | |
| 763 /** | |
| 764 * @return {!WebInspector.HeapSnapshotEdge|!WebInspector.HeapSnapshotNode|!W ebInspector.HeapSnapshotRetainerEdge} | 787 * @return {!WebInspector.HeapSnapshotEdge|!WebInspector.HeapSnapshotNode|!W ebInspector.HeapSnapshotRetainerEdge} |
| 765 */ | 788 */ |
| 766 item: function() | 789 item: function() |
| 767 { | 790 { |
| 768 return this._iterator.item(); | 791 return this._iterator.item(); |
| 769 }, | 792 }, |
| 770 | 793 |
| 771 next: function() | 794 next: function() |
| 772 { | 795 { |
| 773 this._iterator.next(); | 796 this._iterator.next(); |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1893 | 1916 |
| 1894 /** | 1917 /** |
| 1895 * @param {number} nodeIndex | 1918 * @param {number} nodeIndex |
| 1896 * @param {boolean} showHiddenData | 1919 * @param {boolean} showHiddenData |
| 1897 * @return {!WebInspector.HeapSnapshotEdgesProvider} | 1920 * @return {!WebInspector.HeapSnapshotEdgesProvider} |
| 1898 */ | 1921 */ |
| 1899 createEdgesProvider: function(nodeIndex, showHiddenData) | 1922 createEdgesProvider: function(nodeIndex, showHiddenData) |
| 1900 { | 1923 { |
| 1901 var node = this.createNode(nodeIndex); | 1924 var node = this.createNode(nodeIndex); |
| 1902 var filter = this.containmentEdgesFilter(showHiddenData); | 1925 var filter = this.containmentEdgesFilter(showHiddenData); |
| 1903 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edg es()); | 1926 var indexProvider = new WebInspector.HeapSnapshotEdgeIndexProvider(this) ; |
| 1927 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edg es(), indexProvider); | |
| 1904 }, | 1928 }, |
| 1905 | 1929 |
| 1906 /** | 1930 /** |
| 1907 * @param {number} nodeIndex | 1931 * @param {number} nodeIndex |
| 1908 * @return {!WebInspector.HeapSnapshotEdgesProvider} | 1932 * @return {!WebInspector.HeapSnapshotEdgesProvider} |
| 1909 */ | 1933 */ |
| 1910 createEdgesProviderForTest: function(nodeIndex, filter) | 1934 createEdgesProviderForTest: function(nodeIndex, filter) |
| 1911 { | 1935 { |
| 1912 var node = this.createNode(nodeIndex); | 1936 var node = this.createNode(nodeIndex); |
| 1913 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edg es()); | 1937 var indexProvider = new WebInspector.HeapSnapshotEdgeIndexProvider(this) ; |
| 1938 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.edg es(), indexProvider); | |
| 1914 }, | 1939 }, |
| 1915 | 1940 |
| 1916 /** | 1941 /** |
| 1917 * @param {boolean} showHiddenData | 1942 * @param {boolean} showHiddenData |
| 1918 * @return {?function(!WebInspector.HeapSnapshotEdge):boolean} | 1943 * @return {?function(!WebInspector.HeapSnapshotEdge):boolean} |
| 1919 */ | 1944 */ |
| 1920 retainingEdgesFilter: function(showHiddenData) | 1945 retainingEdgesFilter: function(showHiddenData) |
| 1921 { | 1946 { |
| 1922 return null; | 1947 return null; |
| 1923 }, | 1948 }, |
| 1924 | 1949 |
| 1925 /** | 1950 /** |
| 1926 * @param {boolean} showHiddenData | 1951 * @param {boolean} showHiddenData |
| 1927 * @return {?function(!WebInspector.HeapSnapshotEdge):boolean} | 1952 * @return {?function(!WebInspector.HeapSnapshotEdge):boolean} |
| 1928 */ | 1953 */ |
| 1929 containmentEdgesFilter: function(showHiddenData) | 1954 containmentEdgesFilter: function(showHiddenData) |
| 1930 { | 1955 { |
| 1931 return null; | 1956 return null; |
| 1932 }, | 1957 }, |
| 1933 | 1958 |
| 1934 /** | 1959 /** |
| 1935 * @param {number} nodeIndex | 1960 * @param {number} nodeIndex |
| 1936 * @param {boolean} showHiddenData | 1961 * @param {boolean} showHiddenData |
| 1937 * @return {!WebInspector.HeapSnapshotEdgesProvider} | 1962 * @return {!WebInspector.HeapSnapshotEdgesProvider} |
| 1938 */ | 1963 */ |
| 1939 createRetainingEdgesProvider: function(nodeIndex, showHiddenData) | 1964 createRetainingEdgesProvider: function(nodeIndex, showHiddenData) |
| 1940 { | 1965 { |
| 1941 var node = this.createNode(nodeIndex); | 1966 var node = this.createNode(nodeIndex); |
| 1942 var filter = this.retainingEdgesFilter(showHiddenData); | 1967 var filter = this.retainingEdgesFilter(showHiddenData); |
| 1943 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.ret ainers()); | 1968 var indexProvider = new WebInspector.HeapSnapshotRetainerEdgeIndexProvid er(this); |
| 1969 return new WebInspector.HeapSnapshotEdgesProvider(this, filter, node.ret ainers(), indexProvider); | |
| 1944 }, | 1970 }, |
| 1945 | 1971 |
| 1946 /** | 1972 /** |
| 1947 * @param {string} baseSnapshotId | 1973 * @param {string} baseSnapshotId |
| 1948 * @param {string} className | 1974 * @param {string} className |
| 1949 * @return {!WebInspector.HeapSnapshotNodesProvider} | 1975 * @return {!WebInspector.HeapSnapshotNodesProvider} |
| 1950 */ | 1976 */ |
| 1951 createAddedNodesProvider: function(baseSnapshotId, className) | 1977 createAddedNodesProvider: function(baseSnapshotId, className) |
| 1952 { | 1978 { |
| 1953 var snapshotDiff = this._snapshotDiffs[baseSnapshotId]; | 1979 var snapshotDiff = this._snapshotDiffs[baseSnapshotId]; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2017 */ | 2043 */ |
| 2018 updateStaticData: function() | 2044 updateStaticData: function() |
| 2019 { | 2045 { |
| 2020 return new WebInspector.HeapSnapshotCommon.StaticData(this.nodeCount, th is._rootNodeIndex, this.totalSize, this._maxJsNodeId()); | 2046 return new WebInspector.HeapSnapshotCommon.StaticData(this.nodeCount, th is._rootNodeIndex, this.totalSize, this._maxJsNodeId()); |
| 2021 } | 2047 } |
| 2022 }; | 2048 }; |
| 2023 | 2049 |
| 2024 /** | 2050 /** |
| 2025 * @constructor | 2051 * @constructor |
| 2026 * @param {!WebInspector.HeapSnapshotItemIterator} iterator | 2052 * @param {!WebInspector.HeapSnapshotItemIterator} iterator |
| 2053 * @param {!WebInspector.HeapSnapshotItemIndexProvider} indexProvider | |
| 2027 */ | 2054 */ |
| 2028 WebInspector.HeapSnapshotItemProvider = function(iterator) | 2055 WebInspector.HeapSnapshotItemProvider = function(iterator, indexProvider) |
| 2029 { | 2056 { |
| 2030 this._iterator = iterator; | 2057 this._iterator = iterator; |
| 2058 this._indexProvider = indexProvider; | |
| 2031 this._isEmpty = !iterator.hasNext(); | 2059 this._isEmpty = !iterator.hasNext(); |
| 2032 /** @type {?Array.<number>} */ | 2060 /** @type {?Array.<number>} */ |
| 2033 this._iterationOrder = null; | 2061 this._iterationOrder = null; |
| 2034 this._currentComparator = null; | 2062 this._currentComparator = null; |
| 2035 this._sortedPrefixLength = 0; | 2063 this._sortedPrefixLength = 0; |
| 2036 this._sortedSuffixLength = 0; | 2064 this._sortedSuffixLength = 0; |
| 2037 } | 2065 } |
| 2038 | 2066 |
| 2039 WebInspector.HeapSnapshotItemProvider.prototype = { | 2067 WebInspector.HeapSnapshotItemProvider.prototype = { |
| 2040 _createIterationOrder: function() | 2068 _createIterationOrder: function() |
| 2041 { | 2069 { |
| 2042 if (this._iterationOrder) | 2070 if (this._iterationOrder) |
| 2043 return; | 2071 return; |
| 2044 this._iterationOrder = []; | 2072 this._iterationOrder = []; |
| 2045 for (var iterator = this._iterator; iterator.hasNext(); iterator.next()) | 2073 for (var iterator = this._iterator; iterator.hasNext(); iterator.next()) |
| 2046 this._iterationOrder.push(iterator.index()); | 2074 this._iterationOrder.push(this._indexProvider.indexForItem(iterator. item())); |
| 2047 }, | 2075 }, |
| 2048 | 2076 |
| 2049 /** | 2077 /** |
| 2050 * @return {boolean} | 2078 * @return {boolean} |
| 2051 */ | 2079 */ |
| 2052 isEmpty: function() | 2080 isEmpty: function() |
| 2053 { | 2081 { |
| 2054 return this._isEmpty; | 2082 return this._isEmpty; |
| 2055 }, | 2083 }, |
| 2056 | 2084 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 2071 if (begin <= this._sortedPrefixLength) | 2099 if (begin <= this._sortedPrefixLength) |
| 2072 this._sortedPrefixLength = end; | 2100 this._sortedPrefixLength = end; |
| 2073 if (end >= this._iterationOrder.length - this._sortedSuffixLength) | 2101 if (end >= this._iterationOrder.length - this._sortedSuffixLength) |
| 2074 this._sortedSuffixLength = this._iterationOrder.length - begin; | 2102 this._sortedSuffixLength = this._iterationOrder.length - begin; |
| 2075 } | 2103 } |
| 2076 var position = begin; | 2104 var position = begin; |
| 2077 var count = end - begin; | 2105 var count = end - begin; |
| 2078 var result = new Array(count); | 2106 var result = new Array(count); |
| 2079 var iterator = this._iterator; | 2107 var iterator = this._iterator; |
| 2080 for (var i = 0 ; i < count; ++i) { | 2108 for (var i = 0 ; i < count; ++i) { |
| 2081 iterator.setIndex(this._iterationOrder[position++]); | 2109 var itemIndex = this._iterationOrder[position++]; |
| 2082 result[i] = iterator.item().serialize(); | 2110 var item = this._indexProvider.itemForIndex(itemIndex); |
| 2111 result[i] = item.serialize(); | |
| 2083 } | 2112 } |
| 2084 return new WebInspector.HeapSnapshotCommon.ItemsRange(begin, end, this._ iterationOrder.length, result); | 2113 return new WebInspector.HeapSnapshotCommon.ItemsRange(begin, end, this._ iterationOrder.length, result); |
| 2085 }, | 2114 }, |
| 2086 | 2115 |
| 2087 sortAndRewind: function(comparator) | 2116 sortAndRewind: function(comparator) |
| 2088 { | 2117 { |
| 2089 this._currentComparator = comparator; | 2118 this._currentComparator = comparator; |
| 2090 this._sortedPrefixLength = 0; | 2119 this._sortedPrefixLength = 0; |
| 2091 this._sortedSuffixLength = 0; | 2120 this._sortedSuffixLength = 0; |
| 2092 } | 2121 } |
| 2093 } | 2122 } |
| 2094 | 2123 |
| 2095 /** | 2124 /** |
| 2096 * @constructor | 2125 * @constructor |
| 2097 * @extends {WebInspector.HeapSnapshotItemProvider} | 2126 * @extends {WebInspector.HeapSnapshotItemProvider} |
| 2127 * @param {!WebInspector.HeapSnapshotItemIndexProvider} indexProvider | |
| 2098 */ | 2128 */ |
| 2099 WebInspector.HeapSnapshotEdgesProvider = function(snapshot, filter, edgesIter) | 2129 WebInspector.HeapSnapshotEdgesProvider = function(snapshot, filter, edgesIter, i ndexProvider) |
| 2100 { | 2130 { |
| 2101 this.snapshot = snapshot; | 2131 this.snapshot = snapshot; |
| 2102 if (filter) | 2132 if (filter) |
| 2103 edgesIter = new WebInspector.HeapSnapshotFilteredIterator(edgesIter, fil ter); | 2133 edgesIter = new WebInspector.HeapSnapshotFilteredIterator(edgesIter, fil ter); |
| 2104 WebInspector.HeapSnapshotItemProvider.call(this, edgesIter); | 2134 WebInspector.HeapSnapshotItemProvider.call(this, edgesIter, indexProvider); |
| 2105 } | 2135 } |
| 2106 | 2136 |
| 2107 WebInspector.HeapSnapshotEdgesProvider.prototype = { | 2137 WebInspector.HeapSnapshotEdgesProvider.prototype = { |
| 2108 /** | 2138 /** |
| 2109 * @param {!WebInspector.HeapSnapshotCommon.ComparatorConfig} comparator | 2139 * @param {!WebInspector.HeapSnapshotCommon.ComparatorConfig} comparator |
| 2110 * @param {number} leftBound | 2140 * @param {number} leftBound |
| 2111 * @param {number} rightBound | 2141 * @param {number} rightBound |
| 2112 * @param {number} windowLeft | 2142 * @param {number} windowLeft |
| 2113 * @param {number} windowRight | 2143 * @param {number} windowRight |
| 2114 */ | 2144 */ |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2192 | 2222 |
| 2193 /** | 2223 /** |
| 2194 * @constructor | 2224 * @constructor |
| 2195 * @extends {WebInspector.HeapSnapshotItemProvider} | 2225 * @extends {WebInspector.HeapSnapshotItemProvider} |
| 2196 * @param {?function(!WebInspector.HeapSnapshotNode):boolean} filter | 2226 * @param {?function(!WebInspector.HeapSnapshotNode):boolean} filter |
| 2197 * @param {(!Array.<number>|!Uint32Array)} nodeIndexes | 2227 * @param {(!Array.<number>|!Uint32Array)} nodeIndexes |
| 2198 */ | 2228 */ |
| 2199 WebInspector.HeapSnapshotNodesProvider = function(snapshot, filter, nodeIndexes) | 2229 WebInspector.HeapSnapshotNodesProvider = function(snapshot, filter, nodeIndexes) |
| 2200 { | 2230 { |
| 2201 this.snapshot = snapshot; | 2231 this.snapshot = snapshot; |
| 2202 var it = new WebInspector.HeapSnapshotIndexRangeIterator(snapshot._allNodes( ), nodeIndexes); | 2232 var indexProvider = new WebInspector.HeapSnapshotNodeIndexProvider(snapshot) ; |
| 2233 var it = new WebInspector.HeapSnapshotIndexRangeIterator(indexProvider, node Indexes); | |
| 2203 if (filter) | 2234 if (filter) |
| 2204 it = new WebInspector.HeapSnapshotFilteredIterator(it, filter); | 2235 it = new WebInspector.HeapSnapshotFilteredIterator(it, filter); |
| 2205 WebInspector.HeapSnapshotItemProvider.call(this, it); | 2236 WebInspector.HeapSnapshotItemProvider.call(this, it, indexProvider); |
| 2206 } | 2237 } |
| 2207 | 2238 |
| 2208 WebInspector.HeapSnapshotNodesProvider.prototype = { | 2239 WebInspector.HeapSnapshotNodesProvider.prototype = { |
| 2209 /** | 2240 /** |
| 2210 * @param {string} snapshotObjectId | 2241 * @param {string} snapshotObjectId |
| 2211 * @return {number} | 2242 * @return {number} |
| 2212 */ | 2243 */ |
| 2213 nodePosition: function(snapshotObjectId) | 2244 nodePosition: function(snapshotObjectId) |
| 2214 { | 2245 { |
| 2215 this._createIterationOrder(); | 2246 this._createIterationOrder(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2280 * @param {number} windowRight | 2311 * @param {number} windowRight |
| 2281 */ | 2312 */ |
| 2282 sort: function(comparator, leftBound, rightBound, windowLeft, windowRight) | 2313 sort: function(comparator, leftBound, rightBound, windowLeft, windowRight) |
| 2283 { | 2314 { |
| 2284 this._iterationOrder.sortRange(this._buildCompareFunction(comparator), l eftBound, rightBound, windowLeft, windowRight); | 2315 this._iterationOrder.sortRange(this._buildCompareFunction(comparator), l eftBound, rightBound, windowLeft, windowRight); |
| 2285 }, | 2316 }, |
| 2286 | 2317 |
| 2287 __proto__: WebInspector.HeapSnapshotItemProvider.prototype | 2318 __proto__: WebInspector.HeapSnapshotItemProvider.prototype |
| 2288 } | 2319 } |
| 2289 | 2320 |
| OLD | NEW |