Clean up legacy feature flags for event loop (#47565)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47565

Changelog: [internal]

We unified the feature flags for the event loop in https://github.com/facebook/react-native/pull/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
This commit is contained in:
Rubén Norte
2024-11-12 12:43:11 -08:00
committed by Facebook GitHub Bot
parent f3b7c7c569
commit d3c5446a6e
6 changed files with 8 additions and 91 deletions
+4 -12
View File
@@ -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.
@@ -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>>
*/
/**
@@ -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();
@@ -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();
@@ -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();
@@ -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>>
*/
/**
@@ -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);
@@ -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);
@@ -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);
@@ -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: {
@@ -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: {
@@ -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: {
@@ -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
*/
@@ -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>,
@@ -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>,
@@ -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>,
@@ -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
*/
@@ -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
*/
@@ -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.
*/
@@ -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
*/
@@ -26,7 +26,6 @@ export interface Spec extends TurboModule {
+commonTestFlag?: () => boolean;
+commonTestFlagWithoutNativeImplementation?: () => boolean;
+allowRecursiveCommitsWithSynchronousMountOnAndroid?: () => boolean;
+batchRenderingUpdatesInEventLoop?: () => boolean;
+completeReactInstanceCreationOnBgThreadOnAndroid?: () => boolean;
+disableEventLoopOnBridgeless?: () => boolean;
+disableMountItemReorderingAndroid?: () => boolean;
@@ -45,7 +44,6 @@ export interface Spec extends TurboModule {
+enableLayoutAnimationsOnAndroid?: () => boolean;
+enableLayoutAnimationsOnIOS?: () => boolean;
+enableLongTaskAPI?: () => boolean;
+enableMicrotasks?: () => boolean;
+enableNewBackgroundAndBorderDrawables?: () => boolean;
+enablePreciseSchedulingForPremountItemsOnAndroid?: () => boolean;
+enablePropsUpdateReconciliationAndroid?: () => boolean;
@@ -66,7 +64,6 @@ export interface Spec extends TurboModule {
+useAlwaysAvailableJSErrorHandling?: () => boolean;
+useFabricInterop?: () => boolean;
+useImmediateExecutorInAndroidBridgeless?: () => boolean;
+useModernRuntimeScheduler?: () => boolean;
+useNativeViewConfigsInBridgelessMode?: () => boolean;
+useOptimisedViewPreallocationOnAndroid?: () => boolean;
+useOptimizedEventBatchingOnAndroid?: () => boolean;