Make JSCConfig non-nullable

Reviewed By: andreicoman11

Differential Revision: D3463317

fbshipit-source-id: feeda132cd596317ca45b083d69ae8df3ffbd6f0
This commit is contained in:
Alexander Blom 2016-06-22 04:06:25 -07:00 committed by Facebook Github Bot 1
parent 523d39ad92
commit e54ff3d03f
3 changed files with 14 additions and 9 deletions

View File

@ -8,5 +8,12 @@ import com.facebook.react.bridge.WritableNativeMap;
* Interface for the configuration object that is passed to JSC.
*/
public interface JSCConfig {
public WritableNativeMap getConfigMap();
JSCConfig EMPTY = new JSCConfig() {
@Override
public WritableNativeMap getConfigMap() {
return new WritableNativeMap();
}
};
WritableNativeMap getConfigMap();
}

View File

@ -191,7 +191,7 @@ public abstract class ReactInstanceManager {
protected @Nullable LifecycleState mInitialLifecycleState;
protected @Nullable UIImplementationProvider mUIImplementationProvider;
protected @Nullable NativeModuleCallExceptionHandler mNativeModuleCallExceptionHandler;
protected @Nullable JSCConfig mJSCConfig;
protected JSCConfig mJSCConfig = JSCConfig.EMPTY;
protected @Nullable Activity mCurrentActivity;
protected @Nullable DefaultHardwareBackBtnHandler mDefaultHardwareBackBtnHandler;
protected @Nullable RedBoxHandler mRedBoxHandler;

View File

@ -125,7 +125,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
private final UIImplementationProvider mUIImplementationProvider;
private final MemoryPressureRouter mMemoryPressureRouter;
private final @Nullable NativeModuleCallExceptionHandler mNativeModuleCallExceptionHandler;
private final @Nullable JSCConfig mJSCConfig;
private final JSCConfig mJSCConfig;
private @Nullable RedBoxHandler mRedBoxHandler;
private final ReactInstanceDevCommandsHandler mDevInterface =
@ -283,7 +283,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
LifecycleState initialLifecycleState,
UIImplementationProvider uiImplementationProvider,
NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler,
@Nullable JSCConfig jscConfig) {
JSCConfig jscConfig) {
this(applicationContext,
currentActivity,
@ -312,7 +312,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
LifecycleState initialLifecycleState,
UIImplementationProvider uiImplementationProvider,
NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler,
@Nullable JSCConfig jscConfig,
JSCConfig jscConfig,
@Nullable RedBoxHandler redBoxHandler) {
initializeSoLoaderIfNecessary(applicationContext);
@ -443,8 +443,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
private void recreateReactContextInBackgroundFromBundleFile() {
recreateReactContextInBackground(
new JSCJavaScriptExecutor.Factory(
mJSCConfig == null ? new WritableNativeMap() : mJSCConfig.getConfigMap()),
new JSCJavaScriptExecutor.Factory(mJSCConfig.getConfigMap()),
JSBundleLoader.createFileLoader(mApplicationContext, mJSBundleFile));
}
@ -721,8 +720,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
private void onJSBundleLoadedFromServer() {
recreateReactContextInBackground(
new JSCJavaScriptExecutor.Factory(
mJSCConfig == null ? new WritableNativeMap() : mJSCConfig.getConfigMap()),
new JSCJavaScriptExecutor.Factory(mJSCConfig.getConfigMap()),
JSBundleLoader.createCachedBundleFromNetworkLoader(
mDevSupportManager.getSourceUrl(),
mDevSupportManager.getDownloadedJSBundleFile()));