* @param {!Window} win
(win)
| 47 | * @param {!Window} win |
| 48 | */ |
| 49 | constructor(win) { |
| 50 | /** @const {!Window} */ |
| 51 | this.win = win; |
| 52 | |
| 53 | /** @private @const {!./ampdoc-impl.AmpDocService} */ |
| 54 | this.ampdocService_ = Services.ampdocServiceFor(this.win); |
| 55 | |
| 56 | /** @private @const {function(function())} */ |
| 57 | this.raf_ = this.getRaf_(); |
| 58 | |
| 59 | /** |
| 60 | * Tasks to run in the next frame. |
| 61 | * @private {!Array<!VsyncTaskSpecDef>} |
| 62 | */ |
| 63 | this.tasks_ = []; |
| 64 | |
| 65 | /** |
| 66 | * Double buffer for tasks. |
| 67 | * @private {!Array<!VsyncTaskSpecDef>} |
| 68 | */ |
| 69 | this.nextTasks_ = []; |
| 70 | |
| 71 | /** |
| 72 | * States for tasks in the next frame in the same order. |
| 73 | * @private {!Array<!VsyncStateDef>} |
| 74 | */ |
| 75 | this.states_ = []; |
| 76 | |
| 77 | /** |
| 78 | * Double buffer for states. |
| 79 | * @private {!Array<!VsyncStateDef>} |
| 80 | */ |
| 81 | this.nextStates_ = []; |
| 82 | |
| 83 | /** |
| 84 | * Whether a new animation frame has been scheduled. |
| 85 | * @private {boolean} |
| 86 | */ |
| 87 | this.scheduled_ = false; |
| 88 | |
| 89 | /** @private {?Promise} */ |
| 90 | this.nextFramePromise_ = null; |
| 91 | |
| 92 | /** @protected {?function()} */ |
| 93 | this.nextFrameResolver_ = null; |
| 94 | |
| 95 | /** @const {!Function} */ |
| 96 | this.boundRunScheduledTasks_ = this.runScheduledTasks_.bind(this); |
| 97 | |
| 98 | /** |
| 99 | * If the doc is invisible we use this instead of rAF because rAF |
| 100 | * does not run in that scenario. |
| 101 | * However, we only do this for non-animation tasks as running |
| 102 | * animations doesn't make sense when not visible. |
| 103 | * @const {!Pass} |
| 104 | */ |
| 105 | this.invisiblePass_ = new Pass( |
| 106 | this.win, |
nothing calls this directly
no test coverage detected