Web Inspector: discontinuous recordings should have discontinuities in the timeline...
[WebKit-https.git] / Source / WebInspectorUI / UserInterface / Models / Timeline.js
index c7d5921..2c32bb2 100644 (file)
@@ -103,6 +103,18 @@ WebInspector.Timeline = class Timeline extends WebInspector.Object
         this.dispatchEventToListeners(WebInspector.Timeline.Event.Refreshed);
     }
 
+    recordsInTimeRange(startTime, endTime, includeRecordBeforeStart)
+    {
+        let lowerIndex = this._records.lowerBound(startTime, (time, record) => time - record.timestamp);
+        let upperIndex = this._records.upperBound(endTime, (time, record) => time - record.timestamp);
+
+        // Include the record right before the start time.
+        if (includeRecordBeforeStart && lowerIndex > 0)
+            lowerIndex--;
+
+        return this._records.slice(lowerIndex, upperIndex);
+    }
+
     // Private
 
     _updateTimesIfNeeded(record)