fix dev reloading

Reviewed By: achen1

Differential Revision: D5187906

fbshipit-source-id: 8c35ee0747bdc0f6748ecdca54e223eafe37e105
This commit is contained in:
Aaron Chiu 2017-06-08 19:27:25 -07:00 committed by Facebook Github Bot
parent a4947d1778
commit c639a1f802
3 changed files with 15 additions and 24 deletions

View File

@ -29,23 +29,23 @@ import com.facebook.infer.annotation.Assertions;
import com.facebook.infer.annotation.ThreadConfined;
import com.facebook.infer.annotation.ThreadSafe;
import com.facebook.react.bridge.CatalystInstance;
import com.facebook.react.bridge.CatalystInstanceImpl;
import com.facebook.react.bridge.JSBundleLoader;
import com.facebook.react.bridge.JSCJavaScriptExecutor;
import com.facebook.react.bridge.JavaJSExecutor;
import com.facebook.react.bridge.JavaScriptExecutor;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.JavaScriptModuleRegistry;
import com.facebook.react.bridge.NativeModuleCallExceptionHandler;
import com.facebook.react.bridge.NativeModuleRegistry;
import com.facebook.react.bridge.NotThreadSafeBridgeIdleDebugListener;
import com.facebook.react.bridge.ProxyJavaScriptExecutor;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReactMarker;
import com.facebook.react.bridge.ReactMarkerConstants;
import com.facebook.react.bridge.queue.ReactQueueConfigurationSpec;
import com.facebook.react.bridge.CatalystInstanceImpl;
import com.facebook.react.bridge.JSBundleLoader;
import com.facebook.react.bridge.JSCJavaScriptExecutor;
import com.facebook.react.bridge.JavaScriptExecutor;
import com.facebook.react.bridge.NativeModuleRegistry;
import com.facebook.react.bridge.ProxyJavaScriptExecutor;
import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.bridge.queue.ReactQueueConfigurationSpec;
import com.facebook.react.common.LifecycleState;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.common.annotations.VisibleForTesting;
@ -695,12 +695,6 @@ public class ReactInstanceManager {
@ThreadConfined(UI)
private void onReloadWithJSDebugger(JavaJSExecutor.Factory jsExecutorFactory) {
synchronized (mAttachedRootViews) {
for (ReactRootView reactRootView : mAttachedRootViews) {
reactRootView.removeAllViews();
reactRootView.setId(View.NO_ID);
}
}
recreateReactContextInBackground(
new ProxyJavaScriptExecutor.Factory(jsExecutorFactory),
JSBundleLoader.createRemoteDebuggerBundleLoader(
@ -710,12 +704,6 @@ public class ReactInstanceManager {
@ThreadConfined(UI)
private void onJSBundleLoadedFromServer() {
synchronized (mAttachedRootViews) {
for (ReactRootView reactRootView : mAttachedRootViews) {
reactRootView.removeAllViews();
reactRootView.setId(View.NO_ID);
}
}
recreateReactContextInBackground(
new JSCJavaScriptExecutor.Factory(mJSCConfig.getConfigMap()),
JSBundleLoader.createCachedBundleFromNetworkLoader(
@ -900,11 +888,14 @@ public class ReactInstanceManager {
if (mLifecycleState == LifecycleState.RESUMED) {
reactContext.onHostPause();
}
synchronized (mAttachedRootViews) {
for (ReactRootView rootView : mAttachedRootViews) {
detachViewFromInstance(rootView, reactContext.getCatalystInstance());
rootView.removeAllViews();
rootView.setId(View.NO_ID);
}
}
reactContext.destroy();
mDevSupportManager.onReactInstanceDestroyed(reactContext);
mMemoryPressureRouter.removeMemoryPressureListener(reactContext.getCatalystInstance());

View File

@ -9,6 +9,9 @@
package com.facebook.react.uimanager;
import javax.annotation.Nullable;
import javax.annotation.concurrent.NotThreadSafe;
import android.content.res.Resources;
import android.util.Log;
import android.util.SparseArray;
@ -37,9 +40,6 @@ import com.facebook.react.uimanager.layoutanimation.LayoutAnimationListener;
import com.facebook.systrace.Systrace;
import com.facebook.systrace.SystraceMessage;
import javax.annotation.Nullable;
import javax.annotation.concurrent.NotThreadSafe;
/**
* Delegate of {@link UIManagerModule} that owns the native view hierarchy and mapping between
* native view names used in JS and corresponding instances of {@link ViewManager}. The

View File

@ -21,10 +21,10 @@ import com.facebook.react.animation.AnimationRegistry;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.GuardedRunnable;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.SoftAssertions;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.SoftAssertions;
import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.modules.core.ReactChoreographer;