Wire up RuntimeExecutorFlushing to MobileConfig

Summary:
With D27975839, RuntimeExecutor will be able to start flushing the queued up NativeModule calls in every call from C++ -> JavaScript. We're going to test this feature to measure its impact. In this diff, I wire up the the MobileConfig to ReactFeatureFlags.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D27978112

fbshipit-source-id: 47e1e74398c62755bb0fdc6b54b7fd3aa47eb877
This commit is contained in:
Ramanpreet Nara
2021-04-23 18:14:35 -07:00
committed by Facebook GitHub Bot
parent c0ec82e61e
commit d48c2be46f
2 changed files with 21 additions and 1 deletions
@@ -551,7 +551,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
@Override
public RuntimeExecutor getRuntimeExecutor() {
return getRuntimeExecutor(false);
return getRuntimeExecutor(ReactFeatureFlags.enableRuntimeExecutorFlushing());
}
public native RuntimeExecutor getRuntimeExecutor(boolean shouldFlush);
@@ -72,4 +72,24 @@ public class ReactFeatureFlags {
/** Enables MapBuffer Serialization */
public static boolean mapBufferSerializationEnabled = false;
/** An interface used to compute flags on demand. */
public interface FlagProvider {
boolean get();
}
/** Should the RuntimeExecutor call JSIExecutor::flush()? */
private static FlagProvider enableRuntimeExecutorFlushingProvider = null;
public static void setEnableRuntimeExecutorFlushingFlagProvider(FlagProvider provider) {
enableRuntimeExecutorFlushingProvider = provider;
}
public static boolean enableRuntimeExecutorFlushing() {
if (enableRuntimeExecutorFlushingProvider != null) {
return enableRuntimeExecutorFlushingProvider.get();
}
return false;
}
}