Skip to content

Commit

Permalink
destroy react instance on background critical memory pressure
Browse files Browse the repository at this point in the history
Reviewed By: astreet

Differential Revision: D2989125

fb-gh-sync-id: 0e441409d6b0ea7d5ff6a037730cc1c36818a2da
shipit-source-id: 0e441409d6b0ea7d5ff6a037730cc1c36818a2da
  • Loading branch information
foghina authored and Facebook Github Bot 6 committed Mar 3, 2016
1 parent 4b52d18 commit 2e4bb53
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public interface ReactInstanceEventListener {

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
Expand Down Expand Up @@ -159,6 +161,8 @@ public abstract List<ViewManager> createAllViewManagers(
@VisibleForTesting
public abstract @Nullable ReactContext getCurrentReactContext();

public abstract LifecycleState getLifecycleState();

/**
* Creates a builder that is capable of creating an instance of {@link ReactInstanceManagerImpl}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ public DevSupportManager getDevSupportManager() {
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
Expand Down Expand Up @@ -582,6 +587,10 @@ private void moveToBeforeCreateLifecycleState() {
mLifecycleState = LifecycleState.BEFORE_CREATE;
}

public LifecycleState getLifecycleState() {
return mLifecycleState;
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (mCurrentReactContext != null) {
Expand Down

0 comments on commit 2e4bb53

Please sign in to comment.