Skip to content

Commit

Permalink
[www] reduce dynamic SchedulerFeatureFlags (#26617)
Browse files Browse the repository at this point in the history
For these values we're not using dynamic values. We can statically
compile in the values we're running.
  • Loading branch information
kassens authored May 10, 2023
1 parent 7cd98ef commit df12d7e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 23 deletions.
8 changes: 4 additions & 4 deletions packages/scheduler/src/__tests__/Scheduler-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ describe('SchedulerBrowser', () => {
// about, like a network event.
gate(flags =>
flags.enableIsInputPending
? 'Yield at 300ms'
? 'Yield at 10ms'
: // When isInputPending is disabled, we always yield quickly
'Yield at 5ms',
),
Expand Down Expand Up @@ -398,7 +398,7 @@ describe('SchedulerBrowser', () => {
// about, like a network event.
gate(flags =>
flags.enableIsInputPending
? 'Yield at 300ms'
? 'Yield at 10ms'
: // When isInputPending is disabled, we always yield quickly
'Yield at 5ms',
),
Expand All @@ -423,7 +423,7 @@ describe('SchedulerBrowser', () => {
// as quickly as for a discrete event.
gate(flags =>
flags.enableIsInputPending
? 'Yield at 50ms'
? 'Yield at 10ms'
: // When isInputPending is disabled, we always yield quickly
'Yield at 5ms',
),
Expand Down Expand Up @@ -453,7 +453,7 @@ describe('SchedulerBrowser', () => {
'Task with no paint',
gate(flags =>
flags.enableIsInputPending
? 'Yield at 300ms'
? 'Yield at 10ms'
: // When isInputPending is disabled, we always yield quickly
'Yield at 5ms',
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,4 @@
// Use __VARIANT__ to simulate a GK. The tests will be run twice: once
// with the __VARIANT__ set to `true`, and once set to `false`.

export const enableIsInputPending = __VARIANT__;
export const enableSchedulerDebugging = __VARIANT__;
export const enableProfiling = __VARIANT__;
export const enableIsInputPendingContinuous = __VARIANT__;
export const frameYieldMs = 5;
export const continuousYieldMs = 50;
export const maxYieldMs = 300;
22 changes: 9 additions & 13 deletions packages/scheduler/src/forks/SchedulerFeatureFlags.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,15 @@
* @flow
*/

// $FlowFixMe[cannot-resolve-module]
const dynamicFeatureFlags = require('SchedulerFeatureFlags');

// Re-export dynamic flags from the www version.
export const {
enableIsInputPending,
enableSchedulerDebugging,
enableProfiling: enableProfilingFeatureFlag,
enableIsInputPendingContinuous,
frameYieldMs,
continuousYieldMs,
maxYieldMs,
} = dynamicFeatureFlags;
const {enableProfiling: enableProfilingFeatureFlag} =
// $FlowFixMe[cannot-resolve-module]
require('SchedulerFeatureFlags');

export const enableSchedulerDebugging = true;
export const enableProfiling: boolean =
__PROFILE__ && enableProfilingFeatureFlag;
export const enableIsInputPending = true;
export const enableIsInputPendingContinuous = true;
export const frameYieldMs = 5;
export const continuousYieldMs = 10;
export const maxYieldMs = 10;

0 comments on commit df12d7e

Please sign in to comment.