OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2012 Intel Inc. All rights reserved. | 3 * Copyright (C) 2012 Intel Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1813 * @extends {WebInspector.TimelineOverviewBase} | 1813 * @extends {WebInspector.TimelineOverviewBase} |
1814 * @param {!WebInspector.TracingModel} tracingModel | 1814 * @param {!WebInspector.TracingModel} tracingModel |
1815 */ | 1815 */ |
1816 WebInspector.TimelineFilmStripOverview = function(tracingModel) | 1816 WebInspector.TimelineFilmStripOverview = function(tracingModel) |
1817 { | 1817 { |
1818 WebInspector.TimelineOverviewBase.call(this); | 1818 WebInspector.TimelineOverviewBase.call(this); |
1819 this._tracingModel = tracingModel; | 1819 this._tracingModel = tracingModel; |
1820 this._filmStripView = new WebInspector.FilmStripView(); | 1820 this._filmStripView = new WebInspector.FilmStripView(); |
1821 this._filmStripView.show(this.element); | 1821 this._filmStripView.show(this.element); |
1822 this._lastFrame = null; | 1822 this._lastFrame = null; |
1823 /** @type {?Element} */ | |
1823 this._lastElement = null; | 1824 this._lastElement = null; |
1824 } | 1825 } |
1825 | 1826 |
1826 WebInspector.TimelineFilmStripOverview.prototype = { | 1827 WebInspector.TimelineFilmStripOverview.prototype = { |
1827 /** | 1828 /** |
1828 * @override | 1829 * @override |
1829 */ | 1830 */ |
1830 update: function() | 1831 update: function() |
1831 { | 1832 { |
1832 var model = this._tracingModel; | 1833 var model = this._tracingModel; |
1833 this._filmStripModel = new WebInspector.FilmStripModel(model); | 1834 this._filmStripModel = new WebInspector.FilmStripModel(model); |
1834 this._filmStripView.setModel(this._filmStripModel, model.minimumRecordTi me(), model.maximumRecordTime() - model.minimumRecordTime()); | 1835 this._filmStripView.setModel(this._filmStripModel, model.minimumRecordTi me(), model.maximumRecordTime() - model.minimumRecordTime()); |
1835 }, | 1836 }, |
1836 | 1837 |
1837 /** | 1838 /** |
1838 * @override | 1839 * @override |
1839 * @param {number} x | 1840 * @param {number} x |
1840 * @return {?Element} | 1841 * @return {!Promise<?Element>} |
alph
2015/06/19 14:22:38
Maybe ?Promise<!Element> instead. By the time of i
| |
1841 */ | 1842 */ |
1842 popoverElement: function(x) | 1843 popoverElementPromise: function(x) |
1843 { | 1844 { |
1844 if (!this._filmStripModel || !this._filmStripModel.frames().length) | 1845 if (!this._filmStripModel || !this._filmStripModel.frames().length) |
1845 return null; | 1846 return Promise.resolve(/** @type {?Element} */ (null)); |
1847 | |
1846 var time = this._calculator.positionToTime(x); | 1848 var time = this._calculator.positionToTime(x); |
1847 var frame = this._filmStripView.frameByTime(time); | 1849 var frame = this._filmStripView.frameByTime(time); |
1848 if (frame !== this._lastFrame) { | 1850 if (frame === this._lastFrame) |
1851 return Promise.resolve(this._lastElement); | |
1852 | |
1853 return new Promise(createElement.bind(this)); | |
1854 /** | |
1855 * @this {WebInspector.TimelineFilmStripOverview} | |
1856 * @param {function(?Element)} resolve | |
1857 */ | |
1858 function createElement(resolve) | |
1859 { | |
1849 this._lastFrame = frame; | 1860 this._lastFrame = frame; |
1850 this._lastElement = this._filmStripView.createFrameElement(frame); | 1861 this._lastElement = this._filmStripView.createFrameElement(frame, on ImageLoaded.bind(this)); |
1851 this._lastElement.appendChild(WebInspector.Widget.createStyleElement ("timeline/timelinePanel.css")); | 1862 this._lastElement.appendChild(WebInspector.Widget.createStyleElement ("timeline/timelinePanel.css")); |
1863 | |
1864 /** | |
1865 * @this {WebInspector.TimelineFilmStripOverview} | |
1866 */ | |
1867 function onImageLoaded() | |
1868 { | |
1869 resolve(this._lastElement); | |
alph
2015/06/19 14:22:38
Can the this._lastElement change by the time image
| |
1870 } | |
1852 } | 1871 } |
1853 return this._lastElement; | |
1854 }, | 1872 }, |
1855 | 1873 |
1856 /** | 1874 /** |
1857 * @override | 1875 * @override |
1858 */ | 1876 */ |
1859 reset: function() | 1877 reset: function() |
1860 { | 1878 { |
1861 this._filmStripView.reset(); | 1879 this._filmStripView.reset(); |
1862 this._lastFrame = null; | 1880 this._lastFrame = null; |
1863 this._lastElement = null; | 1881 this._lastElement = null; |
1864 }, | 1882 }, |
1865 | 1883 |
1866 __proto__: WebInspector.TimelineOverviewBase.prototype | 1884 __proto__: WebInspector.TimelineOverviewBase.prototype |
1867 } | 1885 } |
OLD | NEW |