Skip to content

Commit 01b2c5b

Browse files
javachemeta-codesync[bot]
authored andcommitted
Remove enableMainQueueCoordinatorOnIOS, make coordinator always-on
Summary: 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. Differential Revision: D105984547
1 parent 61b2793 commit 01b2c5b

24 files changed

Lines changed: 102 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<<de3444d0862944a45bfb112e649dd395>>
7+
* @generated SignedSource<<1daf42834a0bcc06caae571c6541fecd>>
88
*/
99

1010
/**
@@ -234,12 +234,6 @@ public object ReactNativeFeatureFlags {
234234
@JvmStatic
235235
public fun enableLayoutAnimationsOnIOS(): Boolean = accessor.enableLayoutAnimationsOnIOS()
236236

237-
/**
238-
* Make RCTUnsafeExecuteOnMainQueueSync less likely to deadlock, when used in conjuction with sync rendering/events.
239-
*/
240-
@JvmStatic
241-
public fun enableMainQueueCoordinatorOnIOS(): Boolean = accessor.enableMainQueueCoordinatorOnIOS()
242-
243237
/**
244238
* Enable NSNull conversion when handling module arguments on iOS
245239
*/

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<<76c912049c6cbfac8bd0e27418dab700>>
7+
* @generated SignedSource<<6b189752d6dedc9d814179ddd6d605f4>>
88
*/
99

1010
/**
@@ -54,7 +54,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
5454
private var enableKeyEventsCache: Boolean? = null
5555
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
5656
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
57-
private var enableMainQueueCoordinatorOnIOSCache: Boolean? = null
5857
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
5958
private var enableMutationObserverByDefaultCache: Boolean? = null
6059
private var enableNativeCSSParsingCache: Boolean? = null
@@ -415,15 +414,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
415414
return cached
416415
}
417416

418-
override fun enableMainQueueCoordinatorOnIOS(): Boolean {
419-
var cached = enableMainQueueCoordinatorOnIOSCache
420-
if (cached == null) {
421-
cached = ReactNativeFeatureFlagsCxxInterop.enableMainQueueCoordinatorOnIOS()
422-
enableMainQueueCoordinatorOnIOSCache = cached
423-
}
424-
return cached
425-
}
426-
427417
override fun enableModuleArgumentNSNullConversionIOS(): Boolean {
428418
var cached = enableModuleArgumentNSNullConversionIOSCache
429419
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<<425c8a86705214aa021e413211468e97>>
7+
* @generated SignedSource<<34dc75d00f7dad4922361c5661a5c527>>
88
*/
99

1010
/**
@@ -96,8 +96,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
9696

9797
@DoNotStrip @JvmStatic public external fun enableLayoutAnimationsOnIOS(): Boolean
9898

99-
@DoNotStrip @JvmStatic public external fun enableMainQueueCoordinatorOnIOS(): Boolean
100-
10199
@DoNotStrip @JvmStatic public external fun enableModuleArgumentNSNullConversionIOS(): Boolean
102100

103101
@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<<30bd20f9479756c3dce574c05b80a1f4>>
7+
* @generated SignedSource<<e57e4a1d8593cc3574430e4ab4845894>>
88
*/
99

1010
/**
@@ -91,8 +91,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
9191

9292
override fun enableLayoutAnimationsOnIOS(): Boolean = true
9393

94-
override fun enableMainQueueCoordinatorOnIOS(): Boolean = false
95-
9694
override fun enableModuleArgumentNSNullConversionIOS(): Boolean = false
9795

9896
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<<e08b9d00abd67c312a50a5c893a91e1b>>
7+
* @generated SignedSource<<c01926414a73e2f1249486080ef81d9b>>
88
*/
99

1010
/**
@@ -58,7 +58,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
5858
private var enableKeyEventsCache: Boolean? = null
5959
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
6060
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
61-
private var enableMainQueueCoordinatorOnIOSCache: Boolean? = null
6261
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
6362
private var enableMutationObserverByDefaultCache: Boolean? = null
6463
private var enableNativeCSSParsingCache: Boolean? = null
@@ -453,16 +452,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
453452
return cached
454453
}
455454

456-
override fun enableMainQueueCoordinatorOnIOS(): Boolean {
457-
var cached = enableMainQueueCoordinatorOnIOSCache
458-
if (cached == null) {
459-
cached = currentProvider.enableMainQueueCoordinatorOnIOS()
460-
accessedFeatureFlags.add("enableMainQueueCoordinatorOnIOS")
461-
enableMainQueueCoordinatorOnIOSCache = cached
462-
}
463-
return cached
464-
}
465-
466455
override fun enableModuleArgumentNSNullConversionIOS(): Boolean {
467456
var cached = enableModuleArgumentNSNullConversionIOSCache
468457
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<<babb0304c7232e14d8dd807032bcbc53>>
7+
* @generated SignedSource<<3bdd4f869245c79c42fbd09646d753ba>>
88
*/
99

1010
/**
@@ -91,8 +91,6 @@ public interface ReactNativeFeatureFlagsProvider {
9191

9292
@DoNotStrip public fun enableLayoutAnimationsOnIOS(): Boolean
9393

94-
@DoNotStrip public fun enableMainQueueCoordinatorOnIOS(): Boolean
95-
9694
@DoNotStrip public fun enableModuleArgumentNSNullConversionIOS(): Boolean
9795

9896
@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<<c939675c97b36966d0cc852389c23450>>
7+
* @generated SignedSource<<641a3191c119df804bdf975fd4841072>>
88
*/
99

1010
/**
@@ -243,12 +243,6 @@ class ReactNativeFeatureFlagsJavaProvider
243243
return method(javaProvider_);
244244
}
245245

246-
bool enableMainQueueCoordinatorOnIOS() override {
247-
static const auto method =
248-
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableMainQueueCoordinatorOnIOS");
249-
return method(javaProvider_);
250-
}
251-
252246
bool enableModuleArgumentNSNullConversionIOS() override {
253247
static const auto method =
254248
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableModuleArgumentNSNullConversionIOS");
@@ -741,11 +735,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnIOS(
741735
return ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS();
742736
}
743737

744-
bool JReactNativeFeatureFlagsCxxInterop::enableMainQueueCoordinatorOnIOS(
745-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
746-
return ReactNativeFeatureFlags::enableMainQueueCoordinatorOnIOS();
747-
}
748-
749738
bool JReactNativeFeatureFlagsCxxInterop::enableModuleArgumentNSNullConversionIOS(
750739
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
751740
return ReactNativeFeatureFlags::enableModuleArgumentNSNullConversionIOS();
@@ -1144,9 +1133,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
11441133
makeNativeMethod(
11451134
"enableLayoutAnimationsOnIOS",
11461135
JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnIOS),
1147-
makeNativeMethod(
1148-
"enableMainQueueCoordinatorOnIOS",
1149-
JReactNativeFeatureFlagsCxxInterop::enableMainQueueCoordinatorOnIOS),
11501136
makeNativeMethod(
11511137
"enableModuleArgumentNSNullConversionIOS",
11521138
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<<5501bc377ccafc4dab778978ee3f33b2>>
7+
* @generated SignedSource<<8ae9d1ef2789deae877f273dc47a5cad>>
88
*/
99

1010
/**
@@ -132,9 +132,6 @@ class JReactNativeFeatureFlagsCxxInterop
132132
static bool enableLayoutAnimationsOnIOS(
133133
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
134134

135-
static bool enableMainQueueCoordinatorOnIOS(
136-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
137-
138135
static bool enableModuleArgumentNSNullConversionIOS(
139136
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
140137

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<<f1b8c3c7118c94617233847bf2d31428>>
7+
* @generated SignedSource<<28287e973a90e07fb8cfc2c0c2e8396f>>
88
*/
99

1010
/**
@@ -162,10 +162,6 @@ bool ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS() {
162162
return getAccessor().enableLayoutAnimationsOnIOS();
163163
}
164164

165-
bool ReactNativeFeatureFlags::enableMainQueueCoordinatorOnIOS() {
166-
return getAccessor().enableMainQueueCoordinatorOnIOS();
167-
}
168-
169165
bool ReactNativeFeatureFlags::enableModuleArgumentNSNullConversionIOS() {
170166
return getAccessor().enableModuleArgumentNSNullConversionIOS();
171167
}

0 commit comments

Comments
 (0)