mirror of
https://github.com/status-im/react-native.git
synced 2025-02-28 09:00:55 +00:00
Cleanup ReactInstanceManager
Reviewed By: kathryngray Differential Revision: D6296922 fbshipit-source-id: 2fbf11f09a3c25ff3e7c222edc2e01b81e687943
This commit is contained in:
parent
4894ac430d
commit
053776338e
@ -152,42 +152,12 @@ public class ReactInstanceManager {
|
|||||||
// Identifies whether the instance manager destroy function is in process,
|
// Identifies whether the instance manager destroy function is in process,
|
||||||
// while true any spawned create thread should wait for proper clean up before initializing
|
// while true any spawned create thread should wait for proper clean up before initializing
|
||||||
private volatile Boolean mHasStartedDestroying = false;
|
private volatile Boolean mHasStartedDestroying = false;
|
||||||
private final UIImplementationProvider mUIImplementationProvider;
|
|
||||||
private final MemoryPressureRouter mMemoryPressureRouter;
|
private final MemoryPressureRouter mMemoryPressureRouter;
|
||||||
private final @Nullable NativeModuleCallExceptionHandler mNativeModuleCallExceptionHandler;
|
private final @Nullable NativeModuleCallExceptionHandler mNativeModuleCallExceptionHandler;
|
||||||
private final boolean mLazyNativeModulesEnabled;
|
private final boolean mLazyNativeModulesEnabled;
|
||||||
private final boolean mLazyViewManagersEnabled;
|
|
||||||
private final boolean mDelayViewManagerClassLoadsEnabled;
|
private final boolean mDelayViewManagerClassLoadsEnabled;
|
||||||
private final boolean mUseSeparateUIBackgroundThread;
|
private final boolean mUseSeparateUIBackgroundThread;
|
||||||
private final int mMinNumShakes;
|
private final int mMinNumShakes;
|
||||||
private final int mMinTimeLeftInFrameForNonBatchedOperationMs;
|
|
||||||
|
|
||||||
private final ReactInstanceDevCommandsHandler mDevInterface =
|
|
||||||
new ReactInstanceDevCommandsHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReloadWithJSDebugger(JavaJSExecutor.Factory jsExecutorFactory) {
|
|
||||||
ReactInstanceManager.this.onReloadWithJSDebugger(jsExecutorFactory);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onJSBundleLoadedFromServer() {
|
|
||||||
ReactInstanceManager.this.onJSBundleLoadedFromServer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void toggleElementInspector() {
|
|
||||||
ReactInstanceManager.this.toggleElementInspector();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private final DefaultHardwareBackBtnHandler mBackBtnHandler =
|
|
||||||
new DefaultHardwareBackBtnHandler() {
|
|
||||||
@Override
|
|
||||||
public void invokeDefaultOnBackPressed() {
|
|
||||||
ReactInstanceManager.this.invokeDefaultOnBackPressed();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private class ReactContextInitParams {
|
private class ReactContextInitParams {
|
||||||
private final JavaScriptExecutorFactory mJsExecutorFactory;
|
private final JavaScriptExecutorFactory mJsExecutorFactory;
|
||||||
@ -251,9 +221,10 @@ public class ReactInstanceManager {
|
|||||||
mPackages = new ArrayList<>();
|
mPackages = new ArrayList<>();
|
||||||
mInitFunctions = new ArrayList<>();
|
mInitFunctions = new ArrayList<>();
|
||||||
mUseDeveloperSupport = useDeveloperSupport;
|
mUseDeveloperSupport = useDeveloperSupport;
|
||||||
mDevSupportManager = DevSupportManagerFactory.create(
|
mDevSupportManager =
|
||||||
|
DevSupportManagerFactory.create(
|
||||||
applicationContext,
|
applicationContext,
|
||||||
mDevInterface,
|
createDevInterface(),
|
||||||
mJSMainModulePath,
|
mJSMainModulePath,
|
||||||
useDeveloperSupport,
|
useDeveloperSupport,
|
||||||
redBoxHandler,
|
redBoxHandler,
|
||||||
@ -261,24 +232,27 @@ public class ReactInstanceManager {
|
|||||||
minNumShakes);
|
minNumShakes);
|
||||||
mBridgeIdleDebugListener = bridgeIdleDebugListener;
|
mBridgeIdleDebugListener = bridgeIdleDebugListener;
|
||||||
mLifecycleState = initialLifecycleState;
|
mLifecycleState = initialLifecycleState;
|
||||||
mUIImplementationProvider = uiImplementationProvider;
|
|
||||||
mMemoryPressureRouter = new MemoryPressureRouter(applicationContext);
|
mMemoryPressureRouter = new MemoryPressureRouter(applicationContext);
|
||||||
mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
|
mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
|
||||||
mLazyNativeModulesEnabled = lazyNativeModulesEnabled;
|
mLazyNativeModulesEnabled = lazyNativeModulesEnabled;
|
||||||
mLazyViewManagersEnabled = lazyViewManagersEnabled;
|
|
||||||
mDelayViewManagerClassLoadsEnabled = delayViewManagerClassLoadsEnabled;
|
mDelayViewManagerClassLoadsEnabled = delayViewManagerClassLoadsEnabled;
|
||||||
mMinTimeLeftInFrameForNonBatchedOperationMs = minTimeLeftInFrameForNonBatchedOperationMs;
|
|
||||||
mUseSeparateUIBackgroundThread = useSeparateUIBackgroundThread;
|
mUseSeparateUIBackgroundThread = useSeparateUIBackgroundThread;
|
||||||
mMinNumShakes = minNumShakes;
|
mMinNumShakes = minNumShakes;
|
||||||
synchronized (mPackages) {
|
synchronized (mPackages) {
|
||||||
PrinterHolder.getPrinter().logMessage(ReactDebugOverlayTags.RN_CORE, "RNCore: Use Split Packages");
|
PrinterHolder.getPrinter()
|
||||||
|
.logMessage(ReactDebugOverlayTags.RN_CORE, "RNCore: Use Split Packages");
|
||||||
mPackages.add(
|
mPackages.add(
|
||||||
new CoreModulesPackage(
|
new CoreModulesPackage(
|
||||||
this,
|
this,
|
||||||
mBackBtnHandler,
|
new DefaultHardwareBackBtnHandler() {
|
||||||
mUIImplementationProvider,
|
@Override
|
||||||
mLazyViewManagersEnabled,
|
public void invokeDefaultOnBackPressed() {
|
||||||
mMinTimeLeftInFrameForNonBatchedOperationMs));
|
ReactInstanceManager.this.invokeDefaultOnBackPressed();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
uiImplementationProvider,
|
||||||
|
lazyViewManagersEnabled,
|
||||||
|
minTimeLeftInFrameForNonBatchedOperationMs));
|
||||||
if (mUseDeveloperSupport) {
|
if (mUseDeveloperSupport) {
|
||||||
mPackages.add(new DebugCorePackage());
|
mPackages.add(new DebugCorePackage());
|
||||||
}
|
}
|
||||||
@ -292,6 +266,25 @@ public class ReactInstanceManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ReactInstanceDevCommandsHandler createDevInterface() {
|
||||||
|
return new ReactInstanceDevCommandsHandler() {
|
||||||
|
@Override
|
||||||
|
public void onReloadWithJSDebugger(JavaJSExecutor.Factory jsExecutorFactory) {
|
||||||
|
ReactInstanceManager.this.onReloadWithJSDebugger(jsExecutorFactory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onJSBundleLoadedFromServer() {
|
||||||
|
ReactInstanceManager.this.onJSBundleLoadedFromServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toggleElementInspector() {
|
||||||
|
ReactInstanceManager.this.toggleElementInspector();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public DevSupportManager getDevSupportManager() {
|
public DevSupportManager getDevSupportManager() {
|
||||||
return mDevSupportManager;
|
return mDevSupportManager;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user