Set up experiment to dispatch promise methods asynchronously to NativeModules thread

Summary:
TurboModule methods that return promises are synchronously run on the JavaScript thread. Back in D22489338 (9c35b5b8c4), we wrote code to make them dispatch on the NativeModules thread. That code, however, was just left disabled. In this diff, I wire up the TurboModules infra to a MobileConfig, which should allow us to assess the performance impact of async dispatch of promise methods to the NativeModules thread in production, before we roll it out more widely.

Changelog: [Internal]

NOTE: This diff was reverted, beacuse we landed it it without D24685387.

Reviewed By: ejanzer

Differential Revision: D24787573

fbshipit-source-id: 324bd22ce79c2c16c7f7b6996496d255a2c6256e
This commit is contained in:
Ramanpreet Nara 2020-11-06 13:08:51 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 00d9deaf6b
Коммит f1e292b9c1
2 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -23,6 +23,9 @@ public class ReactFeatureFlags {
*/
public static volatile boolean useTurboModules = false;
/** Should we dispatch TurboModule methods with promise returns to the NativeModules thread? */
public static volatile boolean enableTurboModulePromiseAsyncDispatch = false;
/*
* This feature flag enables logs for Fabric
*/

Просмотреть файл

@ -17,6 +17,7 @@ import com.facebook.react.bridge.CxxModuleWrapper;
import com.facebook.react.bridge.JSIModule;
import com.facebook.react.bridge.JavaScriptContextHolder;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.config.ReactFeatureFlags;
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import com.facebook.react.turbomodule.core.interfaces.TurboModuleRegistry;
@ -60,7 +61,7 @@ public class TurboModuleManager implements JSIModule, TurboModuleRegistry {
(CallInvokerHolderImpl) jsCallInvokerHolder,
(CallInvokerHolderImpl) nativeCallInvokerHolder,
delegate,
false);
ReactFeatureFlags.enableTurboModulePromiseAsyncDispatch);
installJSIBindings();
mEagerInitModuleNames =