REGRESSION(r212853): Comparisons to baseline no longer shows up
[WebKit-https.git] / Websites / perf.webkit.org / public / v3 / models / time-series.js
index 09bc340..0b55868 100644 (file)
@@ -205,6 +205,18 @@ class TimeSeriesView {
         return null;
     }
 
+    lastPointInTimeRange(startTime, endTime)
+    {
+        console.assert(startTime <= endTime);
+        for (let point of this._reverse()) {
+            if (point.time < startTime)
+                return null;
+            if (point.time <= endTime)
+                return point;
+        }
+        return null;
+    }
+
     [Symbol.iterator]()
     {
         const data = this._data;
@@ -216,6 +228,22 @@ class TimeSeriesView {
             }
         };
     }
+
+    _reverse()
+    {
+        return {
+            [Symbol.iterator]: () => {
+                const data = this._data;
+                const end = this._startingIndex;
+                let i = this._afterEndingIndex;
+                return {
+                    next() {
+                        return {done: i-- == end, value: data[i]};
+                    }
+                };
+            }
+        }
+    }
 }
 
 if (typeof module != 'undefined')