mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46270 Changelog: [internal] When analyzing traces, I noticed that we were using the choreographer to batch events in the native layer on Android. This approach isn't very efficient for 2 reasons: 1. The choreographer runs in specific intervals and there could be some delay between receiving the events and dispatching them from the choreographer. 2. A slow mount operation in the choreographer after receiving the event would completely block the dispatch for the whole duration of the operation. This could take as long as 100s of ms, so it can be very significant. This is especially relevant with layout events, which are dispatched using the same mechanism as input events. In this case, there are instances where we delay rendering in JS because we're doing an expensive mount in the UI thread. It makes sense to batch events in native so we don't do unnecessary work in JS to process them, but there's a better mechanism to do this. Instead of posting a frame callback in the choreographer, we can batch events using a new task in an Android handler running on the UI thread. This would run immediately after the job where the events are dispatched, after all the events are dispatched. This implements that mechanism behind a feature flag. Reviewed By: sammy-SC Differential Revision: D62004018 fbshipit-source-id: d8b78a75cf05d0d8c9dd867a82a776f8d293a683
276 lines
9.2 KiB
C++
276 lines
9.2 KiB
C++
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @generated SignedSource<<1461fc4acff2a28056df4faa4d622a16>>
|
|
*/
|
|
|
|
/**
|
|
* IMPORTANT: Do NOT modify this file directly.
|
|
*
|
|
* To change the definition of the flags, edit
|
|
* packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js.
|
|
*
|
|
* To regenerate this code, run the following script from the repo root:
|
|
* yarn featureflags-update
|
|
*/
|
|
|
|
#include "NativeReactNativeFeatureFlags.h"
|
|
#include <react/featureflags/ReactNativeFeatureFlags.h>
|
|
|
|
#ifdef RN_DISABLE_OSS_PLUGIN_HEADER
|
|
#include "Plugins.h"
|
|
#endif
|
|
|
|
std::shared_ptr<facebook::react::TurboModule>
|
|
NativeReactNativeFeatureFlagsModuleProvider(
|
|
std::shared_ptr<facebook::react::CallInvoker> jsInvoker) {
|
|
return std::make_shared<facebook::react::NativeReactNativeFeatureFlags>(
|
|
std::move(jsInvoker));
|
|
}
|
|
|
|
namespace facebook::react {
|
|
|
|
NativeReactNativeFeatureFlags::NativeReactNativeFeatureFlags(
|
|
std::shared_ptr<CallInvoker> jsInvoker)
|
|
: NativeReactNativeFeatureFlagsCxxSpec(std::move(jsInvoker)) {}
|
|
|
|
bool NativeReactNativeFeatureFlags::commonTestFlag(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::commonTestFlag();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::allowRecursiveCommitsWithSynchronousMountOnAndroid(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::allowRecursiveCommitsWithSynchronousMountOnAndroid();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::completeReactInstanceCreationOnBgThreadOnAndroid(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::completeReactInstanceCreationOnBgThreadOnAndroid();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::destroyFabricSurfacesInReactInstanceManager(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::destroyFabricSurfacesInReactInstanceManager();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableAlignItemsBaselineOnFabricIOS(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableAlignItemsBaselineOnFabricIOS();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableAndroidMixBlendModeProp(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableAndroidMixBlendModeProp();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableBackgroundStyleApplicator(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableBackgroundStyleApplicator();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableCleanTextInputYogaNode(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableCleanTextInputYogaNode();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableEagerRootViewAttachment(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableEagerRootViewAttachment();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableEventEmitterRetentionDuringGesturesOnAndroid(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableEventEmitterRetentionDuringGesturesOnAndroid();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableFabricLogs(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableFabricLogs();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableFabricRendererExclusively(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableFabricRendererExclusively();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableGranularShadowTreeStateReconciliation(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableGranularShadowTreeStateReconciliation();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableLayoutAnimationsOnIOS(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableLongTaskAPI(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableLongTaskAPI();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableMicrotasks(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableMicrotasks();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enablePropsUpdateReconciliationAndroid(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enablePropsUpdateReconciliationAndroid();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableReportEventPaintTime(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableReportEventPaintTime();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableSynchronousStateUpdates(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableSynchronousStateUpdates();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableUIConsistency(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableUIConsistency();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableViewRecycling(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableViewRecycling();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::excludeYogaFromRawProps(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::excludeYogaFromRawProps();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::fetchImagesInViewPreallocation(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::fetchImagesInViewPreallocation();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::fixIncorrectScrollViewStateUpdateOnAndroid(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::fixIncorrectScrollViewStateUpdateOnAndroid();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::fixMissedFabricStateUpdatesOnAndroid(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::fixMissedFabricStateUpdatesOnAndroid();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::fixMountingCoordinatorReportedPendingTransactionsOnAndroid(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::fixMountingCoordinatorReportedPendingTransactionsOnAndroid();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::forceBatchingMountItemsOnAndroid(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::forceBatchingMountItemsOnAndroid();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::fuseboxEnabledDebug(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::fuseboxEnabledDebug();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::fuseboxEnabledRelease(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::fuseboxEnabledRelease();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::initEagerTurboModulesOnNativeModulesQueueAndroid(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::initEagerTurboModulesOnNativeModulesQueueAndroid();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::lazyAnimationCallbacks(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::lazyAnimationCallbacks();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::loadVectorDrawablesOnImages(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::loadVectorDrawablesOnImages();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::setAndroidLayoutDirection(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::setAndroidLayoutDirection();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::useFabricInterop(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::useFabricInterop();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::useImmediateExecutorInAndroidBridgeless(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::useImmediateExecutorInAndroidBridgeless();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::useModernRuntimeScheduler(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::useModernRuntimeScheduler();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::useNativeViewConfigsInBridgelessMode(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::useNativeViewConfigsInBridgelessMode();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::useNewReactImageViewBackgroundDrawing(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::useNewReactImageViewBackgroundDrawing();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::useOptimisedViewPreallocationOnAndroid(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::useOptimisedViewPreallocationOnAndroid();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::useOptimizedEventBatchingOnAndroid(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::useOptimizedEventBatchingOnAndroid();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdate(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdate();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdateOnLayout(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdateOnLayout();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::useStateAlignmentMechanism(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::useStateAlignmentMechanism();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::useTurboModuleInterop(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::useTurboModuleInterop();
|
|
}
|
|
|
|
} // namespace facebook::react
|