Skip to content

Commit 539f237

Browse files
Nick Lefeverfacebook-github-bot
authored andcommitted
Add feature flag for RSNRU on commit (#50745)
Summary: Pull Request resolved: #50745 See title Changelog: [Internal] Reviewed By: fabriziocucci Differential Revision: D73038437 fbshipit-source-id: e304f3521799c893a51ee8da8e85f45352a8d873
1 parent 4fa57f9 commit 539f237

20 files changed

Lines changed: 145 additions & 28 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<<82fac57322d589b28e7fca321f82d5e6>>
7+
* @generated SignedSource<<745904568803a9ead98bc10210b38938>>
88
*/
99

1010
/**
@@ -222,6 +222,12 @@ public object ReactNativeFeatureFlags {
222222
@JvmStatic
223223
public fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean = accessor.traceTurboModulePromiseRejectionsOnAndroid()
224224

225+
/**
226+
* When enabled, runtime shadow node references will be updated during the commit. This allows running RSNRU from any thread without corrupting the renderer state.
227+
*/
228+
@JvmStatic
229+
public fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean = accessor.updateRuntimeShadowNodeReferencesOnCommit()
230+
225231
/**
226232
* In Bridgeless mode, use the always available javascript error reporting pipeline.
227233
*/

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<<112e542686afa5657898a450543ec5a9>>
7+
* @generated SignedSource<<4f9df3bdf8c353ccbdfeea0f0d378e01>>
88
*/
99

1010
/**
@@ -52,6 +52,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
5252
private var fuseboxNetworkInspectionEnabledCache: Boolean? = null
5353
private var removeTurboModuleManagerDelegateMutexCache: Boolean? = null
5454
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
55+
private var updateRuntimeShadowNodeReferencesOnCommitCache: Boolean? = null
5556
private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null
5657
private var useEditTextStockAndroidFocusBehaviorCache: Boolean? = null
5758
private var useFabricInteropCache: Boolean? = null
@@ -349,6 +350,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
349350
return cached
350351
}
351352

353+
override fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean {
354+
var cached = updateRuntimeShadowNodeReferencesOnCommitCache
355+
if (cached == null) {
356+
cached = ReactNativeFeatureFlagsCxxInterop.updateRuntimeShadowNodeReferencesOnCommit()
357+
updateRuntimeShadowNodeReferencesOnCommitCache = cached
358+
}
359+
return cached
360+
}
361+
352362
override fun useAlwaysAvailableJSErrorHandling(): Boolean {
353363
var cached = useAlwaysAvailableJSErrorHandlingCache
354364
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<<c549aa8b596fc89c01403646b846a59d>>
7+
* @generated SignedSource<<8200512b24c8ddd99e582b24e858f1f8>>
88
*/
99

1010
/**
@@ -92,6 +92,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
9292

9393
@DoNotStrip @JvmStatic public external fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean
9494

95+
@DoNotStrip @JvmStatic public external fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean
96+
9597
@DoNotStrip @JvmStatic public external fun useAlwaysAvailableJSErrorHandling(): Boolean
9698

9799
@DoNotStrip @JvmStatic public external fun useEditTextStockAndroidFocusBehavior(): 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<<1c38f54724a573b954fd8aee1e41e73a>>
7+
* @generated SignedSource<<92ac1a25b3c5eb4e43334e0c65e5255f>>
88
*/
99

1010
/**
@@ -87,6 +87,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
8787

8888
override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean = false
8989

90+
override fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean = false
91+
9092
override fun useAlwaysAvailableJSErrorHandling(): Boolean = false
9193

9294
override fun useEditTextStockAndroidFocusBehavior(): Boolean = true

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<<a6659ebfbc50d35953af83010c6d84c6>>
7+
* @generated SignedSource<<c7d8c0c6ff5a50925692cca2de48c537>>
88
*/
99

1010
/**
@@ -56,6 +56,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
5656
private var fuseboxNetworkInspectionEnabledCache: Boolean? = null
5757
private var removeTurboModuleManagerDelegateMutexCache: Boolean? = null
5858
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
59+
private var updateRuntimeShadowNodeReferencesOnCommitCache: Boolean? = null
5960
private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null
6061
private var useEditTextStockAndroidFocusBehaviorCache: Boolean? = null
6162
private var useFabricInteropCache: Boolean? = null
@@ -385,6 +386,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
385386
return cached
386387
}
387388

389+
override fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean {
390+
var cached = updateRuntimeShadowNodeReferencesOnCommitCache
391+
if (cached == null) {
392+
cached = currentProvider.updateRuntimeShadowNodeReferencesOnCommit()
393+
accessedFeatureFlags.add("updateRuntimeShadowNodeReferencesOnCommit")
394+
updateRuntimeShadowNodeReferencesOnCommitCache = cached
395+
}
396+
return cached
397+
}
398+
388399
override fun useAlwaysAvailableJSErrorHandling(): Boolean {
389400
var cached = useAlwaysAvailableJSErrorHandlingCache
390401
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<<e18e064f0b4ac0217b49f0cf5a153e6b>>
7+
* @generated SignedSource<<54e0deb6c78833a3f0394d4ff2ab9562>>
88
*/
99

1010
/**
@@ -87,6 +87,8 @@ public interface ReactNativeFeatureFlagsProvider {
8787

8888
@DoNotStrip public fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean
8989

90+
@DoNotStrip public fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean
91+
9092
@DoNotStrip public fun useAlwaysAvailableJSErrorHandling(): Boolean
9193

9294
@DoNotStrip public fun useEditTextStockAndroidFocusBehavior(): 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<<a667abf47a0d469bc3a3be1e3fed5966>>
7+
* @generated SignedSource<<d944ced839aa053484befb1496749b9e>>
88
*/
99

1010
/**
@@ -231,6 +231,12 @@ class ReactNativeFeatureFlagsJavaProvider
231231
return method(javaProvider_);
232232
}
233233

234+
bool updateRuntimeShadowNodeReferencesOnCommit() override {
235+
static const auto method =
236+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("updateRuntimeShadowNodeReferencesOnCommit");
237+
return method(javaProvider_);
238+
}
239+
234240
bool useAlwaysAvailableJSErrorHandling() override {
235241
static const auto method =
236242
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("useAlwaysAvailableJSErrorHandling");
@@ -443,6 +449,11 @@ bool JReactNativeFeatureFlagsCxxInterop::traceTurboModulePromiseRejectionsOnAndr
443449
return ReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid();
444450
}
445451

452+
bool JReactNativeFeatureFlagsCxxInterop::updateRuntimeShadowNodeReferencesOnCommit(
453+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
454+
return ReactNativeFeatureFlags::updateRuntimeShadowNodeReferencesOnCommit();
455+
}
456+
446457
bool JReactNativeFeatureFlagsCxxInterop::useAlwaysAvailableJSErrorHandling(
447458
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
448459
return ReactNativeFeatureFlags::useAlwaysAvailableJSErrorHandling();
@@ -610,6 +621,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
610621
makeNativeMethod(
611622
"traceTurboModulePromiseRejectionsOnAndroid",
612623
JReactNativeFeatureFlagsCxxInterop::traceTurboModulePromiseRejectionsOnAndroid),
624+
makeNativeMethod(
625+
"updateRuntimeShadowNodeReferencesOnCommit",
626+
JReactNativeFeatureFlagsCxxInterop::updateRuntimeShadowNodeReferencesOnCommit),
613627
makeNativeMethod(
614628
"useAlwaysAvailableJSErrorHandling",
615629
JReactNativeFeatureFlagsCxxInterop::useAlwaysAvailableJSErrorHandling),

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<<591f49d5a0b5368ecceb5ab054f4c0a5>>
7+
* @generated SignedSource<<c122826c2dd42cfb66e96e1af5c7a54a>>
88
*/
99

1010
/**
@@ -126,6 +126,9 @@ class JReactNativeFeatureFlagsCxxInterop
126126
static bool traceTurboModulePromiseRejectionsOnAndroid(
127127
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
128128

129+
static bool updateRuntimeShadowNodeReferencesOnCommit(
130+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
131+
129132
static bool useAlwaysAvailableJSErrorHandling(
130133
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
131134

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<<543d5f445f026f68976b1d4f8402f12e>>
7+
* @generated SignedSource<<f98498698a19d59cc4113bf6bbc0b2ea>>
88
*/
99

1010
/**
@@ -154,6 +154,10 @@ bool ReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid() {
154154
return getAccessor().traceTurboModulePromiseRejectionsOnAndroid();
155155
}
156156

157+
bool ReactNativeFeatureFlags::updateRuntimeShadowNodeReferencesOnCommit() {
158+
return getAccessor().updateRuntimeShadowNodeReferencesOnCommit();
159+
}
160+
157161
bool ReactNativeFeatureFlags::useAlwaysAvailableJSErrorHandling() {
158162
return getAccessor().useAlwaysAvailableJSErrorHandling();
159163
}

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<<a14062b719f668080a6c64dd34d63c2d>>
7+
* @generated SignedSource<<aa1cc3b66b13bf529e06239c018ad515>>
88
*/
99

1010
/**
@@ -199,6 +199,11 @@ class ReactNativeFeatureFlags {
199199
*/
200200
RN_EXPORT static bool traceTurboModulePromiseRejectionsOnAndroid();
201201

202+
/**
203+
* When enabled, runtime shadow node references will be updated during the commit. This allows running RSNRU from any thread without corrupting the renderer state.
204+
*/
205+
RN_EXPORT static bool updateRuntimeShadowNodeReferencesOnCommit();
206+
202207
/**
203208
* In Bridgeless mode, use the always available javascript error reporting pipeline.
204209
*/

0 commit comments

Comments
 (0)