mirror of
https://github.com/status-im/react-native.git
synced 2025-02-27 00:20:31 +00:00
JSBundleLoader
: allow to load with delta client
Summary: Adds glue between `CatalystInstance` and `JSBundleLoader`: Adds the possibility to create a `JSBundleLoader` instance that calls into `CatalystInstanceImpl#loadScriptFromDeltaBundle(...)`. Reviewed By: fromcelticpark Differential Revision: D7845134 fbshipit-source-id: 9585b44a6e7c63245c9f634543642be55c928896
This commit is contained in:
parent
3e730528ee
commit
8f85abdb14
@ -8,6 +8,7 @@
|
||||
package com.facebook.react.bridge;
|
||||
|
||||
import android.content.Context;
|
||||
import com.facebook.react.bridge.NativeDeltaClient;
|
||||
import com.facebook.react.common.DebugServerException;
|
||||
|
||||
/**
|
||||
@ -78,6 +79,28 @@ public abstract class JSBundleLoader {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This loader is used to load delta bundles from the dev server. We pass each delta message to
|
||||
* the loader and process it in C++. Passing it as a string leads to inefficiencies due to memory
|
||||
* copies, which will have to be addressed in a follow-up.
|
||||
* @param nativeDeltaClient
|
||||
*/
|
||||
public static JSBundleLoader createDeltaFromNetworkLoader(
|
||||
final String sourceURL,
|
||||
final NativeDeltaClient nativeDeltaClient) {
|
||||
return new JSBundleLoader() {
|
||||
@Override
|
||||
public String loadScript(CatalystInstanceImpl instance) {
|
||||
try {
|
||||
instance.loadScriptFromDeltaBundle(sourceURL, nativeDeltaClient, false);
|
||||
return sourceURL;
|
||||
} catch (Exception e) {
|
||||
throw DebugServerException.makeGeneric(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This loader is used when proxy debugging is enabled. In that case there is no point in fetching
|
||||
* the bundle from device as remote executor will have to do it anyway.
|
||||
|
Loading…
x
Reference in New Issue
Block a user