mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-10 22:47:58 +08:00
Hook up native delta client
Summary: Adds support for native clients to `ReactAndroid`: - `.devsupport.BundleDeltaClient` is now abstract with two implementations: the existing Java client, and a native client - `BundleDeltaClient#processDelta(...)` can now return a native delta client object - if that client object is non-null, the bridge is started up with that client rather than a script written to disk Reviewed By: fromcelticpark Differential Revision: D7845135 fbshipit-source-id: 379a9c6f9319c62eec3c370cda9ffa0969266a29
This commit is contained in:
committed by
Facebook Github Bot
parent
8f85abdb14
commit
dd036c2328
@@ -50,6 +50,7 @@ import com.facebook.react.bridge.JSIModulesProvider;
|
||||
import com.facebook.react.bridge.JavaJSExecutor;
|
||||
import com.facebook.react.bridge.JavaScriptExecutor;
|
||||
import com.facebook.react.bridge.JavaScriptExecutorFactory;
|
||||
import com.facebook.react.bridge.NativeDeltaClient;
|
||||
import com.facebook.react.bridge.NativeModuleCallExceptionHandler;
|
||||
import com.facebook.react.bridge.NativeModuleRegistry;
|
||||
import com.facebook.react.bridge.NotThreadSafeBridgeIdleDebugListener;
|
||||
@@ -84,6 +85,7 @@ import com.facebook.react.views.imagehelper.ResourceDrawableIdHelper;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
import com.facebook.systrace.Systrace;
|
||||
import com.facebook.systrace.SystraceMessage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -270,8 +272,8 @@ public class ReactInstanceManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJSBundleLoadedFromServer() {
|
||||
ReactInstanceManager.this.onJSBundleLoadedFromServer();
|
||||
public void onJSBundleLoadedFromServer(@Nullable NativeDeltaClient nativeDeltaClient) {
|
||||
ReactInstanceManager.this.onJSBundleLoadedFromServer(nativeDeltaClient);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -360,7 +362,7 @@ public class ReactInstanceManager {
|
||||
!devSettings.isRemoteJSDebugEnabled()) {
|
||||
// If there is a up-to-date bundle downloaded from server,
|
||||
// with remote JS debugging disabled, always use that.
|
||||
onJSBundleLoadedFromServer();
|
||||
onJSBundleLoadedFromServer(null);
|
||||
} else if (mBundleLoader == null) {
|
||||
mDevSupportManager.handleReloadJS();
|
||||
} else {
|
||||
@@ -848,12 +850,17 @@ public class ReactInstanceManager {
|
||||
}
|
||||
|
||||
@ThreadConfined(UI)
|
||||
private void onJSBundleLoadedFromServer() {
|
||||
private void onJSBundleLoadedFromServer(@Nullable NativeDeltaClient nativeDeltaClient) {
|
||||
Log.d(ReactConstants.TAG, "ReactInstanceManager.onJSBundleLoadedFromServer()");
|
||||
recreateReactContextInBackground(
|
||||
mJavaScriptExecutorFactory,
|
||||
JSBundleLoader.createCachedBundleFromNetworkLoader(
|
||||
mDevSupportManager.getSourceUrl(), mDevSupportManager.getDownloadedJSBundleFile()));
|
||||
|
||||
JSBundleLoader bundleLoader = nativeDeltaClient == null
|
||||
? JSBundleLoader.createCachedBundleFromNetworkLoader(
|
||||
mDevSupportManager.getSourceUrl(),
|
||||
mDevSupportManager.getDownloadedJSBundleFile())
|
||||
: JSBundleLoader.createDeltaFromNetworkLoader(
|
||||
mDevSupportManager.getSourceUrl(), nativeDeltaClient);
|
||||
|
||||
recreateReactContextInBackground(mJavaScriptExecutorFactory, bundleLoader);
|
||||
}
|
||||
|
||||
@ThreadConfined(UI)
|
||||
|
||||
Reference in New Issue
Block a user