Expose RuntimeExecutor on CatalystInstance (#28851)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28851

This diff creates a RuntimeExecutor that uses the bridge and exposes it on CatalystInstanceImpl.

Changelog: [Internal]

Reviewed By: mdvacca, RSNara

Differential Revision: D21051949

fbshipit-source-id: b3977fc14fa19089f33e297d29cedba0d067526d
This commit is contained in:
Emily Janzer
2020-05-08 16:13:42 -07:00
committed by Facebook GitHub Bot
parent 13ee5c4c16
commit a4a47b9a1e
14 changed files with 105 additions and 3 deletions
@@ -99,14 +99,18 @@ public interface CatalystInstance
void setGlobalVariable(String propName, String jsonValue);
/**
* Get the C pointer (as a long) to the JavaScriptCore context associated with this instance.
* Do not use this anymore. Use {@link #getRuntimeExecutor()} instead. Get the C pointer (as a
* long) to the JavaScriptCore context associated with this instance.
*
* <p>Use the following pattern to ensure that the JS context is not cleared while you are using
* it: JavaScriptContextHolder jsContext = reactContext.getJavaScriptContextHolder()
* synchronized(jsContext) { nativeThingNeedingJsContext(jsContext.get()); }
*/
@Deprecated
JavaScriptContextHolder getJavaScriptContextHolder();
RuntimeExecutor getRuntimeExecutor();
void addJSIModules(List<JSIModuleSpec> jsiModules);
/**
@@ -664,6 +664,9 @@ public class CatalystInstanceImpl implements CatalystInstance {
return mJavaScriptContextHolder;
}
@Override
public native RuntimeExecutor getRuntimeExecutor();
@Override
public void addJSIModules(List<JSIModuleSpec> jsiModules) {
mJSIModuleRegistry.registerModules(jsiModules);