Skip to content

Commit 929de72

Browse files
RSNarafacebook-github-bot
authored andcommitted
Introduce featureflag for main queue coordinator
Summary: Gating for "main queue coordinator": D74769326 Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D74940621
1 parent 6a008aa commit 929de72

20 files changed

+165
-48
lines changed

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

1010
/**
@@ -168,6 +168,12 @@ public object ReactNativeFeatureFlags {
168168
@JvmStatic
169169
public fun enableLayoutAnimationsOnIOS(): Boolean = accessor.enableLayoutAnimationsOnIOS()
170170

171+
/**
172+
* Make RCTUnsafeExecuteOnMainQueueSync less likely to deadlock, when used in conjuction with sync rendering/events.
173+
*/
174+
@JvmStatic
175+
public fun enableMainQueueCoordinatorOnIOS(): Boolean = accessor.enableMainQueueCoordinatorOnIOS()
176+
171177
/**
172178
* Makes modules requiring main queue setup initialize on the main thread, during React Native init.
173179
*/

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<<4665e190f626b377f37e14c1c19f809d>>
7+
* @generated SignedSource<<62a722030e9166b231e5368f193f6f0c>>
88
*/
99

1010
/**
@@ -43,6 +43,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
4343
private var enableIntersectionObserverEventLoopIntegrationCache: Boolean? = null
4444
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
4545
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
46+
private var enableMainQueueCoordinatorOnIOSCache: Boolean? = null
4647
private var enableMainQueueModulesOnIOSCache: Boolean? = null
4748
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
4849
private var enableNativeCSSParsingCache: Boolean? = null
@@ -279,6 +280,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
279280
return cached
280281
}
281282

283+
override fun enableMainQueueCoordinatorOnIOS(): Boolean {
284+
var cached = enableMainQueueCoordinatorOnIOSCache
285+
if (cached == null) {
286+
cached = ReactNativeFeatureFlagsCxxInterop.enableMainQueueCoordinatorOnIOS()
287+
enableMainQueueCoordinatorOnIOSCache = cached
288+
}
289+
return cached
290+
}
291+
282292
override fun enableMainQueueModulesOnIOS(): Boolean {
283293
var cached = enableMainQueueModulesOnIOSCache
284294
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<<b68166d039f6214ff09dc30a742ebbf9>>
7+
* @generated SignedSource<<39d78493b17f7abfb4220d25e663ae55>>
88
*/
99

1010
/**
@@ -74,6 +74,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
7474

7575
@DoNotStrip @JvmStatic public external fun enableLayoutAnimationsOnIOS(): Boolean
7676

77+
@DoNotStrip @JvmStatic public external fun enableMainQueueCoordinatorOnIOS(): Boolean
78+
7779
@DoNotStrip @JvmStatic public external fun enableMainQueueModulesOnIOS(): Boolean
7880

7981
@DoNotStrip @JvmStatic public external fun enableModuleArgumentNSNullConversionIOS(): 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<<fcee66a9800d5b3b1105df73d33feea9>>
7+
* @generated SignedSource<<9456729fc1d8268a3edf0e6f9c9cec7a>>
88
*/
99

1010
/**
@@ -69,6 +69,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
6969

7070
override fun enableLayoutAnimationsOnIOS(): Boolean = true
7171

72+
override fun enableMainQueueCoordinatorOnIOS(): Boolean = false
73+
7274
override fun enableMainQueueModulesOnIOS(): Boolean = false
7375

7476
override fun enableModuleArgumentNSNullConversionIOS(): 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<<ebf6d5811f40eedd906c015283f5757f>>
7+
* @generated SignedSource<<b755121b5c8048c7733825ceff2a4773>>
88
*/
99

1010
/**
@@ -47,6 +47,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
4747
private var enableIntersectionObserverEventLoopIntegrationCache: Boolean? = null
4848
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
4949
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
50+
private var enableMainQueueCoordinatorOnIOSCache: Boolean? = null
5051
private var enableMainQueueModulesOnIOSCache: Boolean? = null
5152
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
5253
private var enableNativeCSSParsingCache: Boolean? = null
@@ -306,6 +307,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
306307
return cached
307308
}
308309

310+
override fun enableMainQueueCoordinatorOnIOS(): Boolean {
311+
var cached = enableMainQueueCoordinatorOnIOSCache
312+
if (cached == null) {
313+
cached = currentProvider.enableMainQueueCoordinatorOnIOS()
314+
accessedFeatureFlags.add("enableMainQueueCoordinatorOnIOS")
315+
enableMainQueueCoordinatorOnIOSCache = cached
316+
}
317+
return cached
318+
}
319+
309320
override fun enableMainQueueModulesOnIOS(): Boolean {
310321
var cached = enableMainQueueModulesOnIOSCache
311322
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<<1e5562ce20c0735c926c1cb029b93e18>>
7+
* @generated SignedSource<<25acda9d60691c0ca5ea4776bfae594a>>
88
*/
99

1010
/**
@@ -69,6 +69,8 @@ public interface ReactNativeFeatureFlagsProvider {
6969

7070
@DoNotStrip public fun enableLayoutAnimationsOnIOS(): Boolean
7171

72+
@DoNotStrip public fun enableMainQueueCoordinatorOnIOS(): Boolean
73+
7274
@DoNotStrip public fun enableMainQueueModulesOnIOS(): Boolean
7375

7476
@DoNotStrip public fun enableModuleArgumentNSNullConversionIOS(): 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<<078954ede626079b7d36ab63cdbab761>>
7+
* @generated SignedSource<<ddb0b0066cae098c56aa827e5ac3072c>>
88
*/
99

1010
/**
@@ -177,6 +177,12 @@ class ReactNativeFeatureFlagsJavaProvider
177177
return method(javaProvider_);
178178
}
179179

180+
bool enableMainQueueCoordinatorOnIOS() override {
181+
static const auto method =
182+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableMainQueueCoordinatorOnIOS");
183+
return method(javaProvider_);
184+
}
185+
180186
bool enableMainQueueModulesOnIOS() override {
181187
static const auto method =
182188
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableMainQueueModulesOnIOS");
@@ -464,6 +470,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnIOS(
464470
return ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS();
465471
}
466472

473+
bool JReactNativeFeatureFlagsCxxInterop::enableMainQueueCoordinatorOnIOS(
474+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
475+
return ReactNativeFeatureFlags::enableMainQueueCoordinatorOnIOS();
476+
}
477+
467478
bool JReactNativeFeatureFlagsCxxInterop::enableMainQueueModulesOnIOS(
468479
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
469480
return ReactNativeFeatureFlags::enableMainQueueModulesOnIOS();
@@ -704,6 +715,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
704715
makeNativeMethod(
705716
"enableLayoutAnimationsOnIOS",
706717
JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnIOS),
718+
makeNativeMethod(
719+
"enableMainQueueCoordinatorOnIOS",
720+
JReactNativeFeatureFlagsCxxInterop::enableMainQueueCoordinatorOnIOS),
707721
makeNativeMethod(
708722
"enableMainQueueModulesOnIOS",
709723
JReactNativeFeatureFlagsCxxInterop::enableMainQueueModulesOnIOS),

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<<083e45ab99622254be46213ba07c586b>>
7+
* @generated SignedSource<<3a00be0b706f3513e1aca741c55a0747>>
88
*/
99

1010
/**
@@ -99,6 +99,9 @@ class JReactNativeFeatureFlagsCxxInterop
9999
static bool enableLayoutAnimationsOnIOS(
100100
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
101101

102+
static bool enableMainQueueCoordinatorOnIOS(
103+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
104+
102105
static bool enableMainQueueModulesOnIOS(
103106
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
104107

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<<c099ce4bba5f6d14a83ad69a0fb3cbbf>>
7+
* @generated SignedSource<<05405c3bb41e2511ac66792eb641db5e>>
88
*/
99

1010
/**
@@ -118,6 +118,10 @@ bool ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS() {
118118
return getAccessor().enableLayoutAnimationsOnIOS();
119119
}
120120

121+
bool ReactNativeFeatureFlags::enableMainQueueCoordinatorOnIOS() {
122+
return getAccessor().enableMainQueueCoordinatorOnIOS();
123+
}
124+
121125
bool ReactNativeFeatureFlags::enableMainQueueModulesOnIOS() {
122126
return getAccessor().enableMainQueueModulesOnIOS();
123127
}

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

1010
/**
@@ -154,6 +154,11 @@ class ReactNativeFeatureFlags {
154154
*/
155155
RN_EXPORT static bool enableLayoutAnimationsOnIOS();
156156

157+
/**
158+
* Make RCTUnsafeExecuteOnMainQueueSync less likely to deadlock, when used in conjuction with sync rendering/events.
159+
*/
160+
RN_EXPORT static bool enableMainQueueCoordinatorOnIOS();
161+
157162
/**
158163
* Makes modules requiring main queue setup initialize on the main thread, during React Native init.
159164
*/

0 commit comments

Comments
 (0)