@@ -162,7 +162,7 @@ function handleTimeout(currentTime: number) {
162
162
}
163
163
}
164
164
165
- function flushWork ( hasTimeRemaining : boolean , initialTime : number ) {
165
+ function flushWork ( initialTime : number ) {
166
166
if ( enableProfiling ) {
167
167
markSchedulerUnsuspended ( initialTime ) ;
168
168
}
@@ -180,7 +180,7 @@ function flushWork(hasTimeRemaining: boolean, initialTime: number) {
180
180
try {
181
181
if ( enableProfiling ) {
182
182
try {
183
- return workLoop ( hasTimeRemaining , initialTime ) ;
183
+ return workLoop ( initialTime ) ;
184
184
} catch ( error ) {
185
185
if ( currentTask !== null ) {
186
186
const currentTime = getCurrentTime ( ) ;
@@ -193,7 +193,7 @@ function flushWork(hasTimeRemaining: boolean, initialTime: number) {
193
193
}
194
194
} else {
195
195
// No catch in prod code path.
196
- return workLoop ( hasTimeRemaining , initialTime ) ;
196
+ return workLoop ( initialTime ) ;
197
197
}
198
198
} finally {
199
199
currentTask = null ;
@@ -206,18 +206,15 @@ function flushWork(hasTimeRemaining: boolean, initialTime: number) {
206
206
}
207
207
}
208
208
209
- function workLoop ( hasTimeRemaining : boolean , initialTime : number ) {
209
+ function workLoop ( initialTime : number ) {
210
210
let currentTime = initialTime ;
211
211
advanceTimers ( currentTime ) ;
212
212
currentTask = peek ( taskQueue ) ;
213
213
while (
214
214
currentTask !== null &&
215
215
! ( enableSchedulerDebugging && isSchedulerPaused )
216
216
) {
217
- if (
218
- currentTask . expirationTime > currentTime &&
219
- ( ! hasTimeRemaining || shouldYieldToHost ( ) )
220
- ) {
217
+ if ( currentTask . expirationTime > currentTime && shouldYieldToHost ( ) ) {
221
218
// This currentTask hasn't expired, and we've reached the deadline.
222
219
break ;
223
220
}
@@ -467,10 +464,7 @@ function unstable_getCurrentPriorityLevel(): PriorityLevel {
467
464
let isMessageLoopRunning = false ;
468
465
let scheduledHostCallback :
469
466
| null
470
- | ( (
471
- hasTimeRemaining : boolean ,
472
- initialTime : DOMHighResTimeStamp | number ,
473
- ) => boolean ) = null ;
467
+ | ( ( initialTime : DOMHighResTimeStamp | number ) => boolean ) = null ;
474
468
let taskTimeoutID : TimeoutID = ( - 1 : any ) ;
475
469
476
470
// Scheduler periodically yields in case there is other work on the main
@@ -567,7 +561,6 @@ const performWorkUntilDeadline = () => {
567
561
// Keep track of the start time so we can measure how long the main thread
568
562
// has been blocked.
569
563
startTime = currentTime ;
570
- const hasTimeRemaining = true ;
571
564
572
565
// If a scheduler task throws, exit the current browser task so the
573
566
// error can be observed.
@@ -578,7 +571,7 @@ const performWorkUntilDeadline = () => {
578
571
let hasMoreWork = true ;
579
572
try {
580
573
// $FlowFixMe[not-a-function] found when upgrading Flow
581
- hasMoreWork = scheduledHostCallback ( hasTimeRemaining , currentTime ) ;
574
+ hasMoreWork = scheduledHostCallback ( currentTime ) ;
582
575
} finally {
583
576
if ( hasMoreWork ) {
584
577
// If there's more work, schedule the next message event at the end
@@ -630,9 +623,7 @@ if (typeof localSetImmediate === 'function') {
630
623
} ;
631
624
}
632
625
633
- function requestHostCallback (
634
- callback : ( hasTimeRemaining : boolean , initialTime : number ) = > boolean ,
635
- ) {
626
+ function requestHostCallback ( callback : ( initialTime : number ) = > boolean ) {
636
627
scheduledHostCallback = callback ;
637
628
if ( ! isMessageLoopRunning ) {
638
629
isMessageLoopRunning = true ;
0 commit comments