Chromium Code Reviews| Index: Source/devtools/front_end/timeline/TimelinePanel.js |
| diff --git a/Source/devtools/front_end/timeline/TimelinePanel.js b/Source/devtools/front_end/timeline/TimelinePanel.js |
| index 7325975dba24818d6cdba85c7a833e52a74f1c3a..6fec0cac6c2d2db79ac5c7e4333314b35001f67a 100644 |
| --- a/Source/devtools/front_end/timeline/TimelinePanel.js |
| +++ b/Source/devtools/front_end/timeline/TimelinePanel.js |
| @@ -1820,6 +1820,7 @@ WebInspector.TimelineFilmStripOverview = function(tracingModel) |
| this._filmStripView = new WebInspector.FilmStripView(); |
| this._filmStripView.show(this.element); |
| this._lastFrame = null; |
| + /** @type {?Element} */ |
| this._lastElement = null; |
| } |
| @@ -1837,20 +1838,37 @@ WebInspector.TimelineFilmStripOverview.prototype = { |
| /** |
| * @override |
| * @param {number} x |
| - * @return {?Element} |
| + * @return {!Promise<?Element>} |
|
alph
2015/06/19 14:22:38
Maybe ?Promise<!Element> instead. By the time of i
|
| */ |
| - popoverElement: function(x) |
| + popoverElementPromise: function(x) |
| { |
| if (!this._filmStripModel || !this._filmStripModel.frames().length) |
| - return null; |
| + return Promise.resolve(/** @type {?Element} */ (null)); |
| + |
| var time = this._calculator.positionToTime(x); |
| var frame = this._filmStripView.frameByTime(time); |
| - if (frame !== this._lastFrame) { |
| + if (frame === this._lastFrame) |
| + return Promise.resolve(this._lastElement); |
| + |
| + return new Promise(createElement.bind(this)); |
| + /** |
| + * @this {WebInspector.TimelineFilmStripOverview} |
| + * @param {function(?Element)} resolve |
| + */ |
| + function createElement(resolve) |
| + { |
| this._lastFrame = frame; |
| - this._lastElement = this._filmStripView.createFrameElement(frame); |
| + this._lastElement = this._filmStripView.createFrameElement(frame, onImageLoaded.bind(this)); |
| this._lastElement.appendChild(WebInspector.Widget.createStyleElement("timeline/timelinePanel.css")); |
| + |
| + /** |
| + * @this {WebInspector.TimelineFilmStripOverview} |
| + */ |
| + function onImageLoaded() |
| + { |
| + resolve(this._lastElement); |
|
alph
2015/06/19 14:22:38
Can the this._lastElement change by the time image
|
| + } |
| } |
| - return this._lastElement; |
| }, |
| /** |