@@ -14,11 +14,7 @@ import type {PriorityLevel} from '../SchedulerPriorities';
14
14
import {
15
15
enableSchedulerDebugging ,
16
16
enableProfiling ,
17
- enableIsInputPending ,
18
- enableIsInputPendingContinuous ,
19
17
frameYieldMs ,
20
- continuousYieldMs ,
21
- maxYieldMs ,
22
18
userBlockingPriorityTimeout ,
23
19
lowPriorityTimeout ,
24
20
normalPriorityTimeout ,
@@ -104,17 +100,6 @@ const localClearTimeout =
104
100
const localSetImmediate =
105
101
typeof setImmediate !== 'undefined' ? setImmediate : null; // IE and Node.js + jsdom
106
102
107
- const isInputPending =
108
- typeof navigator !== 'undefined' &&
109
- // $FlowFixMe[prop-missing]
110
- navigator . scheduling !== undefined &&
111
- // $FlowFixMe[incompatible-type]
112
- navigator . scheduling . isInputPending !== undefined
113
- ? navigator . scheduling . isInputPending . bind ( navigator . scheduling )
114
- : null ;
115
-
116
- const continuousOptions = { includeContinuous : enableIsInputPendingContinuous } ;
117
-
118
103
function advanceTimers(currentTime: number) {
119
104
// Check for tasks that are no longer delayed and add them to the queue.
120
105
let timer = peek ( timerQueue ) ;
@@ -468,71 +453,20 @@ let taskTimeoutID: TimeoutID = (-1: any);
468
453
// It does not attempt to align with frame boundaries, since most tasks don't
469
454
// need to be frame aligned; for those that do, use requestAnimationFrame.
470
455
let frameInterval = frameYieldMs ;
471
- const continuousInputInterval = continuousYieldMs ;
472
- const maxInterval = maxYieldMs ;
473
456
let startTime = - 1 ;
474
457
475
- let needsPaint = false ;
476
-
477
458
function shouldYieldToHost ( ) : boolean {
478
459
const timeElapsed = getCurrentTime ( ) - startTime ;
479
460
if ( timeElapsed < frameInterval ) {
480
461
// The main thread has only been blocked for a really short amount of time;
481
462
// smaller than a single frame. Don't yield yet.
482
463
return false ;
483
464
}
484
-
485
- // The main thread has been blocked for a non-negligible amount of time. We
486
- // may want to yield control of the main thread, so the browser can perform
487
- // high priority tasks. The main ones are painting and user input. If there's
488
- // a pending paint or a pending input, then we should yield. But if there's
489
- // neither, then we can yield less often while remaining responsive. We'll
490
- // eventually yield regardless, since there could be a pending paint that
491
- // wasn't accompanied by a call to `requestPaint`, or other main thread tasks
492
- // like network events.
493
- if ( enableIsInputPending ) {
494
- if ( needsPaint ) {
495
- // There's a pending paint (signaled by `requestPaint`). Yield now.
496
- return true ;
497
- }
498
- if ( timeElapsed < continuousInputInterval ) {
499
- // We haven't blocked the thread for that long. Only yield if there's a
500
- // pending discrete input (e.g. click). It's OK if there's pending
501
- // continuous input (e.g. mouseover).
502
- if ( isInputPending !== null ) {
503
- return isInputPending ( ) ;
504
- }
505
- } else if ( timeElapsed < maxInterval ) {
506
- // Yield if there's either a pending discrete or continuous input.
507
- if ( isInputPending !== null ) {
508
- return isInputPending ( continuousOptions ) ;
509
- }
510
- } else {
511
- // We've blocked the thread for a long time. Even if there's no pending
512
- // input, there may be some other scheduled work that we don't know about,
513
- // like a network event. Yield now.
514
- return true ;
515
- }
516
- }
517
-
518
- // `isInputPending` isn't available. Yield now.
465
+ // Yield now.
519
466
return true ;
520
467
}
521
468
522
- function requestPaint ( ) {
523
- if (
524
- enableIsInputPending &&
525
- navigator !== undefined &&
526
- // $FlowFixMe[prop-missing]
527
- navigator . scheduling !== undefined &&
528
- // $FlowFixMe[incompatible-type]
529
- navigator . scheduling . isInputPending !== undefined
530
- ) {
531
- needsPaint = true ;
532
- }
533
-
534
- // Since we yield every frame regardless, `requestPaint` has no effect.
535
- }
469
+ function requestPaint ( ) { }
536
470
537
471
function forceFrameRate ( fps : number ) {
538
472
if ( fps < 0 || fps > 125 ) {
@@ -577,9 +511,6 @@ const performWorkUntilDeadline = () => {
577
511
}
578
512
}
579
513
}
580
- // Yielding to the browser will give it a chance to paint, so we can
581
- // reset this.
582
- needsPaint = false ;
583
514
} ;
584
515
585
516
let schedulePerformWorkUntilDeadline ;
0 commit comments