From 5cce438f24b492dc0ecd9d522bebc8bb94ee4d7a Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Mon, 16 Aug 2021 18:42:22 -0400 Subject: [PATCH] Review nits --- packages/scheduler/src/forks/Scheduler.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/scheduler/src/forks/Scheduler.js b/packages/scheduler/src/forks/Scheduler.js index 1ed50ab0a0497..c32ef04ca3929 100644 --- a/packages/scheduler/src/forks/Scheduler.js +++ b/packages/scheduler/src/forks/Scheduler.js @@ -98,6 +98,8 @@ const isInputPending = ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null; +const continuousOptions = {includeContinuous: true}; + function advanceTimers(currentTime) { // Check for tasks that are no longer delayed and add them to the queue. let timer = peek(timerQueue); @@ -464,7 +466,7 @@ function shouldYieldToHost() { } else if (timeElapsed < maxInterval) { // Yield if there's either a pending discrete or continuous input. if (isInputPending !== null) { - return isInputPending({includeContinuous: true}); + return isInputPending(continuousOptions); } } else { // We've blocked the thread for a long time. Even if there's no pending @@ -511,9 +513,8 @@ function forceFrameRate(fps) { const performWorkUntilDeadline = () => { if (scheduledHostCallback !== null) { const currentTime = getCurrentTime(); - // Yield after `yieldInterval` ms, regardless of where we are in the vsync - // cycle. This means there's always time remaining at the beginning of - // the message event. + // Keep track of the start time so we can measure how long the main thread + // has been blocked. startTime = currentTime; const hasTimeRemaining = true;