Skip to content

Commit

Permalink
Clean up legacy feature flags for event loop (facebook#47565)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#47565

Changelog: [internal]

We unified the feature flags for the event loop in facebook#47084, but we left the legacy flags defined for temporary backwards compatibility.

We don't need that anymore, so we can clean them up.

Reviewed By: fabriziocucci

Differential Revision: D65606068

fbshipit-source-id: 403c278cef2afc8eddf07592d88cadc58765f660
  • Loading branch information
rubennorte authored and facebook-github-bot committed Nov 12, 2024
1 parent f3b7c7c commit d3c5446
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 91 deletions.
16 changes: 4 additions & 12 deletions packages/react-native/Libraries/Core/setUpTimers.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,10 @@ const isEventLoopEnabled = (() => {
return false;
}

if (NativeReactNativeFeatureFlags.disableEventLoopOnBridgeless == null) {
// Flags not unified yet
return (
ReactNativeFeatureFlags.useModernRuntimeScheduler() &&
ReactNativeFeatureFlags.enableMicrotasks()
);
} else {
return (
ReactNativeFeatureFlags.enableBridgelessArchitecture() &&
!ReactNativeFeatureFlags.disableEventLoopOnBridgeless()
);
}
return (
ReactNativeFeatureFlags.enableBridgelessArchitecture() &&
!ReactNativeFeatureFlags.disableEventLoopOnBridgeless()
);
})();

// In bridgeless mode, timers are host functions installed from cpp.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<1626340cbb5cc8958d6b16c9b717e91e>>
* @generated SignedSource<<def34bae6aeac9fbb98d2e3a89ffde32>>
*/

/**
Expand Down Expand Up @@ -54,13 +54,6 @@ bool NativeReactNativeFeatureFlags::allowRecursiveCommitsWithSynchronousMountOnA
return ReactNativeFeatureFlags::allowRecursiveCommitsWithSynchronousMountOnAndroid();
}

bool NativeReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop(
jsi::Runtime& /*runtime*/) {
// This flag is configured with `skipNativeAPI: true`.
// TODO(T204838867): Implement support for optional methods in C++ TM codegen and remove the method definition altogether.
return false;
}

bool NativeReactNativeFeatureFlags::completeReactInstanceCreationOnBgThreadOnAndroid(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::completeReactInstanceCreationOnBgThreadOnAndroid();
Expand Down Expand Up @@ -151,13 +144,6 @@ bool NativeReactNativeFeatureFlags::enableLongTaskAPI(
return ReactNativeFeatureFlags::enableLongTaskAPI();
}

bool NativeReactNativeFeatureFlags::enableMicrotasks(
jsi::Runtime& /*runtime*/) {
// This flag is configured with `skipNativeAPI: true`.
// TODO(T204838867): Implement support for optional methods in C++ TM codegen and remove the method definition altogether.
return false;
}

bool NativeReactNativeFeatureFlags::enableNewBackgroundAndBorderDrawables(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableNewBackgroundAndBorderDrawables();
Expand Down Expand Up @@ -258,13 +244,6 @@ bool NativeReactNativeFeatureFlags::useImmediateExecutorInAndroidBridgeless(
return ReactNativeFeatureFlags::useImmediateExecutorInAndroidBridgeless();
}

bool NativeReactNativeFeatureFlags::useModernRuntimeScheduler(
jsi::Runtime& /*runtime*/) {
// This flag is configured with `skipNativeAPI: true`.
// TODO(T204838867): Implement support for optional methods in C++ TM codegen and remove the method definition altogether.
return false;
}

bool NativeReactNativeFeatureFlags::useNativeViewConfigsInBridgelessMode(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::useNativeViewConfigsInBridgelessMode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<c283f40e36ee19d1f7d5d9aac4747e33>>
* @generated SignedSource<<a31d80cd12e1705dc076068e64d36a01>>
*/

/**
Expand Down Expand Up @@ -41,8 +41,6 @@ class NativeReactNativeFeatureFlags

bool allowRecursiveCommitsWithSynchronousMountOnAndroid(jsi::Runtime& runtime);

bool batchRenderingUpdatesInEventLoop(jsi::Runtime& runtime);

bool completeReactInstanceCreationOnBgThreadOnAndroid(jsi::Runtime& runtime);

bool disableEventLoopOnBridgeless(jsi::Runtime& runtime);
Expand Down Expand Up @@ -79,8 +77,6 @@ class NativeReactNativeFeatureFlags

bool enableLongTaskAPI(jsi::Runtime& runtime);

bool enableMicrotasks(jsi::Runtime& runtime);

bool enableNewBackgroundAndBorderDrawables(jsi::Runtime& runtime);

bool enablePreciseSchedulingForPremountItemsOnAndroid(jsi::Runtime& runtime);
Expand Down Expand Up @@ -121,8 +117,6 @@ class NativeReactNativeFeatureFlags

bool useImmediateExecutorInAndroidBridgeless(jsi::Runtime& runtime);

bool useModernRuntimeScheduler(jsi::Runtime& runtime);

bool useNativeViewConfigsInBridgelessMode(jsi::Runtime& runtime);

bool useOptimisedViewPreallocationOnAndroid(jsi::Runtime& runtime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@ const definitions: FeatureFlagDefinitions = {
purpose: 'experimentation',
},
},
batchRenderingUpdatesInEventLoop: {
defaultValue: false,
metadata: {
description:
'When enabled, the RuntimeScheduler processing the event loop will batch all rendering updates and dispatch them together at the end of each iteration of the loop.',
purpose: 'release',
},
// We're preparing to clean up this feature flag.
skipNativeAPI: true,
},
completeReactInstanceCreationOnBgThreadOnAndroid: {
defaultValue: false,
metadata: {
Expand Down Expand Up @@ -223,16 +213,6 @@ const definitions: FeatureFlagDefinitions = {
purpose: 'release',
},
},
enableMicrotasks: {
defaultValue: false,
metadata: {
description:
'Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution).',
purpose: 'release',
},
// We're preparing to clean up this feature flag.
skipNativeAPI: true,
},
enableNewBackgroundAndBorderDrawables: {
defaultValue: false,
metadata: {
Expand Down Expand Up @@ -406,16 +386,6 @@ const definitions: FeatureFlagDefinitions = {
purpose: 'experimentation',
},
},
useModernRuntimeScheduler: {
defaultValue: false,
metadata: {
description:
'When enabled, it uses the modern fork of RuntimeScheduler that allows scheduling tasks with priorities from any thread.',
purpose: 'release',
},
// We're preparing to clean up this feature flag.
skipNativeAPI: true,
},
useNativeViewConfigsInBridgelessMode: {
defaultValue: false,
metadata: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<fc2fed53108032e45071d0486a5db4a7>>
* @generated SignedSource<<d01ef9b03c2a4aac3a5ca77dc25ec7c3>>
* @flow strict
*/

Expand Down Expand Up @@ -53,7 +53,6 @@ export type ReactNativeFeatureFlags = {
commonTestFlag: Getter<boolean>,
commonTestFlagWithoutNativeImplementation: Getter<boolean>,
allowRecursiveCommitsWithSynchronousMountOnAndroid: Getter<boolean>,
batchRenderingUpdatesInEventLoop: Getter<boolean>,
completeReactInstanceCreationOnBgThreadOnAndroid: Getter<boolean>,
disableEventLoopOnBridgeless: Getter<boolean>,
disableMountItemReorderingAndroid: Getter<boolean>,
Expand All @@ -72,7 +71,6 @@ export type ReactNativeFeatureFlags = {
enableLayoutAnimationsOnAndroid: Getter<boolean>,
enableLayoutAnimationsOnIOS: Getter<boolean>,
enableLongTaskAPI: Getter<boolean>,
enableMicrotasks: Getter<boolean>,
enableNewBackgroundAndBorderDrawables: Getter<boolean>,
enablePreciseSchedulingForPremountItemsOnAndroid: Getter<boolean>,
enablePropsUpdateReconciliationAndroid: Getter<boolean>,
Expand All @@ -93,7 +91,6 @@ export type ReactNativeFeatureFlags = {
useAlwaysAvailableJSErrorHandling: Getter<boolean>,
useFabricInterop: Getter<boolean>,
useImmediateExecutorInAndroidBridgeless: Getter<boolean>,
useModernRuntimeScheduler: Getter<boolean>,
useNativeViewConfigsInBridgelessMode: Getter<boolean>,
useOptimisedViewPreallocationOnAndroid: Getter<boolean>,
useOptimizedEventBatchingOnAndroid: Getter<boolean>,
Expand Down Expand Up @@ -199,10 +196,6 @@ export const commonTestFlagWithoutNativeImplementation: Getter<boolean> = create
* Adds support for recursively processing commits that mount synchronously (Android only).
*/
export const allowRecursiveCommitsWithSynchronousMountOnAndroid: Getter<boolean> = createNativeFlagGetter('allowRecursiveCommitsWithSynchronousMountOnAndroid', false);
/**
* When enabled, the RuntimeScheduler processing the event loop will batch all rendering updates and dispatch them together at the end of each iteration of the loop.
*/
export const batchRenderingUpdatesInEventLoop: Getter<boolean> = createNativeFlagGetter('batchRenderingUpdatesInEventLoop', false);
/**
* Do not wait for a main-thread dispatch to complete init to start executing work on the JS thread on Android
*/
Expand Down Expand Up @@ -275,10 +268,6 @@ export const enableLayoutAnimationsOnIOS: Getter<boolean> = createNativeFlagGett
* Enables the reporting of long tasks through `PerformanceObserver`. Only works if the event loop is enabled.
*/
export const enableLongTaskAPI: Getter<boolean> = createNativeFlagGetter('enableLongTaskAPI', false);
/**
* Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution).
*/
export const enableMicrotasks: Getter<boolean> = createNativeFlagGetter('enableMicrotasks', false);
/**
* Use BackgroundDrawable and BorderDrawable instead of CSSBackgroundDrawable
*/
Expand Down Expand Up @@ -359,10 +348,6 @@ export const useFabricInterop: Getter<boolean> = createNativeFlagGetter('useFabr
* Invoke callbacks immediately on the ReactInstance rather than going through a background thread for synchronization
*/
export const useImmediateExecutorInAndroidBridgeless: Getter<boolean> = createNativeFlagGetter('useImmediateExecutorInAndroidBridgeless', false);
/**
* When enabled, it uses the modern fork of RuntimeScheduler that allows scheduling tasks with priorities from any thread.
*/
export const useModernRuntimeScheduler: Getter<boolean> = createNativeFlagGetter('useModernRuntimeScheduler', false);
/**
* When enabled, the native view configs are used in bridgeless mode.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<53510b80964a952f0fc4ed97a6d59386>>
* @generated SignedSource<<a1cbc6a91551de0008c070adb5d805fd>>
* @flow strict
*/

Expand All @@ -26,7 +26,6 @@ export interface Spec extends TurboModule {
+commonTestFlag?: () => boolean;
+commonTestFlagWithoutNativeImplementation?: () => boolean;
+allowRecursiveCommitsWithSynchronousMountOnAndroid?: () => boolean;
+batchRenderingUpdatesInEventLoop?: () => boolean;
+completeReactInstanceCreationOnBgThreadOnAndroid?: () => boolean;
+disableEventLoopOnBridgeless?: () => boolean;
+disableMountItemReorderingAndroid?: () => boolean;
Expand All @@ -45,7 +44,6 @@ export interface Spec extends TurboModule {
+enableLayoutAnimationsOnAndroid?: () => boolean;
+enableLayoutAnimationsOnIOS?: () => boolean;
+enableLongTaskAPI?: () => boolean;
+enableMicrotasks?: () => boolean;
+enableNewBackgroundAndBorderDrawables?: () => boolean;
+enablePreciseSchedulingForPremountItemsOnAndroid?: () => boolean;
+enablePropsUpdateReconciliationAndroid?: () => boolean;
Expand All @@ -66,7 +64,6 @@ export interface Spec extends TurboModule {
+useAlwaysAvailableJSErrorHandling?: () => boolean;
+useFabricInterop?: () => boolean;
+useImmediateExecutorInAndroidBridgeless?: () => boolean;
+useModernRuntimeScheduler?: () => boolean;
+useNativeViewConfigsInBridgelessMode?: () => boolean;
+useOptimisedViewPreallocationOnAndroid?: () => boolean;
+useOptimizedEventBatchingOnAndroid?: () => boolean;
Expand Down

0 comments on commit d3c5446

Please sign in to comment.