Web Inspector: REGRESSION: Heap: snapshots taken manually don't appear in the list
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Apr 2019 17:23:26 +0000 (17:23 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Apr 2019 17:23:26 +0000 (17:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196900
<rdar://problem/49880278>

Reviewed by Timothy Hatcher.

* UserInterface/Views/HeapAllocationsTimelineView.js:
(WI.HeapAllocationsTimelineView):
(WI.HeapAllocationsTimelineView.prototype.layout):
(WI.HeapAllocationsTimelineView.prototype._importButtonNavigationItemClicked):
(WI.HeapAllocationsTimelineView.prototype._takeHeapSnapshotClicked):
Drive-by: only show heap snapshots for the selected range.
* UserInterface/Views/TimelineView.js:
* UserInterface/Views/TimelineRecordingContentView.js:
(WI.TimelineRecordingContentView):
(WI.TimelineRecordingContentView.prototype._handleTimelineViewNeedsEntireSelectedRange): Added.
Drive-by: taking (or importing) a heap snapshot should select the entire range so that the
new record will appear in the list of heap snapshots.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244265 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js
Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js
Source/WebInspectorUI/UserInterface/Views/TimelineView.js

index d422c40..dd5d9c1 100644 (file)
@@ -1,5 +1,27 @@
 2019-04-15  Devin Rousso  <drousso@apple.com>
 
+        Web Inspector: REGRESSION: Heap: snapshots taken manually don't appear in the list
+        https://bugs.webkit.org/show_bug.cgi?id=196900
+        <rdar://problem/49880278>
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/HeapAllocationsTimelineView.js:
+        (WI.HeapAllocationsTimelineView):
+        (WI.HeapAllocationsTimelineView.prototype.layout):
+        (WI.HeapAllocationsTimelineView.prototype._importButtonNavigationItemClicked):
+        (WI.HeapAllocationsTimelineView.prototype._takeHeapSnapshotClicked):
+        Drive-by: only show heap snapshots for the selected range.
+
+        * UserInterface/Views/TimelineView.js:
+        * UserInterface/Views/TimelineRecordingContentView.js:
+        (WI.TimelineRecordingContentView):
+        (WI.TimelineRecordingContentView.prototype._handleTimelineViewNeedsEntireSelectedRange): Added.
+        Drive-by: taking (or importing) a heap snapshot should select the entire range so that the
+        new record will appear in the list of heap snapshots.
+
+2019-04-15  Devin Rousso  <drousso@apple.com>
+
         Web Inspector: REGRESSION (r244157): Timelines: ruler size appears wrong on first layout
         https://bugs.webkit.org/show_bug.cgi?id=196901
         <rdar://problem/49880539>
index e025ebe..ca2267d 100644 (file)
@@ -93,7 +93,7 @@ WI.HeapAllocationsTimelineView = class HeapAllocationsTimelineView extends WI.Ti
         this._dataGrid.sortOrder = WI.DataGrid.SortOrder.Ascending;
         this._dataGrid.createSettings("heap-allocations-timeline-view");
         this._dataGrid.addEventListener(WI.DataGrid.Event.SelectedNodeChanged, this._dataGridNodeSelected, this);
-
+        this.setupDataGrid(this._dataGrid);
         this.addSubview(this._dataGrid);
 
         this._contentViewContainer = new WI.ContentViewContainer;
@@ -262,17 +262,20 @@ WI.HeapAllocationsTimelineView = class HeapAllocationsTimelineView extends WI.Ti
 
     layout()
     {
-        if (this._pendingRecords.length && this.zeroTime) {
-            for (let heapAllocationsTimelineRecord of this._pendingRecords) {
-                this._dataGrid.addRowInSortOrder(new WI.HeapAllocationsTimelineDataGridNode(heapAllocationsTimelineRecord, {
-                    graphDataSource: this,
-                    heapAllocationsView: this,
-                }));
-            }
+        super.layout();
+
+        if (!this._pendingRecords.length)
+            return;
 
-            this._pendingRecords = [];
-            this._updateCompareHeapSnapshotButton();
+        for (let heapAllocationsTimelineRecord of this._pendingRecords) {
+            this._dataGrid.addRowInSortOrder(new WI.HeapAllocationsTimelineDataGridNode(heapAllocationsTimelineRecord, {
+                graphDataSource: this,
+                heapAllocationsView: this,
+            }));
         }
+
+        this._pendingRecords = [];
+        this._updateCompareHeapSnapshotButton();
     }
 
     reset()
@@ -380,7 +383,7 @@ WI.HeapAllocationsTimelineView = class HeapAllocationsTimelineView extends WI.Ti
 
     _importButtonNavigationItemClicked()
     {
-        WI.FileUtilities.importText(function(result) {
+        WI.FileUtilities.importText((result) => {
             let snapshotStringData = result.text;
             let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
             workerProxy.createImportedSnapshot(snapshotStringData, result.filename, ({objectId, snapshot: serializedSnapshot}) => {
@@ -388,18 +391,20 @@ WI.HeapAllocationsTimelineView = class HeapAllocationsTimelineView extends WI.Ti
                 snapshot.snapshotStringData = snapshotStringData;
                 const timestamp = NaN;
                 WI.timelineManager.heapSnapshotAdded(timestamp, snapshot);
+                this.dispatchEventToListeners(WI.TimelineView.Event.NeedsEntireSelectedRange);
             });
         });
     }
 
     _takeHeapSnapshotClicked()
     {
-        HeapAgent.snapshot(function(error, timestamp, snapshotStringData) {
+        HeapAgent.snapshot((error, timestamp, snapshotStringData) => {
             let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
             workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => {
                 let snapshot = WI.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
                 snapshot.snapshotStringData = snapshotStringData;
                 WI.timelineManager.heapSnapshotAdded(timestamp, snapshot);
+                this.dispatchEventToListeners(WI.TimelineView.Event.NeedsEntireSelectedRange);
             });
         });
     }
index 56292cc..a6b7bd6 100644 (file)
@@ -114,6 +114,7 @@ WI.TimelineRecordingContentView = class TimelineRecordingContentView extends WI.
         WI.TimelineView.addEventListener(WI.TimelineView.Event.RecordWasSelected, this._handleTimelineViewRecordSelected, this);
         WI.TimelineView.addEventListener(WI.TimelineView.Event.ScannerShow, this._handleTimelineViewScannerShow, this);
         WI.TimelineView.addEventListener(WI.TimelineView.Event.ScannerHide, this._handleTimelineViewScannerHide, this);
+        WI.TimelineView.addEventListener(WI.TimelineView.Event.NeedsEntireSelectedRange, this._handleTimelineViewNeedsEntireSelectedRange, this);
 
         WI.notifications.addEventListener(WI.Notification.VisibilityStateDidChange, this._inspectorVisibilityStateChanged, this);
 
@@ -933,6 +934,14 @@ WI.TimelineRecordingContentView = class TimelineRecordingContentView extends WI.
         this._timelineOverview.hideScanner();
     }
 
+    _handleTimelineViewNeedsEntireSelectedRange(event)
+    {
+        if (!this.visible)
+            return;
+
+        this._timelineOverview.timelineRuler.selectEntireRange();
+    }
+
     _updateProgressView()
     {
         let isCapturing = WI.timelineManager.isCapturing();
index ab13ccb..acaf5fa 100644 (file)
@@ -345,4 +345,5 @@ WI.TimelineView.Event = {
     RecordWasSelected: "timeline-view-record-was-selected",
     ScannerShow: "timeline-view-scanner-show",
     ScannerHide: "timeline-view-scanner-hide",
+    NeedsEntireSelectedRange: "timeline-view-needs-entire-selected-range",
 };