Title: [201191] trunk/Source/WebInspectorUI
Revision
201191
Author
commit-qu...@webkit.org
Date
2016-05-19 15:25:13 -0700 (Thu, 19 May 2016)

Log Message

Web Inspector: Heap Snapshots taken before timeline view has a zero time do not get shown
https://bugs.webkit.org/show_bug.cgi?id=157923
<rdar://problem/26377366>

Patch by Joseph Pecoraro <pecor...@apple.com> on 2016-05-19
Reviewed by Timothy Hatcher.

* UserInterface/Views/HeapAllocationsTimelineDataGridNode.js:
(WebInspector.HeapAllocationsTimelineDataGridNode):
(WebInspector.HeapAllocationsTimelineDataGridNode.prototype.createCellContent):
(WebInspector.HeapAllocationsTimelineDataGridNode.prototype.updateTimestamp):
Show emDash for the timestamp if we don't yet have a zero time.
Update when we get a zero time.

* UserInterface/Views/HeapAllocationsTimelineView.js:
(WebInspector.HeapAllocationsTimelineView):
(WebInspector.HeapAllocationsTimelineView.prototype.layout):
(WebInspector.HeapAllocationsTimelineView.prototype.reset):
Save a list of nodes pre-zero time and update them when we get a zero time.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (201190 => 201191)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-05-19 22:20:10 UTC (rev 201190)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-05-19 22:25:13 UTC (rev 201191)
@@ -1,5 +1,26 @@
 2016-05-19  Joseph Pecoraro  <pecor...@apple.com>
 
+        Web Inspector: Heap Snapshots taken before timeline view has a zero time do not get shown
+        https://bugs.webkit.org/show_bug.cgi?id=157923
+        <rdar://problem/26377366>
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/HeapAllocationsTimelineDataGridNode.js:
+        (WebInspector.HeapAllocationsTimelineDataGridNode):
+        (WebInspector.HeapAllocationsTimelineDataGridNode.prototype.createCellContent):
+        (WebInspector.HeapAllocationsTimelineDataGridNode.prototype.updateTimestamp):
+        Show emDash for the timestamp if we don't yet have a zero time.
+        Update when we get a zero time.
+
+        * UserInterface/Views/HeapAllocationsTimelineView.js:
+        (WebInspector.HeapAllocationsTimelineView):
+        (WebInspector.HeapAllocationsTimelineView.prototype.layout):
+        (WebInspector.HeapAllocationsTimelineView.prototype.reset):
+        Save a list of nodes pre-zero time and update them when we get a zero time.
+
+2016-05-19  Joseph Pecoraro  <pecor...@apple.com>
+
         Web Inspector: HeapSnapshot Instances view should remove dead objects
         https://bugs.webkit.org/show_bug.cgi?id=157920
         <rdar://problem/26375866>

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNode.js (201190 => 201191)


--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNode.js	2016-05-19 22:20:10 UTC (rev 201190)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNode.js	2016-05-19 22:25:13 UTC (rev 201191)
@@ -34,7 +34,7 @@
 
         this._data = {
             name: this.displayName(),
-            timestamp: this._record.timestamp - zeroTime,
+            timestamp: zeroTime ? this._record.timestamp - zeroTime : NaN,
             size: this._record.heapSnapshot.totalSize,
         };
     }
@@ -60,7 +60,7 @@
             return fragment;
 
         case "timestamp":
-            return Number.secondsToString(this._data.timestamp, true);
+            return isNaN(this._data.timestamp) ? emDash : Number.secondsToString(this._data.timestamp, true);
 
         case "size":
             return Number.bytesToString(this._data.size);
@@ -78,4 +78,11 @@
     {
         this.element.classList.remove("baseline");
     }
+
+    updateTimestamp(zeroTime)
+    {
+        console.assert(isNaN(this._data.timestamp));
+        this._data.timestamp = this._record.timestamp - zeroTime;
+        this.needsRefresh();
+    }
 };

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js (201190 => 201191)


--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js	2016-05-19 22:20:10 UTC (rev 201190)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js	2016-05-19 22:25:13 UTC (rev 201191)
@@ -87,6 +87,7 @@
         WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange, this._contentViewSelectionPathComponentDidChange, this);
 
         this._pendingRecords = [];
+        this._pendingZeroTimeDataGridNodes = [];
 
         timeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._heapAllocationsTimelineRecordAdded, this);
 
@@ -235,12 +236,19 @@
 
     layout()
     {
-        // Wait to show records until our zeroTime has been set.
-        // FIXME: Waiting until zero time causes snapshots taken without recording to not show up in the list.
-        if (this._pendingRecords.length && this.zeroTime) {
+        if (this._pendingZeroTimeDataGridNodes.length && this.zeroTime) {
+            for (let dataGridNode of this._pendingZeroTimeDataGridNodes)
+                dataGridNode.updateTimestamp(this.zeroTime);
+            this._pendingZeroTimeDataGridNodes = [];
+            this._dataGrid._sort();
+        }
+
+        if (this._pendingRecords.length) {
             for (let heapAllocationsTimelineRecord of this._pendingRecords) {
                 let dataGridNode = new WebInspector.HeapAllocationsTimelineDataGridNode(heapAllocationsTimelineRecord, this.zeroTime, this);
                 this._dataGrid.addRowInSortOrder(null, dataGridNode);
+                if (!this.zeroTime)
+                    this._pendingZeroTimeDataGridNodes.push(dataGridNode);
             }
 
             this._pendingRecords = [];
@@ -256,6 +264,7 @@
 
         this.showHeapSnapshotList();
         this._pendingRecords = [];
+        this._pendingZeroTimeDataGridNodes = [];
         this._updateCompareHeapSnapshotButton();
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to