* Calls `execute_()` asynchronously. * @param {?IdleDeadline} idleDeadline * @private
(idleDeadline)
| 444 | * @private |
| 445 | */ |
| 446 | executeAsap_(idleDeadline) { |
| 447 | // If the user-agent supports isInputPending, use it to break to a macro task as necessary. |
| 448 | // Otherwise If we've spent over 5 milliseconds executing the |
| 449 | // last instruction yield back to the main thread. |
| 450 | // 5 milliseconds is a magic number. |
| 451 | if ( |
| 452 | !allowLongTasks && |
| 453 | this.bodyIsVisible_ && |
| 454 | (this.supportsInputPending_ |
| 455 | ? /** @type {!{scheduling: {isInputPending: Function}}} */ ( |
| 456 | this.win_.navigator |
| 457 | ).scheduling.isInputPending() |
| 458 | : this.durationOfLastExecution_ > 5) |
| 459 | ) { |
| 460 | this.durationOfLastExecution_ = 0; |
| 461 | this.requestMacroTask_(); |
| 462 | return; |
| 463 | } |
| 464 | resolved.then(() => { |
| 465 | this.boundExecute_(idleDeadline); |
| 466 | }); |
| 467 | } |
| 468 | |
| 469 | /** |
| 470 | * Schedule running the next queued task. |
no test coverage detected