()
| 445 | let startTime = -1; |
| 446 | |
| 447 | function shouldYieldToHost(): boolean { |
| 448 | if (!enableAlwaysYieldScheduler && enableRequestPaint && needsPaint) { |
| 449 | // Yield now. |
| 450 | return true; |
| 451 | } |
| 452 | const timeElapsed = getCurrentTime() - startTime; |
| 453 | if (timeElapsed < frameInterval) { |
| 454 | // The main thread has only been blocked for a really short amount of time; |
| 455 | // smaller than a single frame. Don't yield yet. |
| 456 | return false; |
| 457 | } |
| 458 | // Yield now. |
| 459 | return true; |
| 460 | } |
| 461 | |
| 462 | function requestPaint() { |
| 463 | if (enableRequestPaint) { |
no test coverage detected