| Index: Source/devtools/front_end/components_lazy/FilmStripModel.js
|
| diff --git a/Source/devtools/front_end/components_lazy/FilmStripModel.js b/Source/devtools/front_end/components_lazy/FilmStripModel.js
|
| index 55d25b7e44f6f343aec957bd3f37d67e33488130..9dd1f8fd879807862f4dbf286119dde9f6063303 100644
|
| --- a/Source/devtools/front_end/components_lazy/FilmStripModel.js
|
| +++ b/Source/devtools/front_end/components_lazy/FilmStripModel.js
|
| @@ -54,20 +54,19 @@ WebInspector.FilmStripModel.prototype = {
|
| * @param {number} timestamp
|
| * @return {?WebInspector.FilmStripModel.Frame}
|
| */
|
| - firstFrameAfterCommit: function(timestamp)
|
| + frameByTimestamp: function(timestamp)
|
| {
|
| - var bestIndex = 0;
|
| - var bestDelta = Number.MAX_VALUE;
|
| - for (var i = 0; i < this._frames.length; ++i) {
|
| - var delta = this._frames[i].timestamp - timestamp;
|
| - if (delta < 0)
|
| - continue;
|
| - if (delta < bestDelta) {
|
| - bestIndex = i;
|
| - bestDelta = delta;
|
| - }
|
| + /**
|
| + * @param {number} timestamp
|
| + * @param {!WebInspector.FilmStripModel.Frame} frame
|
| + * @return {number}
|
| + */
|
| + function comparator(timestamp, frame)
|
| + {
|
| + return timestamp - frame.timestamp;
|
| }
|
| - return bestDelta < 10 ? this._frames[bestIndex] : null;
|
| + var index = this._frames.lowerBound(timestamp, comparator);
|
| + return index < this._frames.length ? this._frames[index] : null;
|
| }
|
| }
|
|
|
|
|