Changeset 83718 in webkit
- Timestamp:
- Apr 13, 2011 4:35:00 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r83717 r83718 1 2011-04-13 Mikhail Naganov <mnaganov@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: [Chromium] Prepare to move detailed heap snapshots storage and processing into workers. 6 https://bugs.webkit.org/show_bug.cgi?id=58320 7 8 Introduce a proxy object that emulates worker behavior and change UI code to cope with it. 9 10 * inspector/profiler/detailed-heapshots-test.js: 11 (initialize_DetailedHeapshotTest): 12 1 13 2011-04-13 Csaba Osztrogonác <ossy@webkit.org> 2 14 -
trunk/LayoutTests/inspector/profiler/detailed-heapshots-test.js
r83581 r83718 170 170 function sortingComplete() 171 171 { 172 this._currentGrid().removeEventListener("sorting complete", sortingComplete, this);173 172 InspectorTest.assertEquals(column.identifier, this._currentGrid().sortColumnIdentifier, "unexpected sorting"); 174 173 column.sort = this._currentGrid().sortOrder; … … 179 178 setTimeout(callCallback, 0); 180 179 } 181 this._currentGrid().addEventListener("sorting complete", sortingComplete, this);180 InspectorTest._prepareForRecursiveSort(sortingComplete.bind(this)); 182 181 this._currentGrid()._clickInHeaderCell(event); 183 182 }; … … 360 359 return; 361 360 } 362 function sortingComplete() 363 { 364 view.views[index].grid.removeEventListener("sorting complete", sortingComplete, this); 365 setTimeout(callback, 0); 366 } 367 view.views[index].grid.addEventListener("sorting complete", sortingComplete, this); 361 InspectorTest._prepareForRecursiveSort(callback, view.views[index].grid); 368 362 view._changeView({target: {selectedIndex: index}}); 369 363 }; … … 399 393 }; 400 394 395 InspectorTest._prepareForRecursiveSort = function(callback, grid) 396 { 397 if (InspectorTest._recursiveSortCallback) 398 console.error("Didn't finished with previous sorting"); 399 InspectorTest._recursiveSortCallback = callback; 400 InspectorTest._recursiveSortDepth = 0; 401 grid = grid || InspectorTest._currentGrid(); 402 grid.addEventListener("start sorting", InspectorTest._recursiveSortEnter, InspectorTest); 403 grid.addEventListener("sorting complete", InspectorTest._recursiveSortLeave, InspectorTest); 404 InspectorTest._recursiveSortGrid = grid; 405 }; 406 407 InspectorTest._recursiveSortEnter = function() 408 { 409 ++InspectorTest._recursiveSortDepth; 410 if (isNaN(InspectorTest._recursiveSortDepth)) 411 console.error("Wasn't prepared to track sorting"); 412 }; 413 414 InspectorTest._recursiveSortLeave = function() 415 { 416 if (!--InspectorTest._recursiveSortDepth) { 417 var callback = InspectorTest._recursiveSortCallback; 418 delete InspectorTest._recursiveSortCallback; 419 InspectorTest._recursiveSortGrid.removeEventListener("start sorting", InspectorTest._recursiveSortEnter, InspectorTest); 420 InspectorTest._recursiveSortGrid.removeEventListener("sorting complete", InspectorTest._recursiveSortLeave, InspectorTest); 421 setTimeout(callback, 0); 422 } 423 if (!(InspectorTest._recursiveSortDepth >= 0)) 424 console.error("Bad sort nesting"); 425 }; 426 401 427 InspectorTest._snapshotViewShown = function() 402 428 { -
trunk/Source/WebCore/ChangeLog
r83716 r83718 1 2011-04-13 Mikhail Naganov <mnaganov@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: [Chromium] Prepare to move detailed heap snapshots storage and processing into workers. 6 https://bugs.webkit.org/show_bug.cgi?id=58320 7 8 Introduce a proxy object that emulates worker behavior and change UI code to cope with it. 9 10 * WebCore.gypi: 11 * WebCore.vcproj/WebCore.vcproj: 12 * inspector/front-end/DetailedHeapshotGridNodes.js: 13 (WebInspector.HeapSnapshotGridNode.prototype._populate.doPopulate.sorted): 14 (WebInspector.HeapSnapshotGridNode.prototype._populate.doPopulate): 15 (WebInspector.HeapSnapshotGridNode.prototype._populate): 16 (WebInspector.HeapSnapshotGridNode.prototype.populateChildren.childrenRetrieved.notify): 17 (WebInspector.HeapSnapshotGridNode.prototype.populateChildren.childrenRetrieved): 18 (WebInspector.HeapSnapshotGridNode.prototype.populateChildren): 19 (WebInspector.HeapSnapshotGridNode.prototype.sort.doSort.afterSort.afterPopulate): 20 (WebInspector.HeapSnapshotGridNode.prototype.sort.doSort.afterSort): 21 (WebInspector.HeapSnapshotGridNode.prototype.sort): 22 (WebInspector.HeapSnapshotGenericObjectNode): 23 (WebInspector.HeapSnapshotGenericObjectNode.prototype.get _shallowSizePercent): 24 (WebInspector.HeapSnapshotGenericObjectNode.prototype._updateHasChildren): 25 (WebInspector.HeapSnapshotObjectNode): 26 (WebInspector.HeapSnapshotObjectNode.prototype._createChildNode): 27 (WebInspector.HeapSnapshotObjectNode.prototype._createProvider): 28 (WebInspector.HeapSnapshotInstanceNode): 29 (WebInspector.HeapSnapshotInstanceNode.prototype._createChildNode): 30 (WebInspector.HeapSnapshotInstanceNode.prototype._createProvider): 31 (WebInspector.HeapSnapshotConstructorNode.prototype._createChildNode): 32 (WebInspector.HeapSnapshotConstructorNode.prototype._createNodesProvider): 33 (WebInspector.HeapSnapshotIteratorsTuple.prototype.sortAndRewind): 34 (WebInspector.HeapSnapshotDiffNode.prototype._calculateDiff): 35 (WebInspector.HeapSnapshotDiffNode.prototype._createChildNode): 36 (WebInspector.HeapSnapshotDiffNode.prototype._createNodesProvider.createProvider): 37 (WebInspector.HeapSnapshotDiffNode.prototype._createNodesProvider): 38 (WebInspector.HeapSnapshotDiffNode.prototype._childHashForEntity): 39 (WebInspector.HeapSnapshotDiffNode.prototype._childHashForNode): 40 (WebInspector.HeapSnapshotDiffNode.prototype.populateChildren.firstProviderPopulated): 41 (WebInspector.HeapSnapshotDiffNode.prototype.populateChildren.else.firstProviderPopulated): 42 (WebInspector.HeapSnapshotDiffNode.prototype.populateChildren): 43 (WebInspector.HeapSnapshotDominatorObjectNode): 44 (WebInspector.HeapSnapshotDominatorObjectNode.prototype._createChildNode): 45 (WebInspector.HeapSnapshotDominatorObjectNode.prototype._createProvider): 46 * inspector/front-end/DetailedHeapshotView.js: 47 (WebInspector.HeapSnapshotSortableDataGrid.prototype.sortingChanged): 48 (WebInspector.HeapSnapshotSortableDataGrid.prototype._performSorting): 49 (WebInspector.HeapSnapshotConstructorsDataGrid.prototype.setDataSource): 50 (WebInspector.HeapSnapshotConstructorsDataGrid.prototype.populateChildren): 51 (WebInspector.HeapSnapshotDiffDataGrid.prototype.setBaseDataSource.baseSnapshotNodeIdsReceived): 52 (WebInspector.HeapSnapshotDiffDataGrid.prototype.setBaseDataSource.pushBaseSnapshotNodeIds): 53 (WebInspector.HeapSnapshotDiffDataGrid.prototype.setBaseDataSource.snapshotNodeIdsReceived): 54 (WebInspector.HeapSnapshotDiffDataGrid.prototype.setBaseDataSource): 55 (WebInspector.HeapSnapshotDiffDataGrid.prototype.populateChildren.baseAggregatesReceived.aggregatesReceived): 56 (WebInspector.HeapSnapshotDiffDataGrid.prototype.populateChildren): 57 (WebInspector.HeapSnapshotRetainingPathsList): 58 (WebInspector.HeapSnapshotRetainingPathsList.prototype._resetPaths): 59 (WebInspector.HeapSnapshotRetainingPathsList.prototype.setDataSource): 60 (WebInspector.HeapSnapshotRetainingPathsList.prototype.refresh): 61 (WebInspector.HeapSnapshotRetainingPathsList.prototype.showNext.pathFound): 62 (WebInspector.HeapSnapshotRetainingPathsList.prototype.showNext.startSearching): 63 (WebInspector.HeapSnapshotRetainingPathsList.prototype.showNext): 64 (WebInspector.DetailedHeapshotView.profileCallback): 65 (WebInspector.DetailedHeapshotView): 66 (WebInspector.DetailedHeapshotView.prototype.get profileWrapper): 67 (WebInspector.DetailedHeapshotView.prototype.get baseProfileWrapper): 68 (WebInspector.DetailedHeapshotView.prototype.show.profileCallback1): 69 (WebInspector.DetailedHeapshotView.prototype.show.profileCallback2): 70 (WebInspector.DetailedHeapshotView.prototype.show): 71 (WebInspector.DetailedHeapshotView.prototype._changeBase.baseProfileLoaded): 72 * inspector/front-end/HeapSnapshot.js: 73 * inspector/front-end/HeapSnapshotProxy.js: Added. 74 * inspector/front-end/PleaseWaitMessage.js: 75 * inspector/front-end/ProfilesPanel.js: 76 (WebInspector.ProfilesPanel.prototype._reset): 77 (WebInspector.ProfilesPanel.prototype.loadHeapSnapshot): 78 (WebInspector.ProfilesPanel.prototype._addHeapSnapshotChunk): 79 (WebInspector.ProfilesPanel.prototype._finishHeapSnapshot.doParse): 80 (WebInspector.ProfilesPanel.prototype._finishHeapSnapshot.else.parsed): 81 (WebInspector.ProfilesPanel.prototype._finishHeapSnapshot): 82 * inspector/front-end/WebKit.qrc: 83 * inspector/front-end/inspector.html: 84 1 85 2011-04-13 Alexander Pavlov <apavlov@chromium.org> 2 86 -
trunk/Source/WebCore/WebCore.gypi
r83641 r83718 6183 6183 'inspector/front-end/HAREntry.js', 6184 6184 'inspector/front-end/HeapSnapshot.js', 6185 'inspector/front-end/HeapSnapshotProxy.js', 6185 6186 'inspector/front-end/HeapSnapshotView.js', 6186 6187 'inspector/front-end/HelpScreen.js', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r83636 r83718 67066 67066 </File> 67067 67067 <File 67068 RelativePath="..\inspector\front-end\HeapSnapshotProxy.js" 67069 > 67070 </File> 67071 <File 67068 67072 RelativePath="..\inspector\front-end\HeapSnapshotView.js" 67069 67073 > -
trunk/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js
r83286 r83718 53 53 { 54 54 this.removeEventListener("populate", this._populate, this); 55 this._provider.sort(this.comparator()); 56 this._provider.first(); 57 this.populateChildren(); 58 } 59 }, 60 61 populateChildren: function(provider, howMany, atIndex, suppressNotifyAboutCompletion) 55 function sorted(ignored) 56 { 57 this.populateChildren(); 58 } 59 this._provider.sortAndRewind(this.comparator(), sorted.bind(this)); 60 } 61 }, 62 63 populateChildren: function(provider, howMany, atIndex, afterPopulate, suppressNotifyAboutCompletion) 62 64 { 63 65 if (!howMany && provider) { … … 78 80 } 79 81 } 80 for ( ; howMany > 0 && provider.hasNext(); provider.next(), ++provider.instanceCount, --howMany) { 81 var item = provider.item; 82 if (haveSavedChildren) { 83 var hash = this._childHashForEntity(item); 84 if (hash in this._savedChildren) { 85 this.insertChild(this._savedChildren[hash], atIndex++); 86 continue; 82 83 function childrenRetrieved(items, hasNext, length) 84 { 85 for (var i = 0, l = items.length; i < l; ++i) { 86 var item = items[i]; 87 if (haveSavedChildren) { 88 var hash = this._childHashForEntity(item); 89 if (hash in this._savedChildren) { 90 this.insertChild(this._savedChildren[hash], atIndex++); 91 continue; 92 } 87 93 } 94 this.insertChild(this._createChildNode(item, provider), atIndex++); 88 95 } 89 this.insertChild(this._createChildNode(provider), atIndex++); 90 } 91 if (provider.hasNext()) 92 this.insertChild(new WebInspector.ShowMoreDataGridNode(this.populateChildren.bind(this, provider), this._defaultPopulateCount, provider.length), atIndex++); 93 if (!suppressNotifyAboutCompletion) 94 this.dispatchEventToListeners("populate complete"); 96 provider.instanceCount += items.length; 97 98 if (hasNext) 99 this.insertChild(new WebInspector.ShowMoreDataGridNode(this.populateChildren.bind(this, provider), this._defaultPopulateCount, length), atIndex++); 100 if (afterPopulate) 101 afterPopulate(); 102 if (!suppressNotifyAboutCompletion) { 103 function notify() 104 { 105 this.dispatchEventToListeners("populate complete"); 106 } 107 setTimeout(notify.bind(this), 0); 108 } 109 } 110 provider.getNextItems(howMany, childrenRetrieved.bind(this)); 95 111 }, 96 112 … … 107 123 sort: function() 108 124 { 109 var comparator = this.comparator();110 WebInspector.PleaseWaitMessage.prototype.startAction(this.dataGrid.element, doSort.bind(this));111 112 125 function doSort() 113 126 { 114 if (this._provider.sort(comparator)) { 127 function afterSort(sorted) 128 { 129 if (!sorted) 130 return; 115 131 this._saveChildren(); 116 132 this.removeChildren(); 117 this._provider.first(); 118 this.populateChildren(this._provider); 119 for (var i = 0, l = this.children.length; i < l; ++i) { 120 var child = this.children[i]; 121 if (child.expanded) 122 child.sort(); 133 134 function afterPopulate() 135 { 136 for (var i = 0, l = this.children.length; i < l; ++i) { 137 var child = this.children[i]; 138 if (child.expanded) 139 child.sort(); 140 } 141 this.dataGrid.dispatchEventToListeners("sorting complete"); 123 142 } 143 this.populateChildren(this._provider, null, null, afterPopulate.bind(this)); 124 144 } 125 if (this.dataGrid === this) 126 this.dispatchEventToListeners("sorting complete"); 127 } 145 this._provider.sortAndRewind(this.comparator(), afterSort.bind(this)); 146 } 147 this.dataGrid.dispatchEventToListeners("start sorting"); 148 WebInspector.PleaseWaitMessage.prototype.startAction(this.dataGrid.element, doSort.bind(this)); 128 149 } 129 150 }; … … 131 152 WebInspector.HeapSnapshotGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype; 132 153 133 WebInspector.HeapSnapshotGenericObjectNode = function(tree, node , hasChildren)134 { 135 WebInspector.HeapSnapshotGridNode.call(this, tree, hasChildren);154 WebInspector.HeapSnapshotGenericObjectNode = function(tree, node) 155 { 156 WebInspector.HeapSnapshotGridNode.call(this, tree, false); 136 157 this._name = node.name; 137 158 this._type = node.type; … … 223 244 { 224 245 return this._shallowSize / this.dataGrid.snapshot.totalSize * 100.0; 246 }, 247 248 _updateHasChildren: function() 249 { 250 function isEmptyCallback(isEmpty) 251 { 252 this.hasChildren = !isEmpty; 253 } 254 this._provider.isEmpty(isEmptyCallback.bind(this)); 225 255 } 226 256 } … … 230 260 WebInspector.HeapSnapshotObjectNode = function(tree, edge) 231 261 { 232 var provider = this._createProvider(tree.snapshot, edge.nodeIndex); 233 WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, edge.node, !provider.isEmpty); 262 WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, edge.node); 234 263 this._referenceName = edge.name; 235 264 this._referenceType = edge.type; 236 this._provider = provider; 265 this._provider = this._createProvider(tree.snapshot, edge.nodeIndex); 266 this._updateHasChildren(); 237 267 } 238 268 239 269 WebInspector.HeapSnapshotObjectNode.prototype = { 240 _createChildNode: function( provider)241 { 242 return new WebInspector.HeapSnapshotObjectNode(this.dataGrid, provider.item);270 _createChildNode: function(item) 271 { 272 return new WebInspector.HeapSnapshotObjectNode(this.dataGrid, item); 243 273 }, 244 274 … … 246 276 { 247 277 var showHiddenData = WebInspector.DetailedHeapshotView.prototype.showHiddenData; 248 return new WebInspector.HeapSnapshotEdgesProvider( 249 snapshot, 278 return snapshot.createEdgesProvider( 250 279 nodeIndex, 251 280 function(edge) { … … 319 348 WebInspector.HeapSnapshotInstanceNode = function(tree, baseSnapshot, snapshot, node) 320 349 { 321 var provider = this._createProvider(baseSnapshot || snapshot, node.nodeIndex); 322 WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, node, !provider.isEmpty); 350 WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, node); 323 351 this._isDeletedNode = !!baseSnapshot; 324 this._provider = provider; 352 this._provider = this._createProvider(baseSnapshot || snapshot, node.nodeIndex); 353 this._updateHasChildren(); 325 354 }; 326 355 327 356 WebInspector.HeapSnapshotInstanceNode.prototype = { 328 _createChildNode: function( provider)329 { 330 return new WebInspector.HeapSnapshotObjectNode(this.dataGrid, provider.item);357 _createChildNode: function(item) 358 { 359 return new WebInspector.HeapSnapshotObjectNode(this.dataGrid, item); 331 360 }, 332 361 … … 334 363 { 335 364 var showHiddenData = WebInspector.DetailedHeapshotView.prototype.showHiddenData; 336 return new WebInspector.HeapSnapshotEdgesProvider( 337 snapshot, 365 return snapshot.createEdgesProvider( 338 366 nodeIndex, 339 367 function(edge) { … … 403 431 404 432 WebInspector.HeapSnapshotConstructorNode.prototype = { 405 _createChildNode: function( provider)406 { 407 return new WebInspector.HeapSnapshotInstanceNode(this.dataGrid, null, this.dataGrid.snapshot, provider.item);433 _createChildNode: function(item) 434 { 435 return new WebInspector.HeapSnapshotInstanceNode(this.dataGrid, null, this.dataGrid.snapshot, item); 408 436 }, 409 437 410 438 _createNodesProvider: function(snapshot, nodeType, nodeClassName) 411 439 { 412 return new WebInspector.HeapSnapshotNodesProvider( 413 snapshot, 440 return snapshot.createNodesProvider( 414 441 function (node) { 415 442 return node.type === nodeType … … 476 503 477 504 WebInspector.HeapSnapshotIteratorsTuple.prototype = { 478 first: function() 479 { 480 this._it1.first(); 481 this._it2.first(); 482 }, 483 484 sort: function(comparator) 485 { 486 this._it1.sort(comparator); 487 this._it2.sort(comparator); 505 sortAndRewind: function(comparator, callback) 506 { 507 function afterSort(ignored) 508 { 509 this._it2.sortAndRewind(comparator, callback); 510 } 511 this._it1.sortAndRewind(comparator, afterSort.bind(this)); 488 512 } 489 513 }; … … 510 534 this._addedSize = 0; 511 535 this._removedSize = 0; 512 var nodeA = new WebInspector.HeapSnapshotNode(baseSnapshot );513 var nodeB = new WebInspector.HeapSnapshotNode(snapshot );536 var nodeA = new WebInspector.HeapSnapshotNode(baseSnapshot._snapshot); 537 var nodeB = new WebInspector.HeapSnapshotNode(snapshot._snapshot); 514 538 nodeA.nodeIndex = baseIndexes[i]; 515 539 nodeB.nodeIndex = currentIndexes[j]; … … 536 560 this._addedCount++; 537 561 this._addedSize += nodeB.selfSize; 538 nodeB.nodeIndex = currentIndexes[++j]; 562 nodeB.nodeIndex = currentIndexes[++j]; 539 563 } 540 564 this._countDelta = this._addedCount - this._removedCount; … … 542 566 }, 543 567 544 _createChildNode: function( provider)568 _createChildNode: function(item, provider) 545 569 { 546 570 if (provider === this._provider._it1) 547 return new WebInspector.HeapSnapshotInstanceNode(this.dataGrid, null, provider.snapshot, provider.item);571 return new WebInspector.HeapSnapshotInstanceNode(this.dataGrid, null, provider.snapshot, item); 548 572 else 549 return new WebInspector.HeapSnapshotInstanceNode(this.dataGrid, provider.snapshot, null, provider.item);573 return new WebInspector.HeapSnapshotInstanceNode(this.dataGrid, provider.snapshot, null, item); 550 574 }, 551 575 … … 557 581 function createProvider(snapshot, otherSnapshot) 558 582 { 559 return new WebInspector.HeapSnapshotNodesProvider(560 snapshot,583 var otherSnapshotId = otherSnapshot.uid; 584 var provider = snapshot.createNodesProvider( 561 585 function (node) { 562 586 return node.type === nodeType 563 587 && (nodeClassName === null || node.className === nodeClassName) 564 && ! otherSnapshot.hasId(node.id);588 && !this.snapshotHasNodeWithId(otherSnapshotId, node.id); 565 589 }); 566 } 590 provider.snapshot = snapshot; 591 return provider; 592 } 593 }, 594 595 _childHashForEntity: function(node) 596 { 597 return node.id; 598 }, 599 600 _childHashForNode: function(childNode) 601 { 602 return childNode.snapshotNodeId; 567 603 }, 568 604 … … 583 619 }, 584 620 585 populateChildren: function(provider, howMany, atIndex )621 populateChildren: function(provider, howMany, atIndex, afterPopulate) 586 622 { 587 623 if (!provider && !howMany) { 588 WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, this._provider._it1, this._defaultPopulateCount, null, true); 589 WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, this._provider._it2, this._defaultPopulateCount); 624 var firstProviderPopulated = function() 625 { 626 WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, this._provider._it2, this._defaultPopulateCount, atIndex, afterPopulate); 627 }; 628 WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, this._provider._it1, this._defaultPopulateCount, atIndex, firstProviderPopulated.bind(this), true); 590 629 } else if (!howMany) { 591 WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, this._provider._it1, null, null, true); 592 WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, this._provider._it2); 630 var firstProviderPopulated = function() 631 { 632 WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, this._provider._it2, null, atIndex, afterPopulate); 633 }; 634 WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, this._provider._it1, null, atIndex, firstProviderPopulated.bind(this), true); 593 635 } else 594 WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, provider, howMany, atIndex );636 WebInspector.HeapSnapshotGridNode.prototype.populateChildren.call(this, provider, howMany, atIndex, afterPopulate); 595 637 }, 596 638 … … 629 671 WebInspector.HeapSnapshotDominatorObjectNode = function(tree, node) 630 672 { 631 var provider = this._createProvider(tree.snapshot, node.nodeIndex);632 WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, node, !provider.isEmpty);633 this._ provider = provider;673 WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, node); 674 this._provider = this._createProvider(tree.snapshot, node.nodeIndex); 675 this._updateHasChildren(); 634 676 }; 635 677 636 678 WebInspector.HeapSnapshotDominatorObjectNode.prototype = { 637 _createChildNode: function( provider)638 { 639 return new WebInspector.HeapSnapshotDominatorObjectNode(this.dataGrid, provider.item);679 _createChildNode: function(item) 680 { 681 return new WebInspector.HeapSnapshotDominatorObjectNode(this.dataGrid, item); 640 682 }, 641 683 … … 643 685 { 644 686 var showHiddenData = WebInspector.DetailedHeapshotView.prototype.showHiddenData; 645 return new WebInspector.HeapSnapshotNodesProvider( 646 snapshot, 687 return snapshot.createNodesProvider( 647 688 function (node) { 648 689 var dominatorIndex = node.dominatorIndex; -
trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js
r83581 r83718 67 67 var sortAscending = this.sortOrder === "ascending"; 68 68 var sortColumnIdentifier = this.sortColumnIdentifier; 69 if (this._lastSortColumnIdentifier === sortColumnIdentifier && this._lastSortAscending === sortAscending) 70 return; 71 this._lastSortColumnIdentifier = sortColumnIdentifier; 72 this._lastSortAscending = sortAscending; 69 73 var sortFields = this._sortFields(sortColumnIdentifier, sortAscending); 70 74 … … 87 91 88 92 this._performSorting(SortByTwoFields); 89 this.dispatchEventToListeners("sorting complete");90 93 }, 91 94 92 95 _performSorting: function(sortFunction) 93 96 { 97 this.dispatchEventToListeners("start sorting"); 94 98 var children = this.children; 95 99 this.removeChildren(); … … 101 105 child.sort(); 102 106 } 107 this.dispatchEventToListeners("sorting complete"); 103 108 } 104 109 }; … … 135 140 this.snapshot = snapshot; 136 141 this.populateChildren(); 137 this.sortingChanged();138 142 }, 139 143 140 144 populateChildren: function() 141 145 { 142 var aggregates = this.snapshot.aggregates(); 143 for (var constructor in aggregates) 144 this.appendChild(new WebInspector.HeapSnapshotConstructorNode(this, constructor, aggregates[constructor])); 146 function aggregatesReceived(aggregates) 147 { 148 for (var constructor in aggregates) 149 this.appendChild(new WebInspector.HeapSnapshotConstructorNode(this, constructor, aggregates[constructor])); 150 this.sortingChanged(); 151 } 152 this.snapshot.aggregates(false, aggregatesReceived.bind(this)); 145 153 } 146 154 }; … … 189 197 this.baseSnapshot = baseSnapshot; 190 198 this.removeChildren(); 191 if (this.baseSnapshot !== this.snapshot) { 199 if (this.baseSnapshot === this.snapshot) 200 return; 201 202 function baseSnapshotNodeIdsReceived(nodeIds) 203 { 204 this.snapshot.pushSnapshotNodeIds(this.baseSnapshot.uid, nodeIds); 192 205 this.populateChildren(); 193 this.sortingChanged(); 194 } 206 } 207 function pushBaseSnapshotNodeIds() 208 { 209 if (!this.snapshot.hasSnapshotNodeIds(this.baseSnapshot.uid)) 210 this.baseSnapshot.nodeIds(baseSnapshotNodeIdsReceived.bind(this)); 211 else 212 this.populateChildren(); 213 } 214 function snapshotNodeIdsReceived(nodeIds) 215 { 216 this.baseSnapshot.pushSnapshotNodeIds(this.snapshot.uid, nodeIds); 217 pushBaseSnapshotNodeIds.call(this); 218 } 219 if (!this.baseSnapshot.hasSnapshotNodeIds(this.snapshot.uid)) 220 this.snapshot.nodeIds(snapshotNodeIdsReceived.bind(this)); 221 else 222 pushBaseSnapshotNodeIds.call(this); 195 223 }, 196 224 197 225 populateChildren: function() 198 226 { 199 var baseClasses = this.baseSnapshot.aggregates(true); 200 var classes = this.snapshot.aggregates(true); 201 for (var clss in baseClasses) { 202 var node = new WebInspector.HeapSnapshotDiffNode(this, clss, baseClasses[clss], classes[clss]); 203 if (!node.zeroDiff) 204 this.appendChild(node); 205 } 206 for (clss in classes) { 207 if (!(clss in baseClasses)) { 208 var node = new WebInspector.HeapSnapshotDiffNode(this, clss, null, classes[clss]); 209 if (!node.zeroDiff) 210 this.appendChild(node); 227 function baseAggregatesReceived(baseClasses) 228 { 229 function aggregatesReceived(classes) 230 { 231 for (var clss in baseClasses) { 232 var node = new WebInspector.HeapSnapshotDiffNode(this, clss, baseClasses[clss], classes[clss]); 233 if (!node.zeroDiff) 234 this.appendChild(node); 235 } 236 for (clss in classes) { 237 if (!(clss in baseClasses)) { 238 var node = new WebInspector.HeapSnapshotDiffNode(this, clss, null, classes[clss]); 239 if (!node.zeroDiff) 240 this.appendChild(node); 241 } 242 } 243 this.sortingChanged(); 211 244 } 212 } 245 this.snapshot.aggregates(true, aggregatesReceived.bind(this)); 246 } 247 this.baseSnapshot.aggregates(true, baseAggregatesReceived.bind(this)); 213 248 } 214 249 }; … … 250 285 }; 251 286 WebInspector.HeapSnapshotSortableDataGrid.call(this, columns); 287 this._defaultPopulateCount = 100; 252 288 } 253 289 … … 261 297 }, 262 298 299 _resetPaths: function() 300 { 301 this._setRootChildrenForFinder(); 302 this.removeChildren(); 303 this._counter = 0; 304 this.showNext(this._defaultPopulateCount); 305 }, 306 263 307 setDataSource: function(snapshotView, snapshot, nodeIndex, prefix) 264 308 { … … 268 312 if (this.pathFinder) 269 313 this.searchCancelled(); 270 271 this.pathFinder = new WebInspector.HeapSnapshotPathFinder(snapshot, nodeIndex); 272 this._setRootChildrenForFinder(); 273 274 this.removeChildren(); 275 276 this._counter = 0; 277 this.showNext(100); 314 this.pathFinder = snapshot.createPathFinder(nodeIndex); 315 this._resetPaths(); 278 316 }, 279 317 280 318 refresh: function() 281 319 { 282 this.removeChildren();283 this._counter = 0;284 320 delete this._cancel; 285 this._setRootChildrenForFinder(); 286 this.showNext(100); 321 this._resetPaths(); 287 322 }, 288 323 … … 290 325 { 291 326 WebInspector.PleaseWaitMessage.prototype.show(this.element, this.searchCancelled.bind(this, pathsCount)); 292 window.setTimeout(startSearching.bind(this), 500); 327 328 function pathFound(result) 329 { 330 if (result === null) { 331 WebInspector.PleaseWaitMessage.prototype.hide(); 332 if (!this.children.length) 333 this.appendChild(new WebInspector.DataGridNode({path:WebInspector.UIString("Can't find any paths."), len:""}, false)); 334 return; 335 } else if (result !== false) { 336 if (this._prefix) 337 result.path = this._prefix + result.path; 338 this.appendChild(new WebInspector.DataGridNode(result, false)); 339 ++this._counter; 340 } 341 setTimeout(startSearching.bind(this), 0); 342 } 293 343 294 344 function startSearching() 295 345 { 296 if (this._cancel !== this.pathFinder) { 297 if (this._counter < pathsCount) { 298 var result = this.pathFinder.findNext(); 299 if (result === null) { 300 WebInspector.PleaseWaitMessage.prototype.hide(); 301 if (!this.children.length) 302 this.appendChild(new WebInspector.DataGridNode({path:WebInspector.UIString("Can't find any paths."), len:""}, false)); 303 return; 304 } else if (result !== false) { 305 if (this._prefix) 306 result.path = this._prefix + result.path; 307 this.appendChild(new WebInspector.DataGridNode(result, false)); 308 ++this._counter; 309 } 310 window.setTimeout(startSearching.bind(this), 0); 311 return; 312 } else 313 this.searchCancelled.call(this, pathsCount); 346 if (this._cancel === this.pathFinder) 347 return; 348 delete this._cancel; 349 if (this._counter < pathsCount) 350 this.pathFinder.findNext(pathFound.bind(this)); 351 else { 352 this.searchCancelled.call(this, pathsCount); 353 delete this._cancel; 314 354 } 315 this._cancel = false;316 }355 } 356 setTimeout(startSearching.bind(this), 0); 317 357 }, 318 358 … … 454 494 this._loadProfile(this._profileUid, profileCallback.bind(this)); 455 495 456 function profileCallback( profile)496 function profileCallback() 457 497 { 458 498 var list = this._profiles(); 459 499 var profileIndex; 460 500 for (var i = 0; i < list.length; ++i) 461 if (list[i].uid === profile.uid) {501 if (list[i].uid === this._profileUid) { 462 502 profileIndex = i; 463 503 break; … … 494 534 { 495 535 if (!this._profileWrapper) 496 this._profileWrapper = new WebInspector.HeapSnapshot(this.profile);536 this._profileWrapper = this.profile.proxy; 497 537 return this._profileWrapper; 498 538 }, … … 505 545 get baseProfileWrapper() 506 546 { 507 if (!this._baseProfileWrapper) { 508 if (this.baseProfile !== this.profile) 509 this._baseProfileWrapper = new WebInspector.HeapSnapshot(this.baseProfile); 510 else 511 this._baseProfileWrapper = this.profileWrapper; 512 } 547 if (!this._baseProfileWrapper) 548 this._baseProfileWrapper = this.baseProfile.proxy; 513 549 return this._baseProfileWrapper; 514 550 }, … … 517 553 { 518 554 WebInspector.View.prototype.show.call(this, parentElement); 519 if (!this.profile ._loaded)555 if (!this.profileWrapper.loaded) 520 556 this._loadProfile(this._profileUid, profileCallback1.bind(this)); 521 557 else 522 profileCallback1.call(this, this.profile); 523 524 function profileCallback1(profile) { 525 this.profileWrapper.restore(profile); 526 if (this.baseProfile && !this.baseProfile._loaded) 558 profileCallback1.call(this); 559 560 function profileCallback1() { 561 if (this.baseProfile && !this.baseProfileWrapper.loaded) 527 562 this._loadProfile(this._baseProfileUid, profileCallback2.bind(this)); 528 563 else 529 profileCallback2.call(this, this.baseProfile); 530 } 531 532 function profileCallback2(profile) { 533 if (profile) 534 this.baseProfileWrapper.restore(profile); 564 profileCallback2.call(this); 565 } 566 567 function profileCallback2() { 535 568 this.currentView.show(); 536 569 this.dataGrid.updateWidths(); … … 701 734 this._loadProfile(this._baseProfileUid, baseProfileLoaded.bind(this)); 702 735 703 function baseProfileLoaded( profile)736 function baseProfileLoaded() 704 737 { 705 738 delete this._baseProfileWrapper; -
trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js
r82230 r83718 551 551 ++this._nodeCount; 552 552 return this._nodeCount; 553 },554 555 restore: function(profile)556 {557 this._nodes = profile.nodes;558 this._strings = profile.strings;559 553 }, 560 554 -
trunk/Source/WebCore/inspector/front-end/PleaseWaitMessage.js
r78700 r83718 87 87 var message = instance.element; 88 88 if (message.parentNode === element) { 89 actionCallback();89 setTimeout(actionCallback, 0); 90 90 return; 91 91 } -
trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js
r83031 r83718 212 212 view.dispose(); 213 213 delete this._profiles[i]._profileView; 214 var profile = this._profiles[i];215 if (profile.nodes) {216 delete profile.nodes;217 delete profile.strings;218 }219 214 } 220 215 delete this.visibleView; … … 451 446 return; 452 447 453 if (profile._loaded) 454 callback(profile); 455 else if (profile._is_loading) 456 profile._callbacks.push(callback); 457 else { 458 profile._is_loading = true; 459 profile._callbacks = [callback]; 460 profile._json = ""; 461 profile.sideBarElement.subtitle = WebInspector.UIString("Loading…"); 462 ProfilerAgent.getProfile(profile.typeId, profile.uid); 448 if (!Preferences.detailedHeapProfiles) { 449 if (profile._loaded) 450 callback(profile); 451 else if (profile._is_loading) 452 profile._callbacks.push(callback); 453 else { 454 profile._is_loading = true; 455 profile._callbacks = [callback]; 456 profile._json = ""; 457 profile.sideBarElement.subtitle = WebInspector.UIString("Loading\u2026"); 458 ProfilerAgent.getProfile(profile.typeId, profile.uid); 459 } 460 } else { 461 if (!profile.proxy) 462 profile.proxy = new WebInspector.HeapSnapshotProxy(); 463 var proxy = profile.proxy; 464 if (proxy.startLoading(callback)) { 465 profile.sideBarElement.subtitle = WebInspector.UIString("Loading\u2026"); 466 ProfilerAgent.getProfile(profile.typeId, profile.uid); 467 } 463 468 } 464 469 }, … … 467 472 { 468 473 var profile = this._profilesIdMap[this._makeKey(uid, WebInspector.HeapSnapshotProfileType.TypeId)]; 469 if (!profile || profile._loaded || !profile._is_loading) 470 return; 471 472 profile._json += chunk; 474 if (!profile) 475 return; 476 if (!Preferences.detailedHeapProfiles) { 477 if (profile._loaded || !profile._is_loading) 478 return; 479 profile._json += chunk; 480 } else { 481 if (!profile.proxy) 482 return; 483 profile.proxy.pushJSONChunk(chunk); 484 } 473 485 }, 474 486 … … 476 488 { 477 489 var profile = this._profilesIdMap[this._makeKey(uid, WebInspector.HeapSnapshotProfileType.TypeId)]; 478 if (!profile || profile._loaded || !profile._is_loading) 479 return; 480 481 profile.sideBarElement.subtitle = WebInspector.UIString("Parsing…"); 482 window.setTimeout(doParse, 0); 483 484 function doParse() 485 { 486 var loadedSnapshot = JSON.parse(profile._json); 487 delete profile._json; 488 delete profile._is_loading; 489 var callbacks = profile._callbacks; 490 delete profile._callbacks; 491 profile._loaded = true; 492 profile.sideBarElement.subtitle = ""; 493 494 if (!Preferences.detailedHeapProfiles && WebInspector.DetailedHeapshotView.prototype.isDetailedSnapshot(loadedSnapshot)) { 495 WebInspector.panels.profiles._enableDetailedHeapProfiles(false); 490 if (!profile) 491 return; 492 if (!Preferences.detailedHeapProfiles) { 493 if (profile._loaded || !profile._is_loading) 496 494 return; 495 profile.sideBarElement.subtitle = WebInspector.UIString("Parsing\u2026"); 496 function doParse() 497 { 498 var loadedSnapshot = JSON.parse(profile._json); 499 var callbacks = profile._callbacks; 500 delete profile._callbacks; 501 delete profile._json; 502 delete profile._is_loading; 503 profile._loaded = true; 504 profile.sideBarElement.subtitle = ""; 505 506 if (WebInspector.DetailedHeapshotView.prototype.isDetailedSnapshot(loadedSnapshot)) { 507 WebInspector.panels.profiles._enableDetailedHeapProfiles(false); 508 return; 509 } 510 511 WebInspector.HeapSnapshotView.prototype.processLoadedSnapshot(profile, loadedSnapshot); 512 for (var i = 0; i < callbacks.length; ++i) 513 callbacks[i](profile); 497 514 } 498 499 if (!Preferences.detailedHeapProfiles) 500 WebInspector.HeapSnapshotView.prototype.processLoadedSnapshot(profile, loadedSnapshot); 501 else 502 WebInspector.DetailedHeapshotView.prototype.processLoadedSnapshot(profile, loadedSnapshot); 503 for (var i = 0; i < callbacks.length; ++i) 504 callbacks[i](profile); 515 setTimeout(doParse, 0); 516 } else { 517 if (!profile.proxy) 518 return; 519 var proxy = profile.proxy; 520 function parsed() 521 { 522 profile.sideBarElement.subtitle = Number.bytesToString(proxy.totalSize); 523 } 524 if (proxy.finishLoading(parsed)) 525 profile.sideBarElement.subtitle = WebInspector.UIString("Parsing\u2026"); 505 526 } 506 527 }, -
trunk/Source/WebCore/inspector/front-end/WebKit.qrc
r83176 r83718 51 51 <file>HAREntry.js</file> 52 52 <file>HeapSnapshot.js</file> 53 <file>HeapSnapshotProxy.js</file> 53 54 <file>HeapSnapshotView.js</file> 54 55 <file>HelpScreen.js</file> -
trunk/Source/WebCore/inspector/front-end/inspector.html
r83288 r83718 141 141 <script type="text/javascript" src="ProfileView.js"></script> 142 142 <script type="text/javascript" src="HeapSnapshot.js"></script> 143 <script type="text/javascript" src="HeapSnapshotProxy.js"></script> 143 144 <script type="text/javascript" src="HeapSnapshotView.js"></script> 144 145 <script type="text/javascript" src="DetailedHeapshotGridNodes.js"></script>
Note: See TracChangeset
for help on using the changeset viewer.