Skip to content

Commit 5b50ea0

Browse files
Bartlomiej Bloniarzmeta-codesync[bot]
authored andcommitted
Add enableMountingCoordinatorPullModelAndroid feature flag
Summary: Adds the `enableMountingCoordinatorPullModelAndroid` experiment flag (default off) that gates the Android pull-model mounting migration. Config entry plus regenerated accessors only — no behavior change. ## Changelog: [Android] [Added] - Add `enableMountingCoordinatorPullModelAndroid` feature flag Differential Revision: D112309049
1 parent 1cdf784 commit 5b50ea0

20 files changed

Lines changed: 187 additions & 70 deletions

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<df3f81d0083a8ebe9d0fbcb86e652405>>
7+
* @generated SignedSource<<8508c768e49199737ce5fd1071ca1d68>>
88
*/
99

1010
/**
@@ -252,6 +252,12 @@ public object ReactNativeFeatureFlags {
252252
@JvmStatic
253253
public fun enableModuleArgumentNSNullConversionIOS(): Boolean = accessor.enableModuleArgumentNSNullConversionIOS()
254254

255+
/**
256+
* When enabled, Android mounts transactions with the pull model (like iOS): the commit thread no longer pulls and builds the mount batch in schedulerShouldRenderTransactions. Instead the UI thread pulls the transaction itself via a PullTransactionMountItem enqueued in the MountItemDispatcher, builds the IntBufferBatchMountItem, and applies it synchronously. Implies rawProps accumulation (enableAccumulatedUpdatesInRawPropsAndroid behavior).
257+
*/
258+
@JvmStatic
259+
public fun enableMountingCoordinatorPullModelAndroid(): Boolean = accessor.enableMountingCoordinatorPullModelAndroid()
260+
255261
/**
256262
* Enables the MutationObserver Web API in React Native.
257263
*/

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<c31110405f1c9cd5ae0627fb114585a6>>
7+
* @generated SignedSource<<eeb2c4625ae5039dc087f364713050fe>>
88
*/
99

1010
/**
@@ -57,6 +57,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
5757
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
5858
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
5959
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
60+
private var enableMountingCoordinatorPullModelAndroidCache: Boolean? = null
6061
private var enableMutationObserverByDefaultCache: Boolean? = null
6162
private var enableNativeCSSParsingCache: Boolean? = null
6263
private var enableNetworkEventReportingCache: Boolean? = null
@@ -441,6 +442,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
441442
return cached
442443
}
443444

445+
override fun enableMountingCoordinatorPullModelAndroid(): Boolean {
446+
var cached = enableMountingCoordinatorPullModelAndroidCache
447+
if (cached == null) {
448+
cached = ReactNativeFeatureFlagsCxxInterop.enableMountingCoordinatorPullModelAndroid()
449+
enableMountingCoordinatorPullModelAndroidCache = cached
450+
}
451+
return cached
452+
}
453+
444454
override fun enableMutationObserverByDefault(): Boolean {
445455
var cached = enableMutationObserverByDefaultCache
446456
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<87b76f5c2af82462dc66c7721cd66ac4>>
7+
* @generated SignedSource<<9a171a03d15885e64b84f03442b304b4>>
88
*/
99

1010
/**
@@ -102,6 +102,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
102102

103103
@DoNotStrip @JvmStatic public external fun enableModuleArgumentNSNullConversionIOS(): Boolean
104104

105+
@DoNotStrip @JvmStatic public external fun enableMountingCoordinatorPullModelAndroid(): Boolean
106+
105107
@DoNotStrip @JvmStatic public external fun enableMutationObserverByDefault(): Boolean
106108

107109
@DoNotStrip @JvmStatic public external fun enableNativeCSSParsing(): Boolean

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<8a117541421f413e517e1be1acf8be7d>>
7+
* @generated SignedSource<<4fd762a8e3ab6de1276a15368075f40c>>
88
*/
99

1010
/**
@@ -97,6 +97,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
9797

9898
override fun enableModuleArgumentNSNullConversionIOS(): Boolean = false
9999

100+
override fun enableMountingCoordinatorPullModelAndroid(): Boolean = false
101+
100102
override fun enableMutationObserverByDefault(): Boolean = false
101103

102104
override fun enableNativeCSSParsing(): Boolean = false

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<9a2806b3934d130010954a92a7b48e0f>>
7+
* @generated SignedSource<<4a4a234004196595b5fb2949bd91f9c4>>
88
*/
99

1010
/**
@@ -61,6 +61,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
6161
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
6262
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
6363
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
64+
private var enableMountingCoordinatorPullModelAndroidCache: Boolean? = null
6465
private var enableMutationObserverByDefaultCache: Boolean? = null
6566
private var enableNativeCSSParsingCache: Boolean? = null
6667
private var enableNetworkEventReportingCache: Boolean? = null
@@ -482,6 +483,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
482483
return cached
483484
}
484485

486+
override fun enableMountingCoordinatorPullModelAndroid(): Boolean {
487+
var cached = enableMountingCoordinatorPullModelAndroidCache
488+
if (cached == null) {
489+
cached = currentProvider.enableMountingCoordinatorPullModelAndroid()
490+
accessedFeatureFlags.add("enableMountingCoordinatorPullModelAndroid")
491+
enableMountingCoordinatorPullModelAndroidCache = cached
492+
}
493+
return cached
494+
}
495+
485496
override fun enableMutationObserverByDefault(): Boolean {
486497
var cached = enableMutationObserverByDefaultCache
487498
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<49c76b8072c1bd29135086c9e0a5da2f>>
7+
* @generated SignedSource<<0b4bf7de06ad677b0868640c98ff0aa9>>
88
*/
99

1010
/**
@@ -97,6 +97,8 @@ public interface ReactNativeFeatureFlagsProvider {
9797

9898
@DoNotStrip public fun enableModuleArgumentNSNullConversionIOS(): Boolean
9999

100+
@DoNotStrip public fun enableMountingCoordinatorPullModelAndroid(): Boolean
101+
100102
@DoNotStrip public fun enableMutationObserverByDefault(): Boolean
101103

102104
@DoNotStrip public fun enableNativeCSSParsing(): Boolean

packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<42f1901c8b7cb568cc761a791991a333>>
7+
* @generated SignedSource<<a795068a8d53ac4385bf77461792fd70>>
88
*/
99

1010
/**
@@ -261,6 +261,12 @@ class ReactNativeFeatureFlagsJavaProvider
261261
return method(javaProvider_);
262262
}
263263

264+
bool enableMountingCoordinatorPullModelAndroid() override {
265+
static const auto method =
266+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableMountingCoordinatorPullModelAndroid");
267+
return method(javaProvider_);
268+
}
269+
264270
bool enableMutationObserverByDefault() override {
265271
static const auto method =
266272
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableMutationObserverByDefault");
@@ -750,6 +756,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableModuleArgumentNSNullConversionIOS
750756
return ReactNativeFeatureFlags::enableModuleArgumentNSNullConversionIOS();
751757
}
752758

759+
bool JReactNativeFeatureFlagsCxxInterop::enableMountingCoordinatorPullModelAndroid(
760+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
761+
return ReactNativeFeatureFlags::enableMountingCoordinatorPullModelAndroid();
762+
}
763+
753764
bool JReactNativeFeatureFlagsCxxInterop::enableMutationObserverByDefault(
754765
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
755766
return ReactNativeFeatureFlags::enableMutationObserverByDefault();
@@ -1142,6 +1153,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
11421153
makeNativeMethod(
11431154
"enableModuleArgumentNSNullConversionIOS",
11441155
JReactNativeFeatureFlagsCxxInterop::enableModuleArgumentNSNullConversionIOS),
1156+
makeNativeMethod(
1157+
"enableMountingCoordinatorPullModelAndroid",
1158+
JReactNativeFeatureFlagsCxxInterop::enableMountingCoordinatorPullModelAndroid),
11451159
makeNativeMethod(
11461160
"enableMutationObserverByDefault",
11471161
JReactNativeFeatureFlagsCxxInterop::enableMutationObserverByDefault),

packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<9967d87b794ba46797ed78a845683dc7>>
7+
* @generated SignedSource<<5ffd2340bcfdeb6919f215f494040fb9>>
88
*/
99

1010
/**
@@ -141,6 +141,9 @@ class JReactNativeFeatureFlagsCxxInterop
141141
static bool enableModuleArgumentNSNullConversionIOS(
142142
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
143143

144+
static bool enableMountingCoordinatorPullModelAndroid(
145+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
146+
144147
static bool enableMutationObserverByDefault(
145148
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
146149

packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<6f2362e9844cab731ca01e4af563fde9>>
7+
* @generated SignedSource<<28cc44042e02c3521b40c6c2ba005888>>
88
*/
99

1010
/**
@@ -174,6 +174,10 @@ bool ReactNativeFeatureFlags::enableModuleArgumentNSNullConversionIOS() {
174174
return getAccessor().enableModuleArgumentNSNullConversionIOS();
175175
}
176176

177+
bool ReactNativeFeatureFlags::enableMountingCoordinatorPullModelAndroid() {
178+
return getAccessor().enableMountingCoordinatorPullModelAndroid();
179+
}
180+
177181
bool ReactNativeFeatureFlags::enableMutationObserverByDefault() {
178182
return getAccessor().enableMutationObserverByDefault();
179183
}

packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<f871b2203c86dd7f25640cd3a6ea7d00>>
7+
* @generated SignedSource<<66d7e8a85d0925fc03660ac22f2fb500>>
88
*/
99

1010
/**
@@ -224,6 +224,11 @@ class ReactNativeFeatureFlags {
224224
*/
225225
RN_EXPORT static bool enableModuleArgumentNSNullConversionIOS();
226226

227+
/**
228+
* When enabled, Android mounts transactions with the pull model (like iOS): the commit thread no longer pulls and builds the mount batch in schedulerShouldRenderTransactions. Instead the UI thread pulls the transaction itself via a PullTransactionMountItem enqueued in the MountItemDispatcher, builds the IntBufferBatchMountItem, and applies it synchronously. Implies rawProps accumulation (enableAccumulatedUpdatesInRawPropsAndroid behavior).
229+
*/
230+
RN_EXPORT static bool enableMountingCoordinatorPullModelAndroid();
231+
227232
/**
228233
* Enables the MutationObserver Web API in React Native.
229234
*/

0 commit comments

Comments
 (0)