destroy react instance on background critical memory pressure

Reviewed By: astreet

Differential Revision: D2989125

fb-gh-sync-id: 0e441409d6b0ea7d5ff6a037730cc1c36818a2da
shipit-source-id: 0e441409d6b0ea7d5ff6a037730cc1c36818a2da
This commit is contained in:
Felix Oghina 2016-03-03 11:11:30 -08:00 committed by Facebook Github Bot 6
parent 4b52d185ac
commit 2e4bb5364d
2 changed files with 13 additions and 0 deletions

View File

@ -62,6 +62,8 @@ public abstract class ReactInstanceManager {
public abstract DevSupportManager getDevSupportManager();
public abstract MemoryPressureRouter getMemoryPressureRouter();
/**
* Trigger react context initialization asynchronously in a background async task. This enables
* applications to pre-load the application JS, and execute global code before
@ -159,6 +161,8 @@ public abstract class ReactInstanceManager {
@VisibleForTesting
public abstract @Nullable ReactContext getCurrentReactContext();
public abstract LifecycleState getLifecycleState();
/**
* Creates a builder that is capable of creating an instance of {@link ReactInstanceManagerImpl}.
*/

View File

@ -308,6 +308,11 @@ import static com.facebook.react.bridge.ReactMarkerConstants.RUN_JS_BUNDLE_START
return mDevSupportManager;
}
@Override
public MemoryPressureRouter getMemoryPressureRouter() {
return mMemoryPressureRouter;
}
private static void initializeSoLoaderIfNecessary(Context applicationContext) {
// Call SoLoader.initialize here, this is required for apps that does not use exopackage and
// does not use SoLoader for loading other native code except from the one used by React Native
@ -582,6 +587,10 @@ import static com.facebook.react.bridge.ReactMarkerConstants.RUN_JS_BUNDLE_START
mLifecycleState = LifecycleState.BEFORE_CREATE;
}
public LifecycleState getLifecycleState() {
return mLifecycleState;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (mCurrentReactContext != null) {