Skip to content

Commit eaf7704

Browse files
javachemeta-codesync[bot]
authored andcommitted
Remove enableMainQueueCoordinatorOnIOS, make coordinator always-on (facebook#56935)
Summary: Pull Request resolved: facebook#56935 The `enableMainQueueCoordinatorOnIOS` flag has finished rollout. Drop it from the feature-flag config, regenerate the per-language accessors, and inline the previously-gated paths: - `RCTUtils.mm`: `RCTUnsafeExecuteOnMainQueueSync` and the `RCTUnsafeExecuteOnMainQueueOnceSync` helper always use `unsafeExecuteOnMainThreadSync` on iOS (the TV fallback to `dispatch_sync(main, ...)` stays). - `RuntimeExecutorSyncUIThreadUtils.mm`: `executeSynchronouslyOnSameThread_CAN_DEADLOCK` switches between two paths based on the calling thread instead of the feature flag. Main-thread callers (production) take the coordinator path that pumps UI tasks while waiting for JS; off-main callers (e.g. RuntimeScheduler unit tests) take a simpler path that just waits for the runtime and runs `runtimeWork` synchronously on the calling thread. Trimmed the `runtimeCaptureBlockDone` plumbing that an old TODO already flagged as unnecessary. Also drops the iOS override in the Wilde plugin, the now-dead `rn_fling.enable_main_queue_coordinator_on_ios` MobileConfig param, and the `flagOff` variant of the characterization test (the on-path test still pins the contract). Changelog: [iOS][Changed] - `RCTUnsafeExecuteOnMainQueueSync` and bridgeless sync runtime-thread calls now always use the coordinator implementation that pumps UI tasks while waiting for JS, eliminating a class of deadlocks. The previous opt-in flag has been removed. Reviewed By: sammy-SC Differential Revision: D105984547 fbshipit-source-id: 1eee1b6e5875b108e145fdd295dd3951ba1d839b
1 parent f14207f commit eaf7704

24 files changed

Lines changed: 104 additions & 304 deletions

packages/react-native/React/Base/RCTUtils.mm

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#import <mach/mach_time.h>
1212
#import <objc/message.h>
1313
#import <objc/runtime.h>
14-
#import <react/featureflags/ReactNativeFeatureFlags.h>
1514
#import <zlib.h>
1615

1716
#import <UIKit/UIKit.h>
@@ -312,15 +311,12 @@ void RCTUnsafeExecuteOnMainQueueSync(dispatch_block_t block)
312311
}
313312

314313
#if !TARGET_OS_TV
315-
if (ReactNativeFeatureFlags::enableMainQueueCoordinatorOnIOS()) {
316-
unsafeExecuteOnMainThreadSync(block);
317-
return;
318-
}
319-
#endif
320-
314+
unsafeExecuteOnMainThreadSync(block);
315+
#else
321316
dispatch_sync(dispatch_get_main_queue(), ^{
322317
block();
323318
});
319+
#endif
324320
}
325321

326322
static void RCTUnsafeExecuteOnMainQueueOnceSync(dispatch_once_t *onceToken, dispatch_block_t block)
@@ -342,13 +338,10 @@ static void RCTUnsafeExecuteOnMainQueueOnceSync(dispatch_once_t *onceToken, disp
342338
}
343339

344340
#if !TARGET_OS_TV
345-
if (ReactNativeFeatureFlags::enableMainQueueCoordinatorOnIOS()) {
346-
unsafeExecuteOnMainThreadSync(block);
347-
return;
348-
}
349-
#endif
350-
341+
unsafeExecuteOnMainThreadSync(block);
342+
#else
351343
dispatch_sync(dispatch_get_main_queue(), executeOnce);
344+
#endif
352345
}
353346

354347
CGFloat RCTScreenScale(void)

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

Lines changed: 1 addition & 7 deletions
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<<fa3d35be13801d5991e6bfb2cef2ef43>>
7+
* @generated SignedSource<<86c797c19cc585b74714ca3aa75bbd6d>>
88
*/
99

1010
/**
@@ -240,12 +240,6 @@ public object ReactNativeFeatureFlags {
240240
@JvmStatic
241241
public fun enableLayoutAnimationsOnIOS(): Boolean = accessor.enableLayoutAnimationsOnIOS()
242242

243-
/**
244-
* Make RCTUnsafeExecuteOnMainQueueSync less likely to deadlock, when used in conjuction with sync rendering/events.
245-
*/
246-
@JvmStatic
247-
public fun enableMainQueueCoordinatorOnIOS(): Boolean = accessor.enableMainQueueCoordinatorOnIOS()
248-
249243
/**
250244
* Enable NSNull conversion when handling module arguments on iOS
251245
*/

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

Lines changed: 1 addition & 11 deletions
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<<c8e71de4517634933754c6e7a6e8ac92>>
7+
* @generated SignedSource<<d71556cf1226fe6a41dd388568153d3a>>
88
*/
99

1010
/**
@@ -55,7 +55,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
5555
private var enableKeyEventsCache: Boolean? = null
5656
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
5757
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
58-
private var enableMainQueueCoordinatorOnIOSCache: Boolean? = null
5958
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
6059
private var enableMutationObserverByDefaultCache: Boolean? = null
6160
private var enableNativeCSSParsingCache: Boolean? = null
@@ -424,15 +423,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
424423
return cached
425424
}
426425

427-
override fun enableMainQueueCoordinatorOnIOS(): Boolean {
428-
var cached = enableMainQueueCoordinatorOnIOSCache
429-
if (cached == null) {
430-
cached = ReactNativeFeatureFlagsCxxInterop.enableMainQueueCoordinatorOnIOS()
431-
enableMainQueueCoordinatorOnIOSCache = cached
432-
}
433-
return cached
434-
}
435-
436426
override fun enableModuleArgumentNSNullConversionIOS(): Boolean {
437427
var cached = enableModuleArgumentNSNullConversionIOSCache
438428
if (cached == null) {

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

Lines changed: 1 addition & 3 deletions
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<<9d3495c774e4367973974a4f83ea7d16>>
7+
* @generated SignedSource<<2ee82b1e1dcae3ea10dbd92549d65a6c>>
88
*/
99

1010
/**
@@ -98,8 +98,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
9898

9999
@DoNotStrip @JvmStatic public external fun enableLayoutAnimationsOnIOS(): Boolean
100100

101-
@DoNotStrip @JvmStatic public external fun enableMainQueueCoordinatorOnIOS(): Boolean
102-
103101
@DoNotStrip @JvmStatic public external fun enableModuleArgumentNSNullConversionIOS(): Boolean
104102

105103
@DoNotStrip @JvmStatic public external fun enableMutationObserverByDefault(): Boolean

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

Lines changed: 1 addition & 3 deletions
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<<811ccbada43f15c9418e0177041c5747>>
7+
* @generated SignedSource<<738a114e73ddb940fb14efd0dff79d1b>>
88
*/
99

1010
/**
@@ -93,8 +93,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
9393

9494
override fun enableLayoutAnimationsOnIOS(): Boolean = true
9595

96-
override fun enableMainQueueCoordinatorOnIOS(): Boolean = false
97-
9896
override fun enableModuleArgumentNSNullConversionIOS(): Boolean = false
9997

10098
override fun enableMutationObserverByDefault(): Boolean = false

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

Lines changed: 1 addition & 12 deletions
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<<69c333993720f22c6db80f3aceae32cd>>
7+
* @generated SignedSource<<d5b84c7e0c58f61d891e0dd63f61b4c0>>
88
*/
99

1010
/**
@@ -59,7 +59,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
5959
private var enableKeyEventsCache: Boolean? = null
6060
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
6161
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
62-
private var enableMainQueueCoordinatorOnIOSCache: Boolean? = null
6362
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
6463
private var enableMutationObserverByDefaultCache: Boolean? = null
6564
private var enableNativeCSSParsingCache: Boolean? = null
@@ -463,16 +462,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
463462
return cached
464463
}
465464

466-
override fun enableMainQueueCoordinatorOnIOS(): Boolean {
467-
var cached = enableMainQueueCoordinatorOnIOSCache
468-
if (cached == null) {
469-
cached = currentProvider.enableMainQueueCoordinatorOnIOS()
470-
accessedFeatureFlags.add("enableMainQueueCoordinatorOnIOS")
471-
enableMainQueueCoordinatorOnIOSCache = cached
472-
}
473-
return cached
474-
}
475-
476465
override fun enableModuleArgumentNSNullConversionIOS(): Boolean {
477466
var cached = enableModuleArgumentNSNullConversionIOSCache
478467
if (cached == null) {

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

Lines changed: 1 addition & 3 deletions
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<<cb5de865c68dfd9b7b7b2d86d9fb090b>>
7+
* @generated SignedSource<<a3dbeb4eec6efecc4fc355b15a984e58>>
88
*/
99

1010
/**
@@ -93,8 +93,6 @@ public interface ReactNativeFeatureFlagsProvider {
9393

9494
@DoNotStrip public fun enableLayoutAnimationsOnIOS(): Boolean
9595

96-
@DoNotStrip public fun enableMainQueueCoordinatorOnIOS(): Boolean
97-
9896
@DoNotStrip public fun enableModuleArgumentNSNullConversionIOS(): Boolean
9997

10098
@DoNotStrip public fun enableMutationObserverByDefault(): Boolean

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

Lines changed: 1 addition & 15 deletions
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<<f667d1281347eeacfca65411acdf6dc7>>
7+
* @generated SignedSource<<99f843dd0784f9fe372f943767e2033c>>
88
*/
99

1010
/**
@@ -249,12 +249,6 @@ class ReactNativeFeatureFlagsJavaProvider
249249
return method(javaProvider_);
250250
}
251251

252-
bool enableMainQueueCoordinatorOnIOS() override {
253-
static const auto method =
254-
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableMainQueueCoordinatorOnIOS");
255-
return method(javaProvider_);
256-
}
257-
258252
bool enableModuleArgumentNSNullConversionIOS() override {
259253
static const auto method =
260254
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableModuleArgumentNSNullConversionIOS");
@@ -746,11 +740,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnIOS(
746740
return ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS();
747741
}
748742

749-
bool JReactNativeFeatureFlagsCxxInterop::enableMainQueueCoordinatorOnIOS(
750-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
751-
return ReactNativeFeatureFlags::enableMainQueueCoordinatorOnIOS();
752-
}
753-
754743
bool JReactNativeFeatureFlagsCxxInterop::enableModuleArgumentNSNullConversionIOS(
755744
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
756745
return ReactNativeFeatureFlags::enableModuleArgumentNSNullConversionIOS();
@@ -1147,9 +1136,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
11471136
makeNativeMethod(
11481137
"enableLayoutAnimationsOnIOS",
11491138
JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnIOS),
1150-
makeNativeMethod(
1151-
"enableMainQueueCoordinatorOnIOS",
1152-
JReactNativeFeatureFlagsCxxInterop::enableMainQueueCoordinatorOnIOS),
11531139
makeNativeMethod(
11541140
"enableModuleArgumentNSNullConversionIOS",
11551141
JReactNativeFeatureFlagsCxxInterop::enableModuleArgumentNSNullConversionIOS),

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

Lines changed: 1 addition & 4 deletions
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<<f2dbc5e247060946295f35a07191c213>>
7+
* @generated SignedSource<<05716b6ab8139bc31b962f9158acd6b6>>
88
*/
99

1010
/**
@@ -135,9 +135,6 @@ class JReactNativeFeatureFlagsCxxInterop
135135
static bool enableLayoutAnimationsOnIOS(
136136
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
137137

138-
static bool enableMainQueueCoordinatorOnIOS(
139-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
140-
141138
static bool enableModuleArgumentNSNullConversionIOS(
142139
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
143140

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

Lines changed: 1 addition & 5 deletions
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<<177c370caf828494ce42486af0d8c698>>
7+
* @generated SignedSource<<dda96e26972d745fa18d802035194cf0>>
88
*/
99

1010
/**
@@ -166,10 +166,6 @@ bool ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS() {
166166
return getAccessor().enableLayoutAnimationsOnIOS();
167167
}
168168

169-
bool ReactNativeFeatureFlags::enableMainQueueCoordinatorOnIOS() {
170-
return getAccessor().enableMainQueueCoordinatorOnIOS();
171-
}
172-
173169
bool ReactNativeFeatureFlags::enableModuleArgumentNSNullConversionIOS() {
174170
return getAccessor().enableModuleArgumentNSNullConversionIOS();
175171
}

0 commit comments

Comments
 (0)