Execute insert mount instructions after layout update and state update (#45448)

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

changelog: [internal]

I would like to experiment with executing insert mount instructions after layout and state update. It has shown small improvement in local testing

Reviewed By: mdvacca

Differential Revision: D59582123

fbshipit-source-id: 3ee6ec12a533a287ed32f7373863175f3a107548
This commit is contained in:
Samuel Susla
2024-07-16 02:13:12 -07:00
committed by Facebook GitHub Bot
parent 4d88b20847
commit 334b5c9fdb
20 changed files with 206 additions and 47 deletions
@@ -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<<298c05e5b7384384b5fcdd851a298738>>
* @generated SignedSource<<2dda5cec029bcd7bb62e428f4b4557f5>>
*/
/**
@@ -52,6 +52,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun batchRenderingUpdatesInEventLoop(): Boolean = accessor.batchRenderingUpdatesInEventLoop()
/**
* When enabled, insert of views on Android will be moved from the beginning of the IntBufferBatchMountItem to be after layout updates.
*/
@JvmStatic
public fun changeOrderOfMountingInstructionsOnAndroid(): Boolean = accessor.changeOrderOfMountingInstructionsOnAndroid()
/**
* When enabled, ReactInstanceManager will clean up Fabric surfaces on destroy().
*/
@@ -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<<5eff2e46b755c3d363ec5635831bf492>>
* @generated SignedSource<<125b4c5029a2f7f3d10ecd6f5382c46c>>
*/
/**
@@ -24,6 +24,7 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
private var allowCollapsableChildrenCache: Boolean? = null
private var allowRecursiveCommitsWithSynchronousMountOnAndroidCache: Boolean? = null
private var batchRenderingUpdatesInEventLoopCache: Boolean? = null
private var changeOrderOfMountingInstructionsOnAndroidCache: Boolean? = null
private var destroyFabricSurfacesInReactInstanceManagerCache: Boolean? = null
private var enableAlignItemsBaselineOnFabricIOSCache: Boolean? = null
private var enableCleanTextInputYogaNodeCache: Boolean? = null
@@ -87,6 +88,15 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}
override fun changeOrderOfMountingInstructionsOnAndroid(): Boolean {
var cached = changeOrderOfMountingInstructionsOnAndroidCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.changeOrderOfMountingInstructionsOnAndroid()
changeOrderOfMountingInstructionsOnAndroidCache = cached
}
return cached
}
override fun destroyFabricSurfacesInReactInstanceManager(): Boolean {
var cached = destroyFabricSurfacesInReactInstanceManagerCache
if (cached == null) {
@@ -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<<29a946df7b0cbe24a476873adcf574ee>>
* @generated SignedSource<<15d521183f0efa93c87155890d88cf72>>
*/
/**
@@ -36,6 +36,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
@DoNotStrip @JvmStatic public external fun batchRenderingUpdatesInEventLoop(): Boolean
@DoNotStrip @JvmStatic public external fun changeOrderOfMountingInstructionsOnAndroid(): Boolean
@DoNotStrip @JvmStatic public external fun destroyFabricSurfacesInReactInstanceManager(): Boolean
@DoNotStrip @JvmStatic public external fun enableAlignItemsBaselineOnFabricIOS(): Boolean
@@ -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<<0fa4e9e2c5f3d96f729f5822783ce86f>>
* @generated SignedSource<<1f8a830a3dec9278f4cd387bb706864e>>
*/
/**
@@ -31,6 +31,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun batchRenderingUpdatesInEventLoop(): Boolean = false
override fun changeOrderOfMountingInstructionsOnAndroid(): Boolean = false
override fun destroyFabricSurfacesInReactInstanceManager(): Boolean = false
override fun enableAlignItemsBaselineOnFabricIOS(): Boolean = true
@@ -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<<105ab999064160753e636f86edfc00a2>>
* @generated SignedSource<<0b90fde158e97c4cad711c3ab832f067>>
*/
/**
@@ -28,6 +28,7 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
private var allowCollapsableChildrenCache: Boolean? = null
private var allowRecursiveCommitsWithSynchronousMountOnAndroidCache: Boolean? = null
private var batchRenderingUpdatesInEventLoopCache: Boolean? = null
private var changeOrderOfMountingInstructionsOnAndroidCache: Boolean? = null
private var destroyFabricSurfacesInReactInstanceManagerCache: Boolean? = null
private var enableAlignItemsBaselineOnFabricIOSCache: Boolean? = null
private var enableCleanTextInputYogaNodeCache: Boolean? = null
@@ -95,6 +96,16 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun changeOrderOfMountingInstructionsOnAndroid(): Boolean {
var cached = changeOrderOfMountingInstructionsOnAndroidCache
if (cached == null) {
cached = currentProvider.changeOrderOfMountingInstructionsOnAndroid()
accessedFeatureFlags.add("changeOrderOfMountingInstructionsOnAndroid")
changeOrderOfMountingInstructionsOnAndroidCache = cached
}
return cached
}
override fun destroyFabricSurfacesInReactInstanceManager(): Boolean {
var cached = destroyFabricSurfacesInReactInstanceManagerCache
if (cached == null) {
@@ -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<<38e08cba4070759027d73c74c0f26e01>>
* @generated SignedSource<<55fa16b3333fb8e2820a078c68850f91>>
*/
/**
@@ -31,6 +31,8 @@ public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun batchRenderingUpdatesInEventLoop(): Boolean
@DoNotStrip public fun changeOrderOfMountingInstructionsOnAndroid(): Boolean
@DoNotStrip public fun destroyFabricSurfacesInReactInstanceManager(): Boolean
@DoNotStrip public fun enableAlignItemsBaselineOnFabricIOS(): Boolean
@@ -487,10 +487,18 @@ void FabricMountingManager::executeMount(
int objBufferPosition = 0;
int prevMountItemType = -1;
jint temp[8];
// Fill in CREATE instructions.
for (int i = 0; i < cppCommonMountItems.size(); i++) {
const auto& mountItem = cppCommonMountItems[i];
const auto& mountItemType = mountItem.type;
if (ReactNativeFeatureFlags::changeOrderOfMountingInstructionsOnAndroid() &&
mountItemType != CppMountItem::Type::Create) {
prevMountItemType = -1;
// Skip all mount items except Create.
continue;
}
// Get type here, and count forward how many items of this type are in a
// row. Write preamble to any common type here.
if (prevMountItemType != mountItemType) {
@@ -510,7 +518,6 @@ void FabricMountingManager::executeMount(
}
prevMountItemType = mountItemType;
// TODO: multi-create, multi-insert, etc
if (mountItemType == CppMountItem::Type::Create) {
auto componentName =
getPlatformComponentName(mountItem.newChildShadowView);
@@ -557,9 +564,10 @@ void FabricMountingManager::executeMount(
env->SetIntArrayRegion(intBufferArray, intBufferPosition, 3, temp);
intBufferPosition += 3;
} else {
LOG(ERROR) << "Unexpected CppMountItem type";
LOG(ERROR) << "Unexpected CppMountItem type: " << mountItemType;
}
}
if (!cppUpdatePropsMountItems.empty()) {
writeIntBufferTypePreamble(
CppMountItem::Type::UpdateProps,
@@ -719,6 +727,55 @@ void FabricMountingManager::executeMount(
}
}
if (ReactNativeFeatureFlags::changeOrderOfMountingInstructionsOnAndroid()) {
// Fill in all other instructions.
prevMountItemType = -1;
for (int i = 0; i < cppCommonMountItems.size(); i++) {
const auto& mountItem = cppCommonMountItems[i];
const auto& mountItemType = mountItem.type;
if (mountItemType == CppMountItem::Type::Create) {
prevMountItemType = -1;
continue;
}
// Get type here, and count forward how many items of this type are in
// row. Write preamble to any common type here.
if (prevMountItemType != mountItemType) {
int numSameItemTypes = 1;
for (int j = i + 1; j < cppCommonMountItems.size() &&
cppCommonMountItems[j].type == mountItemType;
j++) {
numSameItemTypes++;
}
writeIntBufferTypePreamble(
mountItemType,
numSameItemTypes,
env,
intBufferArray,
intBufferPosition);
}
prevMountItemType = mountItemType;
if (mountItemType == CppMountItem::Type::Insert) {
temp[0] = mountItem.newChildShadowView.tag;
temp[1] = mountItem.parentShadowView.tag;
temp[2] = mountItem.index;
env->SetIntArrayRegion(intBufferArray, intBufferPosition, 3, temp);
intBufferPosition += 3;
} else if (mountItemType == CppMountItem::Remove) {
temp[0] = mountItem.oldChildShadowView.tag;
temp[1] = mountItem.parentShadowView.tag;
temp[2] = mountItem.index;
env->SetIntArrayRegion(intBufferArray, intBufferPosition, 3, temp);
intBufferPosition += 3;
} else {
LOG(ERROR) << "Unexpected CppMountItem type: " << mountItemType;
}
}
}
// Write deletes last - so that all prop updates, etc, for the tag in the same
// batch don't fail. Without additional machinery, moving deletes here
// requires that the differ never produces "DELETE...CREATE" in that order for
@@ -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<<2e96ad47b2024e6461c46855e473b3d2>>
* @generated SignedSource<<0be20439a937a322afa27a9c935a98ad>>
*/
/**
@@ -63,6 +63,12 @@ class ReactNativeFeatureFlagsProviderHolder
return method(javaProvider_);
}
bool changeOrderOfMountingInstructionsOnAndroid() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("changeOrderOfMountingInstructionsOnAndroid");
return method(javaProvider_);
}
bool destroyFabricSurfacesInReactInstanceManager() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("destroyFabricSurfacesInReactInstanceManager");
@@ -243,6 +249,11 @@ bool JReactNativeFeatureFlagsCxxInterop::batchRenderingUpdatesInEventLoop(
return ReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop();
}
bool JReactNativeFeatureFlagsCxxInterop::changeOrderOfMountingInstructionsOnAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::changeOrderOfMountingInstructionsOnAndroid();
}
bool JReactNativeFeatureFlagsCxxInterop::destroyFabricSurfacesInReactInstanceManager(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::destroyFabricSurfacesInReactInstanceManager();
@@ -402,6 +413,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"batchRenderingUpdatesInEventLoop",
JReactNativeFeatureFlagsCxxInterop::batchRenderingUpdatesInEventLoop),
makeNativeMethod(
"changeOrderOfMountingInstructionsOnAndroid",
JReactNativeFeatureFlagsCxxInterop::changeOrderOfMountingInstructionsOnAndroid),
makeNativeMethod(
"destroyFabricSurfacesInReactInstanceManager",
JReactNativeFeatureFlagsCxxInterop::destroyFabricSurfacesInReactInstanceManager),
@@ -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<<bf524a8190bafa5f1aa7a60c0d3879f0>>
* @generated SignedSource<<5771674cf23f066fb2c7a493441e9967>>
*/
/**
@@ -42,6 +42,9 @@ class JReactNativeFeatureFlagsCxxInterop
static bool batchRenderingUpdatesInEventLoop(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool changeOrderOfMountingInstructionsOnAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool destroyFabricSurfacesInReactInstanceManager(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
@@ -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<<84bc0f2c1750310a2062ba947df45104>>
* @generated SignedSource<<0f673fbed5f3cce13f7a42a8817ed404>>
*/
/**
@@ -37,6 +37,10 @@ bool ReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop() {
return getAccessor().batchRenderingUpdatesInEventLoop();
}
bool ReactNativeFeatureFlags::changeOrderOfMountingInstructionsOnAndroid() {
return getAccessor().changeOrderOfMountingInstructionsOnAndroid();
}
bool ReactNativeFeatureFlags::destroyFabricSurfacesInReactInstanceManager() {
return getAccessor().destroyFabricSurfacesInReactInstanceManager();
}
@@ -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<<f2c4d9731984436f95d178639074664d>>
* @generated SignedSource<<f9c32a7245be31e900aa51f2b93a61d4>>
*/
/**
@@ -57,6 +57,11 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool batchRenderingUpdatesInEventLoop();
/**
* When enabled, insert of views on Android will be moved from the beginning of the IntBufferBatchMountItem to be after layout updates.
*/
RN_EXPORT static bool changeOrderOfMountingInstructionsOnAndroid();
/**
* When enabled, ReactInstanceManager will clean up Fabric surfaces on destroy().
*/
@@ -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<<617b5fe964a8e57aec09d92d686b7acd>>
* @generated SignedSource<<1ee6db4bee3b22c31d5f70785ea9e91a>>
*/
/**
@@ -101,6 +101,24 @@ bool ReactNativeFeatureFlagsAccessor::batchRenderingUpdatesInEventLoop() {
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::changeOrderOfMountingInstructionsOnAndroid() {
auto flagValue = changeOrderOfMountingInstructionsOnAndroid_.load();
if (!flagValue.has_value()) {
// This block is not exclusive but it is not necessary.
// If multiple threads try to initialize the feature flag, we would only
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(4, "changeOrderOfMountingInstructionsOnAndroid");
flagValue = currentProvider_->changeOrderOfMountingInstructionsOnAndroid();
changeOrderOfMountingInstructionsOnAndroid_ = flagValue;
}
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::destroyFabricSurfacesInReactInstanceManager() {
auto flagValue = destroyFabricSurfacesInReactInstanceManager_.load();
@@ -110,7 +128,7 @@ bool ReactNativeFeatureFlagsAccessor::destroyFabricSurfacesInReactInstanceManage
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(4, "destroyFabricSurfacesInReactInstanceManager");
markFlagAsAccessed(5, "destroyFabricSurfacesInReactInstanceManager");
flagValue = currentProvider_->destroyFabricSurfacesInReactInstanceManager();
destroyFabricSurfacesInReactInstanceManager_ = flagValue;
@@ -128,7 +146,7 @@ bool ReactNativeFeatureFlagsAccessor::enableAlignItemsBaselineOnFabricIOS() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(5, "enableAlignItemsBaselineOnFabricIOS");
markFlagAsAccessed(6, "enableAlignItemsBaselineOnFabricIOS");
flagValue = currentProvider_->enableAlignItemsBaselineOnFabricIOS();
enableAlignItemsBaselineOnFabricIOS_ = flagValue;
@@ -146,7 +164,7 @@ bool ReactNativeFeatureFlagsAccessor::enableCleanTextInputYogaNode() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(6, "enableCleanTextInputYogaNode");
markFlagAsAccessed(7, "enableCleanTextInputYogaNode");
flagValue = currentProvider_->enableCleanTextInputYogaNode();
enableCleanTextInputYogaNode_ = flagValue;
@@ -164,7 +182,7 @@ bool ReactNativeFeatureFlagsAccessor::enableGranularShadowTreeStateReconciliatio
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(7, "enableGranularShadowTreeStateReconciliation");
markFlagAsAccessed(8, "enableGranularShadowTreeStateReconciliation");
flagValue = currentProvider_->enableGranularShadowTreeStateReconciliation();
enableGranularShadowTreeStateReconciliation_ = flagValue;
@@ -182,7 +200,7 @@ bool ReactNativeFeatureFlagsAccessor::enableMicrotasks() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(8, "enableMicrotasks");
markFlagAsAccessed(9, "enableMicrotasks");
flagValue = currentProvider_->enableMicrotasks();
enableMicrotasks_ = flagValue;
@@ -200,7 +218,7 @@ bool ReactNativeFeatureFlagsAccessor::enablePropsUpdateReconciliationAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(9, "enablePropsUpdateReconciliationAndroid");
markFlagAsAccessed(10, "enablePropsUpdateReconciliationAndroid");
flagValue = currentProvider_->enablePropsUpdateReconciliationAndroid();
enablePropsUpdateReconciliationAndroid_ = flagValue;
@@ -218,7 +236,7 @@ bool ReactNativeFeatureFlagsAccessor::enableSynchronousStateUpdates() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(10, "enableSynchronousStateUpdates");
markFlagAsAccessed(11, "enableSynchronousStateUpdates");
flagValue = currentProvider_->enableSynchronousStateUpdates();
enableSynchronousStateUpdates_ = flagValue;
@@ -236,7 +254,7 @@ bool ReactNativeFeatureFlagsAccessor::enableUIConsistency() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(11, "enableUIConsistency");
markFlagAsAccessed(12, "enableUIConsistency");
flagValue = currentProvider_->enableUIConsistency();
enableUIConsistency_ = flagValue;
@@ -254,7 +272,7 @@ bool ReactNativeFeatureFlagsAccessor::fetchImagesInViewPreallocation() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(12, "fetchImagesInViewPreallocation");
markFlagAsAccessed(13, "fetchImagesInViewPreallocation");
flagValue = currentProvider_->fetchImagesInViewPreallocation();
fetchImagesInViewPreallocation_ = flagValue;
@@ -272,7 +290,7 @@ bool ReactNativeFeatureFlagsAccessor::fixIncorrectScrollViewStateUpdateOnAndroid
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(13, "fixIncorrectScrollViewStateUpdateOnAndroid");
markFlagAsAccessed(14, "fixIncorrectScrollViewStateUpdateOnAndroid");
flagValue = currentProvider_->fixIncorrectScrollViewStateUpdateOnAndroid();
fixIncorrectScrollViewStateUpdateOnAndroid_ = flagValue;
@@ -290,7 +308,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMappingOfEventPrioritiesBetweenFabricAn
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(14, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
markFlagAsAccessed(15, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact();
fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue;
@@ -308,7 +326,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMissedFabricStateUpdatesOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(15, "fixMissedFabricStateUpdatesOnAndroid");
markFlagAsAccessed(16, "fixMissedFabricStateUpdatesOnAndroid");
flagValue = currentProvider_->fixMissedFabricStateUpdatesOnAndroid();
fixMissedFabricStateUpdatesOnAndroid_ = flagValue;
@@ -326,7 +344,7 @@ bool ReactNativeFeatureFlagsAccessor::forceBatchingMountItemsOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(16, "forceBatchingMountItemsOnAndroid");
markFlagAsAccessed(17, "forceBatchingMountItemsOnAndroid");
flagValue = currentProvider_->forceBatchingMountItemsOnAndroid();
forceBatchingMountItemsOnAndroid_ = flagValue;
@@ -344,7 +362,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledDebug() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(17, "fuseboxEnabledDebug");
markFlagAsAccessed(18, "fuseboxEnabledDebug");
flagValue = currentProvider_->fuseboxEnabledDebug();
fuseboxEnabledDebug_ = flagValue;
@@ -362,7 +380,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledRelease() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(18, "fuseboxEnabledRelease");
markFlagAsAccessed(19, "fuseboxEnabledRelease");
flagValue = currentProvider_->fuseboxEnabledRelease();
fuseboxEnabledRelease_ = flagValue;
@@ -380,7 +398,7 @@ bool ReactNativeFeatureFlagsAccessor::initEagerTurboModulesOnNativeModulesQueueA
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(19, "initEagerTurboModulesOnNativeModulesQueueAndroid");
markFlagAsAccessed(20, "initEagerTurboModulesOnNativeModulesQueueAndroid");
flagValue = currentProvider_->initEagerTurboModulesOnNativeModulesQueueAndroid();
initEagerTurboModulesOnNativeModulesQueueAndroid_ = flagValue;
@@ -398,7 +416,7 @@ bool ReactNativeFeatureFlagsAccessor::lazyAnimationCallbacks() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(20, "lazyAnimationCallbacks");
markFlagAsAccessed(21, "lazyAnimationCallbacks");
flagValue = currentProvider_->lazyAnimationCallbacks();
lazyAnimationCallbacks_ = flagValue;
@@ -416,7 +434,7 @@ bool ReactNativeFeatureFlagsAccessor::loadVectorDrawablesOnImages() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(21, "loadVectorDrawablesOnImages");
markFlagAsAccessed(22, "loadVectorDrawablesOnImages");
flagValue = currentProvider_->loadVectorDrawablesOnImages();
loadVectorDrawablesOnImages_ = flagValue;
@@ -434,7 +452,7 @@ bool ReactNativeFeatureFlagsAccessor::setAndroidLayoutDirection() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(22, "setAndroidLayoutDirection");
markFlagAsAccessed(23, "setAndroidLayoutDirection");
flagValue = currentProvider_->setAndroidLayoutDirection();
setAndroidLayoutDirection_ = flagValue;
@@ -452,7 +470,7 @@ bool ReactNativeFeatureFlagsAccessor::useImmediateExecutorInAndroidBridgeless()
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(23, "useImmediateExecutorInAndroidBridgeless");
markFlagAsAccessed(24, "useImmediateExecutorInAndroidBridgeless");
flagValue = currentProvider_->useImmediateExecutorInAndroidBridgeless();
useImmediateExecutorInAndroidBridgeless_ = flagValue;
@@ -470,7 +488,7 @@ bool ReactNativeFeatureFlagsAccessor::useModernRuntimeScheduler() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(24, "useModernRuntimeScheduler");
markFlagAsAccessed(25, "useModernRuntimeScheduler");
flagValue = currentProvider_->useModernRuntimeScheduler();
useModernRuntimeScheduler_ = flagValue;
@@ -488,7 +506,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(25, "useNativeViewConfigsInBridgelessMode");
markFlagAsAccessed(26, "useNativeViewConfigsInBridgelessMode");
flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode();
useNativeViewConfigsInBridgelessMode_ = flagValue;
@@ -506,7 +524,7 @@ bool ReactNativeFeatureFlagsAccessor::useNewReactImageViewBackgroundDrawing() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(26, "useNewReactImageViewBackgroundDrawing");
markFlagAsAccessed(27, "useNewReactImageViewBackgroundDrawing");
flagValue = currentProvider_->useNewReactImageViewBackgroundDrawing();
useNewReactImageViewBackgroundDrawing_ = flagValue;
@@ -524,7 +542,7 @@ bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdate() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(27, "useRuntimeShadowNodeReferenceUpdate");
markFlagAsAccessed(28, "useRuntimeShadowNodeReferenceUpdate");
flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdate();
useRuntimeShadowNodeReferenceUpdate_ = flagValue;
@@ -542,7 +560,7 @@ bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdateOnLayou
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(28, "useRuntimeShadowNodeReferenceUpdateOnLayout");
markFlagAsAccessed(29, "useRuntimeShadowNodeReferenceUpdateOnLayout");
flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdateOnLayout();
useRuntimeShadowNodeReferenceUpdateOnLayout_ = flagValue;
@@ -560,7 +578,7 @@ bool ReactNativeFeatureFlagsAccessor::useStateAlignmentMechanism() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(29, "useStateAlignmentMechanism");
markFlagAsAccessed(30, "useStateAlignmentMechanism");
flagValue = currentProvider_->useStateAlignmentMechanism();
useStateAlignmentMechanism_ = flagValue;
@@ -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<<4a5a507ce51e3058803ce2237f482dc4>>
* @generated SignedSource<<6c2bca1240818fc2c13b76943f9954d7>>
*/
/**
@@ -35,6 +35,7 @@ class ReactNativeFeatureFlagsAccessor {
bool allowCollapsableChildren();
bool allowRecursiveCommitsWithSynchronousMountOnAndroid();
bool batchRenderingUpdatesInEventLoop();
bool changeOrderOfMountingInstructionsOnAndroid();
bool destroyFabricSurfacesInReactInstanceManager();
bool enableAlignItemsBaselineOnFabricIOS();
bool enableCleanTextInputYogaNode();
@@ -71,12 +72,13 @@ class ReactNativeFeatureFlagsAccessor {
std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
bool wasOverridden_;
std::array<std::atomic<const char*>, 30> accessedFeatureFlags_;
std::array<std::atomic<const char*>, 31> accessedFeatureFlags_;
std::atomic<std::optional<bool>> commonTestFlag_;
std::atomic<std::optional<bool>> allowCollapsableChildren_;
std::atomic<std::optional<bool>> allowRecursiveCommitsWithSynchronousMountOnAndroid_;
std::atomic<std::optional<bool>> batchRenderingUpdatesInEventLoop_;
std::atomic<std::optional<bool>> changeOrderOfMountingInstructionsOnAndroid_;
std::atomic<std::optional<bool>> destroyFabricSurfacesInReactInstanceManager_;
std::atomic<std::optional<bool>> enableAlignItemsBaselineOnFabricIOS_;
std::atomic<std::optional<bool>> enableCleanTextInputYogaNode_;
@@ -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<<4eb00950b76e497061d735f7cff04c05>>
* @generated SignedSource<<d375536eb37dcdadbaacd2e6612a8598>>
*/
/**
@@ -43,6 +43,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
return false;
}
bool changeOrderOfMountingInstructionsOnAndroid() override {
return false;
}
bool destroyFabricSurfacesInReactInstanceManager() override {
return false;
}
@@ -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<<62aabd2b094847e3165f0127720cd38e>>
* @generated SignedSource<<b44437e700a8290b8376ba3ba438b219>>
*/
/**
@@ -29,6 +29,7 @@ class ReactNativeFeatureFlagsProvider {
virtual bool allowCollapsableChildren() = 0;
virtual bool allowRecursiveCommitsWithSynchronousMountOnAndroid() = 0;
virtual bool batchRenderingUpdatesInEventLoop() = 0;
virtual bool changeOrderOfMountingInstructionsOnAndroid() = 0;
virtual bool destroyFabricSurfacesInReactInstanceManager() = 0;
virtual bool enableAlignItemsBaselineOnFabricIOS() = 0;
virtual bool enableCleanTextInputYogaNode() = 0;
@@ -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<<ecad8843c7f756d7efd5100d1a111b94>>
* @generated SignedSource<<8458b6146882bfab11157e94eaaf9967>>
*/
/**
@@ -57,6 +57,11 @@ bool NativeReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop(
return ReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop();
}
bool NativeReactNativeFeatureFlags::changeOrderOfMountingInstructionsOnAndroid(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::changeOrderOfMountingInstructionsOnAndroid();
}
bool NativeReactNativeFeatureFlags::destroyFabricSurfacesInReactInstanceManager(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::destroyFabricSurfacesInReactInstanceManager();
@@ -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<<8710006663b0aff28f447405b26562dd>>
* @generated SignedSource<<aba10d883579d14504ffed720e44cb2a>>
*/
/**
@@ -43,6 +43,8 @@ class NativeReactNativeFeatureFlags
bool batchRenderingUpdatesInEventLoop(jsi::Runtime& runtime);
bool changeOrderOfMountingInstructionsOnAndroid(jsi::Runtime& runtime);
bool destroyFabricSurfacesInReactInstanceManager(jsi::Runtime& runtime);
bool enableAlignItemsBaselineOnFabricIOS(jsi::Runtime& runtime);
@@ -54,6 +54,11 @@ const definitions: FeatureFlagDefinitions = {
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.',
},
changeOrderOfMountingInstructionsOnAndroid: {
defaultValue: false,
description:
'When enabled, insert of views on Android will be moved from the beginning of the IntBufferBatchMountItem to be after layout updates.',
},
destroyFabricSurfacesInReactInstanceManager: {
defaultValue: false,
description:
@@ -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<<55c6569e1732443a2ad13c9b5f158462>>
* @generated SignedSource<<443034310c104784714bb59761335f77>>
* @flow strict-local
*/
@@ -47,6 +47,7 @@ export type ReactNativeFeatureFlags = {
allowCollapsableChildren: Getter<boolean>,
allowRecursiveCommitsWithSynchronousMountOnAndroid: Getter<boolean>,
batchRenderingUpdatesInEventLoop: Getter<boolean>,
changeOrderOfMountingInstructionsOnAndroid: Getter<boolean>,
destroyFabricSurfacesInReactInstanceManager: Getter<boolean>,
enableAlignItemsBaselineOnFabricIOS: Getter<boolean>,
enableCleanTextInputYogaNode: Getter<boolean>,
@@ -146,6 +147,10 @@ export const allowRecursiveCommitsWithSynchronousMountOnAndroid: Getter<boolean>
* 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);
/**
* When enabled, insert of views on Android will be moved from the beginning of the IntBufferBatchMountItem to be after layout updates.
*/
export const changeOrderOfMountingInstructionsOnAndroid: Getter<boolean> = createNativeFlagGetter('changeOrderOfMountingInstructionsOnAndroid', false);
/**
* When enabled, ReactInstanceManager will clean up Fabric surfaces on destroy().
*/
@@ -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<<c1eb7ad33e38430f654dd69003cf5961>>
* @generated SignedSource<<19718453dfde482545a2313ca74a96ce>>
* @flow strict-local
*/
@@ -27,6 +27,7 @@ export interface Spec extends TurboModule {
+allowCollapsableChildren?: () => boolean;
+allowRecursiveCommitsWithSynchronousMountOnAndroid?: () => boolean;
+batchRenderingUpdatesInEventLoop?: () => boolean;
+changeOrderOfMountingInstructionsOnAndroid?: () => boolean;
+destroyFabricSurfacesInReactInstanceManager?: () => boolean;
+enableAlignItemsBaselineOnFabricIOS?: () => boolean;
+enableCleanTextInputYogaNode?: () => boolean;