Add feature flags for scheduler experiments (#22105)

This commit is contained in:
Ricky
2021-08-24 12:47:51 -04:00
committed by GitHub
parent edfe50510b
commit b0b53ae2c1
4 changed files with 17 additions and 7 deletions
@@ -9,3 +9,6 @@
export const enableSchedulerDebugging = false;
export const enableIsInputPending = false;
export const enableProfiling = false;
export const enableIsInputPendingContinuous = false;
export const frameYieldMs = 5;
export const continuousYieldMs = 50;
+8 -7
View File
@@ -11,6 +11,10 @@
import {
enableSchedulerDebugging,
enableProfiling,
enableIsInputPending,
enableIsInputPendingContinuous,
frameYieldMs,
continuousYieldMs,
} from '../SchedulerFeatureFlags';
import {push, pop, peek} from '../SchedulerMinHeap';
@@ -36,8 +40,6 @@ import {
startLoggingProfilingEvents,
} from '../SchedulerProfiling';
import {enableIsInputPending} from '../SchedulerFeatureFlags';
let getCurrentTime;
const hasPerformanceNow =
typeof performance === 'object' && typeof performance.now === 'function';
@@ -98,7 +100,7 @@ const isInputPending =
? navigator.scheduling.isInputPending.bind(navigator.scheduling)
: null;
const continuousOptions = {includeContinuous: true};
const continuousOptions = {includeContinuous: enableIsInputPendingContinuous};
function advanceTimers(currentTime) {
// Check for tasks that are no longer delayed and add them to the queue.
@@ -427,9 +429,8 @@ let taskTimeoutID = -1;
// thread, like user events. By default, it yields multiple times per frame.
// It does not attempt to align with frame boundaries, since most tasks don't
// need to be frame aligned; for those that do, use requestAnimationFrame.
// TODO: Make these configurable
let frameInterval = 5;
const continuousInputInterval = 50;
let frameInterval = frameYieldMs;
const continuousInputInterval = continuousYieldMs;
const maxInterval = 300;
let startTime = -1;
@@ -506,7 +507,7 @@ function forceFrameRate(fps) {
frameInterval = Math.floor(1000 / fps);
} else {
// reset the framerate
frameInterval = 5;
frameInterval = frameYieldMs;
}
}
@@ -15,3 +15,6 @@
export const enableIsInputPending = __VARIANT__;
export const enableSchedulerDebugging = __VARIANT__;
export const enableProfiling = __VARIANT__;
export const enableIsInputPendingContinuous = __VARIANT__;
export const frameYieldMs = 5;
export const continuousYieldMs = 50;
@@ -13,6 +13,9 @@ export const {
enableIsInputPending,
enableSchedulerDebugging,
enableProfiling: enableProfilingFeatureFlag,
enableIsInputPendingContinuous,
frameYieldMs,
continuousYieldMs,
} = dynamicFeatureFlags;
export const enableProfiling = __PROFILE__ && enableProfilingFeatureFlag;