mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-05 09:29:07 +08:00
Evacuate part of optimized bundle logic from react code
Reviewed By: lexs Differential Revision: D3735936 fbshipit-source-id: b38960a8f25be15ccce70296980d78c0a7fa8de5
This commit is contained in:
committed by
Facebook Github Bot 8
parent
0c2fdf4b6a
commit
d3238569bf
@@ -12,9 +12,6 @@ package com.facebook.react.cxxbridge;
|
||||
import android.content.Context;
|
||||
|
||||
import com.facebook.react.devsupport.DebugServerException;
|
||||
import com.facebook.react.devsupport.DevServerHelper;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* A class that stores JS bundle information and allows {@link CatalystInstance} to load a correct
|
||||
@@ -108,20 +105,6 @@ public abstract class JSBundleLoader {
|
||||
};
|
||||
}
|
||||
|
||||
public static JSBundleLoader createUnpackingBundleLoader(
|
||||
final Context context,
|
||||
final String sourceURL,
|
||||
final String bundleName) {
|
||||
return UnpackingJSBundleLoader.newBuilder()
|
||||
.setContext(context)
|
||||
.setSourceURL(sourceURL)
|
||||
.setDestinationPath(new File(context.getFilesDir(), "optimized-bundle"))
|
||||
.checkAndUnpackFile(bundleName + ".meta", "bundle.meta")
|
||||
.unpackFile(bundleName, "bundle.js")
|
||||
.setLoadFlags(UnpackingJSBundleLoader.UNPACKED_JS_SOURCE)
|
||||
.build();
|
||||
}
|
||||
|
||||
public abstract void loadScript(CatalystInstanceImpl instance);
|
||||
public abstract String getSourceUrl();
|
||||
}
|
||||
|
||||
@@ -38,18 +38,6 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
|
||||
*/
|
||||
public class UnpackingJSBundleLoader extends JSBundleLoader {
|
||||
|
||||
/**
|
||||
* Flag passed to loadScriptFromOptimizedBundle to let the bridge know that
|
||||
* the unpacker unpacked js source file.
|
||||
*/
|
||||
public static final int UNPACKED_JS_SOURCE = (1 << 0);
|
||||
|
||||
/**
|
||||
* Flag passed to loadScriptFromOptimizedBundle to let the bridge know that
|
||||
* the unpacker unpacked bytecode cache files.
|
||||
*/
|
||||
public static final int UNPACKED_BC_CACHE = (1 << 1);
|
||||
|
||||
/**
|
||||
* Name of the lock files. Multiple processes can be spawned off the same app
|
||||
* and we need to guarantee that at most one unpacks files at any time. To
|
||||
|
||||
Reference in New Issue
Block a user