diff --git a/packages/scheduler/src/SchedulerFeatureFlags.js b/packages/scheduler/src/SchedulerFeatureFlags.js index 7e17741524a40..c0efc0ab3625e 100644 --- a/packages/scheduler/src/SchedulerFeatureFlags.js +++ b/packages/scheduler/src/SchedulerFeatureFlags.js @@ -8,7 +8,5 @@ export const enableSchedulerDebugging = false; export const enableIsInputPending = false; -export const requestIdleCallbackBeforeFirstFrame = false; -export const requestTimerEventBeforeFirstFrame = false; export const enableMessageLoopImplementation = true; export const enableProfiling = __PROFILE__; diff --git a/packages/scheduler/src/forks/SchedulerFeatureFlags.www.js b/packages/scheduler/src/forks/SchedulerFeatureFlags.www.js index f4bebebf2c290..a1535868f1e67 100644 --- a/packages/scheduler/src/forks/SchedulerFeatureFlags.www.js +++ b/packages/scheduler/src/forks/SchedulerFeatureFlags.www.js @@ -12,6 +12,4 @@ export const { } = require('SchedulerFeatureFlags'); export const enableProfiling = __PROFILE__; -export const requestIdleCallbackBeforeFirstFrame = false; -export const requestTimerEventBeforeFirstFrame = false; export const enableMessageLoopImplementation = true; diff --git a/packages/scheduler/src/forks/SchedulerHostConfig.default.js b/packages/scheduler/src/forks/SchedulerHostConfig.default.js index 37a38027c7b5d..77e15c1000b52 100644 --- a/packages/scheduler/src/forks/SchedulerHostConfig.default.js +++ b/packages/scheduler/src/forks/SchedulerHostConfig.default.js @@ -7,8 +7,6 @@ import { enableIsInputPending, - requestIdleCallbackBeforeFirstFrame as requestIdleCallbackBeforeFirstFrameFlag, - requestTimerEventBeforeFirstFrame, enableMessageLoopImplementation, } from '../SchedulerFeatureFlags'; @@ -87,7 +85,6 @@ if ( const clearTimeout = window.clearTimeout; const requestAnimationFrame = window.requestAnimationFrame; const cancelAnimationFrame = window.cancelAnimationFrame; - const requestIdleCallback = window.requestIdleCallback; if (typeof console !== 'undefined') { // TODO: Remove fb.me link @@ -107,11 +104,6 @@ if ( } } - const requestIdleCallbackBeforeFirstFrame = - requestIdleCallbackBeforeFirstFrameFlag && - typeof requestIdleCallback === 'function' && - typeof cancelIdleCallback === 'function'; - if ( typeof performance === 'object' && typeof performance.now === 'function' @@ -359,50 +351,8 @@ if ( // Start a rAF loop. isRAFLoopRunning = true; requestAnimationFrame(rAFTime => { - if (requestIdleCallbackBeforeFirstFrame) { - cancelIdleCallback(idleCallbackID); - } - if (requestTimerEventBeforeFirstFrame) { - clearTimeout(idleTimeoutID); - } onAnimationFrame(rAFTime); }); - - // If we just missed the last vsync, the next rAF might not happen for - // another frame. To claim as much idle time as possible, post a - // callback with `requestIdleCallback`, which should fire if there's - // idle time left in the frame. - // - // This should only be an issue for the first rAF in the loop; - // subsequent rAFs are scheduled at the beginning of the - // preceding frame. - let idleCallbackID; - if (requestIdleCallbackBeforeFirstFrame) { - idleCallbackID = requestIdleCallback( - function onIdleCallbackBeforeFirstFrame() { - if (requestTimerEventBeforeFirstFrame) { - clearTimeout(idleTimeoutID); - } - frameDeadline = getCurrentTime() + frameLength; - performWorkUntilDeadline(); - }, - ); - } - // Alternate strategy to address the same problem. Scheduler a timer - // with no delay. If this fires before the rAF, that likely indicates - // that there's idle time before the next vsync. This isn't always the - // case, but we'll be aggressive and assume it is, as a trade off to - // prevent idle periods. - let idleTimeoutID; - if (requestTimerEventBeforeFirstFrame) { - idleTimeoutID = setTimeout(function onTimerEventBeforeFirstFrame() { - if (requestIdleCallbackBeforeFirstFrame) { - cancelIdleCallback(idleCallbackID); - } - frameDeadline = getCurrentTime() + frameLength; - performWorkUntilDeadline(); - }, 0); - } } } };