X-Git-Url: http://git.webkit.org/?p=WebKit-https.git;a=blobdiff_plain;f=Source%2FWebInspectorUI%2FUserInterface%2FModels%2FTimeline.js;h=2c32bb23b008728fe466957d2366d8d86db0007b;hp=c7d59213e6f87851ca2daace5cf9e1256c82a1e3;hb=d442969017edc9fc9c638529f4c2733ca93ae97c;hpb=a7d4a81bcc6565705cf1cfbda8fc7afdec850355;ds=sidebyside diff --git a/Source/WebInspectorUI/UserInterface/Models/Timeline.js b/Source/WebInspectorUI/UserInterface/Models/Timeline.js index c7d5921..2c32bb2 100644 --- a/Source/WebInspectorUI/UserInterface/Models/Timeline.js +++ b/Source/WebInspectorUI/UserInterface/Models/Timeline.js @@ -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)