mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
put PR#41194 behind gating (#41469)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41469 Changelog: [Internal] PR#41194 (https://github.com/facebook/react-native/pull/41194) introduces a new callsite to `RCTUnsafeExecuteOnMainQueueSync` in the module init path, which increases risk for deadlock. let's gate it Differential Revision: D51274859 fbshipit-source-id: b2ab6d42378d2885def1fdad61e1de0f6e6285cd
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ad0f064852
commit
8feb84a447
@@ -61,6 +61,9 @@ void RCTEnableTurboModuleSyncVoidMethods(BOOL enabled);
|
||||
BOOL RCTTurboModuleSharedQueueEnabled(void);
|
||||
void RCTEnableTurboModuleSharedQueue(BOOL enabled);
|
||||
|
||||
BOOL RCTUIManagerDispatchAccessibilityManagerInitOntoMain(void);
|
||||
void RCTUIManagerSetDispatchAccessibilityManagerInitOntoMain(BOOL enabled);
|
||||
|
||||
typedef enum {
|
||||
kRCTBridgeProxyLoggingLevelNone,
|
||||
kRCTBridgeProxyLoggingLevelWarning,
|
||||
|
||||
@@ -162,6 +162,17 @@ void RCTEnableTurboModuleSharedQueue(BOOL enabled)
|
||||
gTurboModuleEnableSharedQueue = enabled;
|
||||
}
|
||||
|
||||
BOOL kDispatchAccessibilityManagerInitOntoMain = NO;
|
||||
BOOL RCTUIManagerDispatchAccessibilityManagerInitOntoMain(void)
|
||||
{
|
||||
return kDispatchAccessibilityManagerInitOntoMain;
|
||||
}
|
||||
|
||||
void RCTUIManagerSetDispatchAccessibilityManagerInitOntoMain(BOOL enabled)
|
||||
{
|
||||
kDispatchAccessibilityManagerInitOntoMain = enabled;
|
||||
}
|
||||
|
||||
@interface RCTBridge () <RCTReloadListener>
|
||||
@end
|
||||
|
||||
|
||||
@@ -181,7 +181,10 @@ RCT_EXPORT_MODULE()
|
||||
}
|
||||
|
||||
// This dispatch_async avoids a deadlock while configuring native modules
|
||||
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
|
||||
dispatch_queue_t accessibilityManagerInitQueue = RCTUIManagerDispatchAccessibilityManagerInitOntoMain()
|
||||
? dispatch_get_main_queue()
|
||||
: dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0);
|
||||
dispatch_async(accessibilityManagerInitQueue, ^{
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(didReceiveNewContentSizeMultiplier)
|
||||
name:@"RCTAccessibilityManagerDidUpdateMultiplierNotification"
|
||||
|
||||
Reference in New Issue
Block a user