Skip to content

Commit

Permalink
Remove experimental scheduler flags (#16672)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored Sep 5, 2019
1 parent ff00645 commit 962dfc2
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 54 deletions.
2 changes: 0 additions & 2 deletions packages/scheduler/src/SchedulerFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -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__;
2 changes: 0 additions & 2 deletions packages/scheduler/src/forks/SchedulerFeatureFlags.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ export const {
} = require('SchedulerFeatureFlags');

export const enableProfiling = __PROFILE__;
export const requestIdleCallbackBeforeFirstFrame = false;
export const requestTimerEventBeforeFirstFrame = false;
export const enableMessageLoopImplementation = true;
50 changes: 0 additions & 50 deletions packages/scheduler/src/forks/SchedulerHostConfig.default.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import {
enableIsInputPending,
requestIdleCallbackBeforeFirstFrame as requestIdleCallbackBeforeFirstFrameFlag,
requestTimerEventBeforeFirstFrame,
enableMessageLoopImplementation,
} from '../SchedulerFeatureFlags';

Expand Down Expand Up @@ -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
Expand All @@ -107,11 +104,6 @@ if (
}
}

const requestIdleCallbackBeforeFirstFrame =
requestIdleCallbackBeforeFirstFrameFlag &&
typeof requestIdleCallback === 'function' &&
typeof cancelIdleCallback === 'function';

if (
typeof performance === 'object' &&
typeof performance.now === 'function'
Expand Down Expand Up @@ -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);
}
}
}
};
Expand Down

0 comments on commit 962dfc2

Please sign in to comment.