Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions packages/react-native/React/Base/RCTUtils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#import <mach/mach_time.h>
#import <objc/message.h>
#import <objc/runtime.h>
#import <react/featureflags/ReactNativeFeatureFlags.h>
#import <zlib.h>

#import <UIKit/UIKit.h>
Expand Down Expand Up @@ -312,15 +311,12 @@ void RCTUnsafeExecuteOnMainQueueSync(dispatch_block_t block)
}

#if !TARGET_OS_TV
if (ReactNativeFeatureFlags::enableMainQueueCoordinatorOnIOS()) {
unsafeExecuteOnMainThreadSync(block);
return;
}
#endif

unsafeExecuteOnMainThreadSync(block);
#else
dispatch_sync(dispatch_get_main_queue(), ^{
block();
});
#endif
}

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

#if !TARGET_OS_TV
if (ReactNativeFeatureFlags::enableMainQueueCoordinatorOnIOS()) {
unsafeExecuteOnMainThreadSync(block);
return;
}
#endif

unsafeExecuteOnMainThreadSync(block);
#else
dispatch_sync(dispatch_get_main_queue(), executeOnce);
#endif
}

CGFloat RCTScreenScale(void)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<fa3d35be13801d5991e6bfb2cef2ef43>>
* @generated SignedSource<<86c797c19cc585b74714ca3aa75bbd6d>>
*/

/**
Expand Down Expand Up @@ -240,12 +240,6 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun enableLayoutAnimationsOnIOS(): Boolean = accessor.enableLayoutAnimationsOnIOS()

/**
* Make RCTUnsafeExecuteOnMainQueueSync less likely to deadlock, when used in conjuction with sync rendering/events.
*/
@JvmStatic
public fun enableMainQueueCoordinatorOnIOS(): Boolean = accessor.enableMainQueueCoordinatorOnIOS()

/**
* Enable NSNull conversion when handling module arguments on iOS
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<c8e71de4517634933754c6e7a6e8ac92>>
* @generated SignedSource<<d71556cf1226fe6a41dd388568153d3a>>
*/

/**
Expand Down Expand Up @@ -55,7 +55,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var enableKeyEventsCache: Boolean? = null
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
private var enableMainQueueCoordinatorOnIOSCache: Boolean? = null
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
private var enableMutationObserverByDefaultCache: Boolean? = null
private var enableNativeCSSParsingCache: Boolean? = null
Expand Down Expand Up @@ -424,15 +423,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

override fun enableMainQueueCoordinatorOnIOS(): Boolean {
var cached = enableMainQueueCoordinatorOnIOSCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableMainQueueCoordinatorOnIOS()
enableMainQueueCoordinatorOnIOSCache = cached
}
return cached
}

override fun enableModuleArgumentNSNullConversionIOS(): Boolean {
var cached = enableModuleArgumentNSNullConversionIOSCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<9d3495c774e4367973974a4f83ea7d16>>
* @generated SignedSource<<2ee82b1e1dcae3ea10dbd92549d65a6c>>
*/

/**
Expand Down Expand Up @@ -98,8 +98,6 @@ public object ReactNativeFeatureFlagsCxxInterop {

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

@DoNotStrip @JvmStatic public external fun enableMainQueueCoordinatorOnIOS(): Boolean

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

@DoNotStrip @JvmStatic public external fun enableMutationObserverByDefault(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<811ccbada43f15c9418e0177041c5747>>
* @generated SignedSource<<738a114e73ddb940fb14efd0dff79d1b>>
*/

/**
Expand Down Expand Up @@ -93,8 +93,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun enableLayoutAnimationsOnIOS(): Boolean = true

override fun enableMainQueueCoordinatorOnIOS(): Boolean = false

override fun enableModuleArgumentNSNullConversionIOS(): Boolean = false

override fun enableMutationObserverByDefault(): Boolean = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<69c333993720f22c6db80f3aceae32cd>>
* @generated SignedSource<<d5b84c7e0c58f61d891e0dd63f61b4c0>>
*/

/**
Expand Down Expand Up @@ -59,7 +59,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var enableKeyEventsCache: Boolean? = null
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
private var enableMainQueueCoordinatorOnIOSCache: Boolean? = null
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
private var enableMutationObserverByDefaultCache: Boolean? = null
private var enableNativeCSSParsingCache: Boolean? = null
Expand Down Expand Up @@ -463,16 +462,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

override fun enableMainQueueCoordinatorOnIOS(): Boolean {
var cached = enableMainQueueCoordinatorOnIOSCache
if (cached == null) {
cached = currentProvider.enableMainQueueCoordinatorOnIOS()
accessedFeatureFlags.add("enableMainQueueCoordinatorOnIOS")
enableMainQueueCoordinatorOnIOSCache = cached
}
return cached
}

override fun enableModuleArgumentNSNullConversionIOS(): Boolean {
var cached = enableModuleArgumentNSNullConversionIOSCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<cb5de865c68dfd9b7b7b2d86d9fb090b>>
* @generated SignedSource<<a3dbeb4eec6efecc4fc355b15a984e58>>
*/

/**
Expand Down Expand Up @@ -93,8 +93,6 @@ public interface ReactNativeFeatureFlagsProvider {

@DoNotStrip public fun enableLayoutAnimationsOnIOS(): Boolean

@DoNotStrip public fun enableMainQueueCoordinatorOnIOS(): Boolean

@DoNotStrip public fun enableModuleArgumentNSNullConversionIOS(): Boolean

@DoNotStrip public fun enableMutationObserverByDefault(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<f667d1281347eeacfca65411acdf6dc7>>
* @generated SignedSource<<99f843dd0784f9fe372f943767e2033c>>
*/

/**
Expand Down Expand Up @@ -249,12 +249,6 @@ class ReactNativeFeatureFlagsJavaProvider
return method(javaProvider_);
}

bool enableMainQueueCoordinatorOnIOS() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableMainQueueCoordinatorOnIOS");
return method(javaProvider_);
}

bool enableModuleArgumentNSNullConversionIOS() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableModuleArgumentNSNullConversionIOS");
Expand Down Expand Up @@ -746,11 +740,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnIOS(
return ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS();
}

bool JReactNativeFeatureFlagsCxxInterop::enableMainQueueCoordinatorOnIOS(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableMainQueueCoordinatorOnIOS();
}

bool JReactNativeFeatureFlagsCxxInterop::enableModuleArgumentNSNullConversionIOS(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableModuleArgumentNSNullConversionIOS();
Expand Down Expand Up @@ -1147,9 +1136,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"enableLayoutAnimationsOnIOS",
JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnIOS),
makeNativeMethod(
"enableMainQueueCoordinatorOnIOS",
JReactNativeFeatureFlagsCxxInterop::enableMainQueueCoordinatorOnIOS),
makeNativeMethod(
"enableModuleArgumentNSNullConversionIOS",
JReactNativeFeatureFlagsCxxInterop::enableModuleArgumentNSNullConversionIOS),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<f2dbc5e247060946295f35a07191c213>>
* @generated SignedSource<<05716b6ab8139bc31b962f9158acd6b6>>
*/

/**
Expand Down Expand Up @@ -135,9 +135,6 @@ class JReactNativeFeatureFlagsCxxInterop
static bool enableLayoutAnimationsOnIOS(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool enableMainQueueCoordinatorOnIOS(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool enableModuleArgumentNSNullConversionIOS(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<177c370caf828494ce42486af0d8c698>>
* @generated SignedSource<<dda96e26972d745fa18d802035194cf0>>
*/

/**
Expand Down Expand Up @@ -166,10 +166,6 @@ bool ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS() {
return getAccessor().enableLayoutAnimationsOnIOS();
}

bool ReactNativeFeatureFlags::enableMainQueueCoordinatorOnIOS() {
return getAccessor().enableMainQueueCoordinatorOnIOS();
}

bool ReactNativeFeatureFlags::enableModuleArgumentNSNullConversionIOS() {
return getAccessor().enableModuleArgumentNSNullConversionIOS();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<5ff6ec567d516d966cb2fadfc5cc93b3>>
* @generated SignedSource<<dcb1e3ba662f28194124dc63879f4fde>>
*/

/**
Expand Down Expand Up @@ -214,11 +214,6 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool enableLayoutAnimationsOnIOS();

/**
* Make RCTUnsafeExecuteOnMainQueueSync less likely to deadlock, when used in conjuction with sync rendering/events.
*/
RN_EXPORT static bool enableMainQueueCoordinatorOnIOS();

/**
* Enable NSNull conversion when handling module arguments on iOS
*/
Expand Down
Loading
Loading