Web Inspector: heap snapshot comparison view shows nothing if later snapshot is chose...
authormattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Jun 2016 23:05:52 +0000 (23:05 +0000)
committermattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Jun 2016 23:05:52 +0000 (23:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=158584
<rdar://problem/26727849>

Reviewed by Timothy Hatcher.

ALways compare the the later snapshot to the earlier snapshot,
regardless of selection order.

* UserInterface/Views/HeapAllocationsTimelineView.js:
(WebInspector.HeapAllocationsTimelineView):
(WebInspector.HeapAllocationsTimelineView.prototype._dataGridNodeSelected):
Swap shapshots if the first has a greater identifier than the second.
Drive-by cleanup: null out `_baselineDataGridNode` since it isn't used
after the comparison completes.

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

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

index 70f4902..f6bb56c 100644 (file)
@@ -1,5 +1,23 @@
 2016-06-10  Matt Baker  <mattbaker@apple.com>
 
+        Web Inspector: heap snapshot comparison view shows nothing if later snapshot is chosen first
+        https://bugs.webkit.org/show_bug.cgi?id=158584
+        <rdar://problem/26727849>
+
+        Reviewed by Timothy Hatcher.
+
+        ALways compare the the later snapshot to the earlier snapshot,
+        regardless of selection order.
+
+        * UserInterface/Views/HeapAllocationsTimelineView.js:
+        (WebInspector.HeapAllocationsTimelineView):
+        (WebInspector.HeapAllocationsTimelineView.prototype._dataGridNodeSelected):
+        Swap shapshots if the first has a greater identifier than the second.
+        Drive-by cleanup: null out `_baselineDataGridNode` since it isn't used
+        after the comparison completes.
+
+2016-06-10  Matt Baker  <mattbaker@apple.com>
+
         Web Inspector: rendering frames timeline "60fps" horizontal guide is mispositioned after switching timeline modes
         https://bugs.webkit.org/show_bug.cgi?id=158587
         <rdar://problem/26728174>
index ad56af3..d11a1be 100644 (file)
@@ -417,6 +417,9 @@ WebInspector.HeapAllocationsTimelineView = class HeapAllocationsTimelineView ext
         // Selected Comparison.
         let snapshot1 = this._baselineHeapSnapshotTimelineRecord.heapSnapshot;
         let snapshot2 = heapAllocationsTimelineRecord.heapSnapshot;
+        if (snapshot1.identifier > snapshot2.identifier)
+            [snapshot1, snapshot2] = [snapshot2, snapshot1];
+
         let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
         workerProxy.createSnapshotDiff(snapshot1.proxyObjectId, snapshot2.proxyObjectId, ({objectId, snapshotDiff: serializedSnapshotDiff}) => {
             let diff = WebInspector.HeapSnapshotDiffProxy.deserialize(objectId, serializedSnapshotDiff);
@@ -424,6 +427,7 @@ WebInspector.HeapAllocationsTimelineView = class HeapAllocationsTimelineView ext
         });
 
         this._baselineDataGridNode.clearBaseline();
+        this._baselineDataGridNode = null;
         this._selectingComparisonHeapSnapshots = false;
         this._compareHeapSnapshotsButtonItem.activated = false;
     }