Changeset 241219 in webkit
- Timestamp:
- Feb 8, 2019 4:25:46 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r241209 r241219 1 2019-02-08 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Import / Export Heap Snapshots 4 https://bugs.webkit.org/show_bug.cgi?id=194448 5 <rdar://problem/47928093> 6 7 Reviewed by Devin Rousso. 8 9 * inspector/heap/imported-snapshot-expected.txt: Added. 10 * inspector/heap/imported-snapshot.html: Added. 11 * platform/mac/TestExpectations: 12 1 13 2019-02-08 Nikita Vasilyev <nvasilyev@apple.com> 2 14 -
trunk/LayoutTests/platform/mac/TestExpectations
r240829 r241219 1087 1087 webkit.org/b/165582 inspector/worker/debugger-scripts.html [ Pass Failure ] 1088 1088 webkit.org/b/167203 inspector/worker/debugger-shared-breakpoint.html [ Pass Failure Timeout ] 1089 webkit.org/b/155607 inspector/heap/imported-snapshot.html [ Pass Timeout ] 1089 1090 webkit.org/b/155607 inspector/heap/snapshot.html [ Pass Timeout ] 1090 1091 webkit.org/b/143719 inspector/console/console-api.html [ Pass Timeout ] -
trunk/Source/WebInspectorUI/ChangeLog
r241216 r241219 1 2019-02-08 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Import / Export Heap Snapshots 4 https://bugs.webkit.org/show_bug.cgi?id=194448 5 <rdar://problem/47928093> 6 7 Reviewed by Devin Rousso. 8 9 * Localizations/en.lproj/localizedStrings.js: 10 New strings. 11 12 * UserInterface/Proxies/HeapSnapshotProxy.js: 13 (WI.HeapSnapshotProxy): 14 (WI.HeapSnapshotProxy.deserialize): 15 (WI.HeapSnapshotProxy.prototype.get imported): 16 (WI.HeapSnapshotProxy.prototype.get snapshotStringData): 17 (WI.HeapSnapshotProxy.prototype.set snapshotStringData): 18 Include an "imported" state on the HeapSnapshot and allow for 19 stashing the snapshotStringData on the main thread side. 20 21 * UserInterface/Proxies/HeapSnapshotWorkerProxy.js: 22 (WI.HeapSnapshotWorkerProxy.prototype.createImportedSnapshot): 23 * UserInterface/Workers/HeapSnapshot/HeapSnapshotWorker.js: 24 (HeapSnapshotWorker.prototype.clearSnapshots): 25 (HeapSnapshotWorker.prototype.createSnapshot): 26 Provide a specialized way to create an imported HeapSnapshot. 27 Track imported snapshots separately since they won't want to 28 be searched for live/dead objects due to active recording GCs. 29 30 * UserInterface/Workers/HeapSnapshot/HeapSnapshot.js: 31 (HeapSnapshot): 32 (HeapSnapshot.updateCategoriesAndMetadata): 33 (HeapSnapshot.allocationBucketCounts): 34 (HeapSnapshot.instancesWithClassName): 35 (HeapSnapshot.prototype.nodeWithIdentifier): 36 (HeapSnapshot.prototype.dominatedNodes): 37 (HeapSnapshot.prototype.retainedNodes): 38 (HeapSnapshot.prototype.retainers): 39 (HeapSnapshot.prototype.updateDeadNodesAndGatherCollectionData): 40 (HeapSnapshot.prototype.serialize): 41 (HeapSnapshot.prototype.serializeNode): 42 (HeapSnapshot.prototype._buildPostOrderIndexes): 43 (HeapSnapshot.prototype._buildDominatorIndexes): 44 (HeapSnapshot.prototype._buildRetainedSizes): 45 (HeapSnapshot.prototype._gcRootPathes.visitNode): 46 (HeapSnapshot.prototype._gcRootPathes): 47 Construct a HeapSnapshot knowinng whether or not it is imported. 48 Imported snapshots may be the "GCDebugging" snapshot type which 49 differs from "Inspector" by the number of node fields. So keep 50 the node field count a member instead of a global constant 51 in order to work with both snapshot types. 52 53 * UserInterface/Models/HeapAllocationsInstrument.js: 54 (WI.HeapAllocationsInstrument.prototype._takeHeapSnapshot): 55 * UserInterface/Protocol/ConsoleObserver.js: 56 (WI.ConsoleObserver.prototype.heapSnapshot): 57 * UserInterface/Protocol/HeapObserver.js: 58 (WI.HeapObserver.prototype.trackingStart): 59 (WI.HeapObserver.prototype.trackingComplete): 60 Stash the original string JSON data on the main thread side 61 where we already have the data. 62 63 * UserInterface/Views/HeapAllocationsTimelineOverviewGraph.js: 64 (WI.HeapAllocationsTimelineOverviewGraph.prototype.layout): 65 Don't show [S] icons for imported snapshots with no timestamp. 66 67 * UserInterface/Views/HeapAllocationsTimelineView.js: 68 (WI.HeapAllocationsTimelineView): 69 (WI.HeapAllocationsTimelineView.prototype.get navigationItems): 70 (WI.HeapAllocationsTimelineView.prototype._importButtonNavigationItemClicked): 71 (WI.HeapAllocationsTimelineView.prototype._takeHeapSnapshotClicked): 72 Import button that just creates a new snapshot. 73 74 * UserInterface/Views/HeapSnapshotContentView.js: 75 (WI.HeapSnapshotContentView): 76 (WI.HeapSnapshotContentView.prototype.get navigationItems): 77 (WI.HeapSnapshotContentView.prototype.get supportsSave): 78 (WI.HeapSnapshotContentView.prototype.get saveData): 79 (WI.HeapSnapshotContentView.prototype._exportSnapshot): 80 Export button that saves the original data. 81 82 * UserInterface/Views/TimelineTabContentView.js: 83 (WI.TimelineTabContentView.displayNameForRecord): 84 Specialized display string for imported snapshots. 85 1 86 2019-02-08 Joseph Pecoraro <pecoraro@apple.com> 2 87 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r240866 r241219 419 419 localizedStrings["Experimental"] = "Experimental"; 420 420 localizedStrings["Export"] = "Export"; 421 localizedStrings["Export (%s)"] = "Export (%s)"; 421 422 localizedStrings["Export HAR"] = "Export HAR"; 422 423 localizedStrings["Export Result"] = "Export Result"; … … 489 490 localizedStrings["Headers:"] = "Headers:"; 490 491 localizedStrings["Heading Level"] = "Heading Level"; 492 localizedStrings["Heap Snapshot %s-%s-%s at %s.%s.%s"] = "Heap Snapshot %s-%s-%s at %s.%s.%s"; 491 493 localizedStrings["Heap Snapshot Object (%s)"] = "Heap Snapshot Object (%s)"; 492 494 localizedStrings["Height"] = "Height"; … … 520 522 localizedStrings["Imported"] = "Imported"; 521 523 localizedStrings["Imported Recordings"] = "Imported Recordings"; 524 localizedStrings["Imported \u2014 %s"] = "Imported \u2014 %s"; 522 525 localizedStrings["Incomplete"] = "Incomplete"; 523 526 localizedStrings["Indent width:"] = "Indent width:"; -
trunk/Source/WebInspectorUI/UserInterface/Models/HeapAllocationsInstrument.js
r220119 r241219 80 80 workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => { 81 81 let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot); 82 snapshot.snapshotStringData = snapshotStringData; 82 83 WI.timelineManager.heapSnapshotAdded(timestamp, snapshot); 83 84 }); -
trunk/Source/WebInspectorUI/UserInterface/Protocol/ConsoleObserver.js
r236766 r241219 54 54 workerProxy.createSnapshot(snapshotStringData, title || null, ({objectId, snapshot: serializedSnapshot}) => { 55 55 let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot); 56 snapshot.snapshotStringData = snapshotStringData; 56 57 WI.timelineManager.heapSnapshotAdded(timestamp, snapshot); 57 58 }); -
trunk/Source/WebInspectorUI/UserInterface/Protocol/HeapObserver.js
r220119 r241219 38 38 workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => { 39 39 let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot); 40 snapshot.snapshotStringData = snapshotStringData; 40 41 WI.timelineManager.heapTrackingStarted(timestamp, snapshot); 41 42 }); … … 47 48 workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => { 48 49 let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot); 50 snapshot.snapshotStringData = snapshotStringData; 49 51 WI.timelineManager.heapTrackingCompleted(timestamp, snapshot); 50 52 }); -
trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotProxy.js
r220119 r241219 26 26 WI.HeapSnapshotProxy = class HeapSnapshotProxy extends WI.Object 27 27 { 28 constructor(snapshotObjectId, identifier, title, totalSize, totalObjectCount, liveSize, categories )28 constructor(snapshotObjectId, identifier, title, totalSize, totalObjectCount, liveSize, categories, imported) 29 29 { 30 30 super(); … … 38 38 this._liveSize = liveSize; 39 39 this._categories = Map.fromObject(categories); 40 this._imported = imported; 41 this._snapshotStringData = null; 40 42 41 43 console.assert(!this.invalid); … … 50 52 static deserialize(objectId, serializedSnapshot) 51 53 { 52 let {identifier, title, totalSize, totalObjectCount, liveSize, categories } = serializedSnapshot;53 return new WI.HeapSnapshotProxy(objectId, identifier, title, totalSize, totalObjectCount, liveSize, categories );54 let {identifier, title, totalSize, totalObjectCount, liveSize, categories, imported} = serializedSnapshot; 55 return new WI.HeapSnapshotProxy(objectId, identifier, title, totalSize, totalObjectCount, liveSize, categories, imported); 54 56 } 55 57 … … 74 76 get liveSize() { return this._liveSize; } 75 77 get categories() { return this._categories; } 78 get imported() { return this._imported; } 76 79 get invalid() { return this._proxyObjectId === 0; } 80 81 get snapshotStringData() 82 { 83 return this._snapshotStringData; 84 } 85 86 set snapshotStringData(data) 87 { 88 this._snapshotStringData = data; 89 } 77 90 78 91 updateForCollectionEvent(event) -
trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotWorkerProxy.js
r220119 r241219 65 65 { 66 66 this.performAction("createSnapshotDiff", ...arguments); 67 } 68 69 createImportedSnapshot(snapshotStringData, title, callback) 70 { 71 const imported = true; 72 this.performAction("createSnapshot", snapshotStringData, title, imported, callback); 67 73 } 68 74 -
trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.js
r220119 r241219 74 74 75 75 for (let record of visibleRecords) { 76 if (isNaN(record.timestamp)) 77 continue; 78 76 79 const halfImageWidth = 8; 77 80 let x = xScale(record.timestamp) - halfImageWidth; -
trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js
r235151 r241219 60 60 }; 61 61 62 this._importButtonNavigationItem = new WI.ButtonNavigationItem("import", WI.UIString("Import"), "Images/Import.svg", 15, 15); 63 this._importButtonNavigationItem.toolTip = WI.UIString("Import"); 64 this._importButtonNavigationItem.buttonStyle = WI.ButtonNavigationItem.Style.ImageAndText; 65 this._importButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._importButtonNavigationItemClicked, this); 66 62 67 let snapshotTooltip = WI.UIString("Take snapshot"); 63 68 this._takeHeapSnapshotButtonItem = new WI.ButtonNavigationItem("take-snapshot", snapshotTooltip, "Images/Camera.svg", 16, 16); … … 185 190 { 186 191 if (this._showingSnapshotList) { 187 let items = [this._ takeHeapSnapshotButtonItem, this._compareHeapSnapshotsButtonItem];192 let items = [this._importButtonNavigationItem, this._takeHeapSnapshotButtonItem, this._compareHeapSnapshotsButtonItem]; 188 193 if (this._selectingComparisonHeapSnapshots) 189 194 items.push(this._compareHeapSnapshotHelpTextItem); … … 215 220 } 216 221 222 get supportsSave() 223 { 224 if (this._showingSnapshotList) 225 return false; 226 227 if (!this._contentViewContainer.currentContentView) 228 return false; 229 230 return this._contentViewContainer.currentContentView.supportsSave; 231 } 232 233 get saveData() 234 { 235 return this._contentViewContainer.currentContentView.saveData; 236 } 237 217 238 selectRecord(record) 218 239 { … … 383 404 } 384 405 406 _importButtonNavigationItemClicked() 407 { 408 WI.FileUtilities.importText(function(result) { 409 let snapshotStringData = result.text; 410 let workerProxy = WI.HeapSnapshotWorkerProxy.singleton(); 411 workerProxy.createImportedSnapshot(snapshotStringData, result.filename, ({objectId, snapshot: serializedSnapshot}) => { 412 let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot); 413 snapshot.snapshotStringData = snapshotStringData; 414 const timestamp = NaN; 415 WI.timelineManager.heapSnapshotAdded(timestamp, snapshot); 416 }); 417 }); 418 } 419 385 420 _takeHeapSnapshotClicked() 386 421 { … … 389 424 workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => { 390 425 let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot); 426 snapshot.snapshotStringData = snapshotStringData; 391 427 WI.timelineManager.heapSnapshotAdded(timestamp, snapshot); 392 428 }); -
trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotContentView.js
r220119 r241219 34 34 this.element.classList.add("heap-snapshot"); 35 35 36 this._exportButtonNavigationItem = new WI.ButtonNavigationItem("export", WI.UIString("Export"), "Images/Export.svg", 15, 15); 37 this._exportButtonNavigationItem.toolTip = WI.UIString("Export (%s)").format(WI.saveKeyboardShortcut.displayName); 38 this._exportButtonNavigationItem.buttonStyle = WI.ButtonNavigationItem.Style.ImageAndText; 39 this._exportButtonNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.High; 40 this._exportButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, () => { this._exportSnapshot(); }); 41 36 42 this._dataGrid = new WI.DataGrid(columns); 37 43 this._dataGrid.sortColumnIdentifier = "retainedSize"; … … 53 59 // Protected 54 60 61 get navigationItems() 62 { 63 if (this.representedObject instanceof WI.HeapSnapshotProxy) 64 return [this._exportButtonNavigationItem]; 65 return []; 66 } 67 68 get supportsSave() 69 { 70 return this.representedObject instanceof WI.HeapSnapshotProxy; 71 } 72 73 get saveData() 74 { 75 return {customSaveHandler: () => { this._exportSnapshot(); }}; 76 } 77 55 78 shown() 56 79 { … … 73 96 74 97 // Private 98 99 _exportSnapshot() 100 { 101 if (!this.representedObject.snapshotStringData) { 102 InspectorFrontendHost.beep(); 103 return; 104 } 105 106 let date = new Date; 107 let values = [ 108 date.getFullYear(), 109 Number.zeroPad(date.getMonth() + 1, 2), 110 Number.zeroPad(date.getDate(), 2), 111 Number.zeroPad(date.getHours(), 2), 112 Number.zeroPad(date.getMinutes(), 2), 113 Number.zeroPad(date.getSeconds(), 2), 114 ]; 115 let filename = WI.UIString("Heap Snapshot %s-%s-%s at %s.%s.%s").format(...values); 116 let url = "web-inspector:///" + encodeURI(filename) + ".json"; 117 WI.FileUtilities.save({ 118 url, 119 content: this.representedObject.snapshotStringData, 120 forceSaveAs: true, 121 }); 122 } 75 123 76 124 _sortDataGrid() -
trunk/Source/WebInspectorUI/UserInterface/Views/RecordingContentView.js
r238198 r241219 148 148 } 149 149 150 // Protected151 152 150 initialLayout() 153 151 { -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js
r240457 r241219 278 278 return WI.UIString("Frame %d").format(timelineRecord.frameNumber); 279 279 case WI.TimelineRecord.Type.HeapAllocations: 280 if (timelineRecord.heapSnapshot.imported) 281 return WI.UIString("Imported \u2014 %s").format(timelineRecord.heapSnapshot.title); 280 282 if (timelineRecord.heapSnapshot.title) 281 283 return WI.UIString("Snapshot %d \u2014 %s").format(timelineRecord.heapSnapshot.identifier, timelineRecord.heapSnapshot.title); -
trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshot.js
r235271 r241219 37 37 const nodeClassNameOffset = 2; 38 38 const nodeInternalOffset = 3; 39 const gcDebuggingNodeFieldCount = 7; 39 40 40 41 // edges … … 74 75 HeapSnapshot = class HeapSnapshot 75 76 { 76 constructor(objectId, snapshotDataString, title = null )77 constructor(objectId, snapshotDataString, title = null, imported = false) 77 78 { 78 79 this._identifier = nextSnapshotIdentifier++; 79 80 this._objectId = objectId; 80 81 this._title = title; 82 this._imported = imported; 81 83 82 84 let json = JSON.parse(snapshotDataString); … … 85 87 let {version, type, nodes, nodeClassNames, edges, edgeTypes, edgeNames} = json; 86 88 console.assert(version === 1, "Expect JavaScriptCore Heap Snapshot version 1"); 87 console.assert(!type || type === "Inspector", "Expect an Inspector Heap Snapshot"); 89 console.assert(!type || (type === "Inspector" || type === "GCDebugging"), "Expect an Inspector / GCDebugging Heap Snapshot"); 90 91 this._nodeFieldCount = type === "GCDebugging" ? gcDebuggingNodeFieldCount : nodeFieldCount; 88 92 89 93 this._nodes = nodes; 90 this._nodeCount = nodes.length / nodeFieldCount;94 this._nodeCount = nodes.length / this._nodeFieldCount; 91 95 92 96 this._edges = edges; … … 100 104 this._nodeIdentifierToOrdinal = new Map; // <node identifier> => nodeOrdinal 101 105 this._lastNodeIdentifier = 0; 102 for (let nodeIndex = 0; nodeIndex < nodes.length; nodeIndex += nodeFieldCount) {103 let nodeOrdinal = nodeIndex / nodeFieldCount;106 for (let nodeIndex = 0; nodeIndex < nodes.length; nodeIndex += this._nodeFieldCount) { 107 let nodeOrdinal = nodeIndex / this._nodeFieldCount; 104 108 let nodeIdentifier = nodes[nodeIndex + nodeIdOffset]; 105 109 this._nodeIdentifierToOrdinal.set(nodeIdentifier, nodeOrdinal); … … 152 156 153 157 // Skip the <root> node. 154 let firstNodeIndex = nodeFieldCount;158 let firstNodeIndex = snapshot._nodeFieldCount; 155 159 let firstNodeOrdinal = 1; 156 for (let nodeIndex = firstNodeIndex, nodeOrdinal = firstNodeOrdinal; nodeIndex < nodes.length; nodeIndex += nodeFieldCount, nodeOrdinal++) {160 for (let nodeIndex = firstNodeIndex, nodeOrdinal = firstNodeOrdinal; nodeIndex < nodes.length; nodeIndex += snapshot._nodeFieldCount, nodeOrdinal++) { 157 161 if (allowNodeIdentifierCallback && !allowNodeIdentifierCallback(nodes[nodeIndex + nodeIdOffset])) 158 162 continue; … … 192 196 193 197 // Skip the <root> node. 194 let firstNodeIndex = nodeFieldCount;198 let firstNodeIndex = snapshot._nodeFieldCount; 195 199 196 200 outer: 197 for (let nodeIndex = firstNodeIndex; nodeIndex < nodes.length; nodeIndex += nodeFieldCount) {201 for (let nodeIndex = firstNodeIndex; nodeIndex < nodes.length; nodeIndex += snapshot._nodeFieldCount) { 198 202 if (allowNodeIdentifierCallback && !allowNodeIdentifierCallback(nodes[nodeIndex + nodeIdOffset])) 199 203 continue; … … 220 224 221 225 // Skip the <root> node. 222 let firstNodeIndex = nodeFieldCount;226 let firstNodeIndex = snapshot._nodeFieldCount; 223 227 let firstNodeOrdinal = 1; 224 for (let nodeIndex = firstNodeIndex, nodeOrdinal = firstNodeOrdinal; nodeIndex < nodes.length; nodeIndex += nodeFieldCount, nodeOrdinal++) {228 for (let nodeIndex = firstNodeIndex, nodeOrdinal = firstNodeOrdinal; nodeIndex < nodes.length; nodeIndex += snapshot._nodeFieldCount, nodeOrdinal++) { 225 229 if (allowNodeIdentifierCallback && !allowNodeIdentifierCallback(nodes[nodeIndex + nodeIdOffset])) 226 230 continue; … … 254 258 { 255 259 let nodeOrdinal = this._nodeIdentifierToOrdinal.get(nodeIdentifier); 256 let nodeIndex = nodeOrdinal * nodeFieldCount;260 let nodeIndex = nodeOrdinal * this._nodeFieldCount; 257 261 return this.serializeNode(nodeIndex); 258 262 } … … 298 302 for (let nodeOrdinal = 0; nodeOrdinal < this._nodeCount; ++nodeOrdinal) { 299 303 if (this._nodeOrdinalToDominatorNodeOrdinal[nodeOrdinal] === targetNodeOrdinal) 300 dominatedNodes.push(nodeOrdinal * nodeFieldCount);304 dominatedNodes.push(nodeOrdinal * this._nodeFieldCount); 301 305 } 302 306 … … 314 318 let toNodeIdentifier = this._edges[edgeIndex + edgeToIdOffset]; 315 319 let toNodeOrdinal = this._nodeIdentifierToOrdinal.get(toNodeIdentifier); 316 let toNodeIndex = toNodeOrdinal * nodeFieldCount;320 let toNodeIndex = toNodeOrdinal * this._nodeFieldCount; 317 321 retainedNodes.push(toNodeIndex); 318 322 edges.push(edgeIndex); … … 335 339 for (let edgeIndex = incomingEdgeIndex; edgeIndex < incomingEdgeIndexEnd; ++edgeIndex) { 336 340 let fromNodeOrdinal = this._incomingNodes[edgeIndex]; 337 let fromNodeIndex = fromNodeOrdinal * nodeFieldCount;341 let fromNodeIndex = fromNodeOrdinal * this._nodeFieldCount; 338 342 retainers.push(fromNodeIndex); 339 343 edges.push(this._incomingEdges[edgeIndex]); … … 348 352 updateDeadNodesAndGatherCollectionData(snapshots) 349 353 { 354 console.assert(!this._imported, "Should never use an imported snapshot to modify snapshots"); 355 console.assert(snapshots.every((x) => !x._imported), "Should never modify nodes of imported snapshots"); 356 350 357 let previousSnapshotIndex = snapshots.indexOf(this) - 1; 351 358 let previousSnapshot = snapshots[previousSnapshotIndex]; … … 357 364 // All of the node identifiers that could have existed prior to this snapshot. 358 365 let known = new Map; 359 for (let nodeIndex = 0; nodeIndex < this._nodes.length; nodeIndex += nodeFieldCount) {366 for (let nodeIndex = 0; nodeIndex < this._nodes.length; nodeIndex += this._nodeFieldCount) { 360 367 let nodeIdentifier = this._nodes[nodeIndex + nodeIdOffset]; 361 368 if (nodeIdentifier > lastNodeIdentifier) … … 366 373 // Determine which node identifiers have since been deleted. 367 374 let collectedNodesList = []; 368 for (let nodeIndex = 0; nodeIndex < previousSnapshot._nodes.length; nodeIndex += nodeFieldCount) {375 for (let nodeIndex = 0; nodeIndex < previousSnapshot._nodes.length; nodeIndex += this._nodeFieldCount) { 369 376 let nodeIdentifier = previousSnapshot._nodes[nodeIndex + nodeIdOffset]; 370 377 let wasDeleted = !known.has(nodeIdentifier); … … 404 411 liveSize: this._liveSize, 405 412 categories: this._categories, 413 imported: this._imported, 406 414 }; 407 415 } … … 409 417 serializeNode(nodeIndex) 410 418 { 411 console.assert((nodeIndex % nodeFieldCount) === 0, "Invalid nodeIndex to serialize");419 console.assert((nodeIndex % this._nodeFieldCount) === 0, "Invalid nodeIndex to serialize"); 412 420 413 421 let nodeIdentifier = this._nodes[nodeIndex + nodeIdOffset]; 414 let nodeOrdinal = nodeIndex / nodeFieldCount;422 let nodeOrdinal = nodeIndex / this._nodeFieldCount; 415 423 let edgeIndex = this._nodeOrdinalToFirstOutgoingEdge[nodeOrdinal]; 416 424 let hasChildren = this._edges[edgeIndex + edgeFromIdOffset] === nodeIdentifier; 417 425 418 426 let dominatorNodeOrdinal = this._nodeOrdinalToDominatorNodeOrdinal[nodeOrdinal]; 419 let dominatorNodeIndex = dominatorNodeOrdinal * nodeFieldCount;427 let dominatorNodeIndex = dominatorNodeOrdinal * this._nodeFieldCount; 420 428 let dominatorNodeIdentifier = this._nodes[dominatorNodeIndex + nodeIdOffset]; 421 429 … … 534 542 while (stackTop >= 0) { 535 543 let nodeOrdinal = stackNodes[stackTop]; 536 let nodeIdentifier = this._nodes[(nodeOrdinal * nodeFieldCount) + nodeIdOffset];544 let nodeIdentifier = this._nodes[(nodeOrdinal * this._nodeFieldCount) + nodeIdOffset]; 537 545 let edgeIndex = stackEdges[stackTop]; 538 546 … … 658 666 659 667 let outgoingEdgeIndex = this._nodeOrdinalToFirstOutgoingEdge[nodeOrdinal]; 660 let nodeIdentifier = this._nodes[(nodeOrdinal * nodeFieldCount) + nodeIdOffset];668 let nodeIdentifier = this._nodes[(nodeOrdinal * this._nodeFieldCount) + nodeIdOffset]; 661 669 for (let edgeIndex = outgoingEdgeIndex; this._edges[edgeIndex + edgeFromIdOffset] === nodeIdentifier; edgeIndex += edgeFieldCount) { 662 670 let toNodeIdentifier = this._edges[edgeIndex + edgeToIdOffset]; … … 679 687 { 680 688 // Self size. 681 for (let nodeIndex = 0, nodeOrdinal = 0; nodeOrdinal < this._nodeCount; nodeIndex += nodeFieldCount, nodeOrdinal++)689 for (let nodeIndex = 0, nodeOrdinal = 0; nodeOrdinal < this._nodeCount; nodeIndex += this._nodeFieldCount, nodeOrdinal++) 682 690 this._nodeOrdinalToRetainedSizes[nodeOrdinal] = this._nodes[nodeIndex + nodeSizeOffset]; 683 691 … … 732 740 if (this._nodeOrdinalIsGCRoot[nodeOrdinal]) { 733 741 let fullPath = currentPath.slice(); 734 let nodeIndex = nodeOrdinal * nodeFieldCount;742 let nodeIndex = nodeOrdinal * this._nodeFieldCount; 735 743 fullPath.push({node: nodeIndex}); 736 744 paths.push(fullPath); … … 742 750 visited[nodeOrdinal] = 1; 743 751 744 let nodeIndex = nodeOrdinal * nodeFieldCount;752 let nodeIndex = nodeOrdinal * this._nodeFieldCount; 745 753 currentPath.push({node: nodeIndex}); 746 754 … … 751 759 for (let incomingEdgeIndex = incomingEdgeIndexEnd - 1; incomingEdgeIndex >= incomingEdgeIndexStart; --incomingEdgeIndex) { 752 760 let fromNodeOrdinal = this._incomingNodes[incomingEdgeIndex]; 753 let fromNodeIndex = fromNodeOrdinal * nodeFieldCount;761 let fromNodeIndex = fromNodeOrdinal * this._nodeFieldCount; 754 762 let fromNodeIsInternal = this._nodes[fromNodeIndex + nodeInternalOffset]; 755 763 if (fromNodeIsInternal) -
trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshotWorker.js
r205424 r241219 48 48 } 49 49 50 createSnapshot(snapshotString, title )50 createSnapshot(snapshotString, title, imported) 51 51 { 52 52 let objectId = this._nextObjectId++; 53 let snapshot = new HeapSnapshot(objectId, snapshotString, title); 54 this._snapshots.push(snapshot); 53 let snapshot = new HeapSnapshot(objectId, snapshotString, title, imported); 55 54 this._objects.set(objectId, snapshot); 56 55 57 if (this._snapshots.length > 1) { 58 setTimeout(() => { 59 let collectionData = snapshot.updateDeadNodesAndGatherCollectionData(this._snapshots); 60 if (!collectionData || !collectionData.affectedSnapshots.length) 61 return; 62 this.sendEvent("HeapSnapshot.CollectionEvent", collectionData); 63 }, 0); 56 if (!imported) { 57 this._snapshots.push(snapshot); 58 59 if (this._snapshots.length > 1) { 60 setTimeout(() => { 61 let collectionData = snapshot.updateDeadNodesAndGatherCollectionData(this._snapshots); 62 if (!collectionData || !collectionData.affectedSnapshots.length) 63 return; 64 this.sendEvent("HeapSnapshot.CollectionEvent", collectionData); 65 }, 0); 66 } 64 67 } 65 68
Note: See TracChangeset
for help on using the changeset viewer.