mirror of
https://github.com/status-im/react-native.git
synced 2025-02-10 16:36:25 +00:00
Make UnpackingJSBundleLoader.prepare a public API.
Reviewed By: brosenfeld Differential Revision: D4161585 fbshipit-source-id: b3b835610d11e043d2406cccff2da27f07878acc
This commit is contained in:
parent
927dcc689a
commit
c612c61544
@ -72,6 +72,11 @@ public class UnpackingJSBundleLoader extends JSBundleLoader {
|
|||||||
private final boolean mFinishOnBackgroundThread;
|
private final boolean mFinishOnBackgroundThread;
|
||||||
private final @Nullable Runnable mOnUnpackedCallback;
|
private final @Nullable Runnable mOnUnpackedCallback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True if prepare was called.
|
||||||
|
*/
|
||||||
|
private boolean mPrepared;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Synchronizes unpacking within this process.
|
* Synchronizes unpacking within this process.
|
||||||
*/
|
*/
|
||||||
@ -96,13 +101,20 @@ public class UnpackingJSBundleLoader extends JSBundleLoader {
|
|||||||
mFinishOnBackgroundThread = builder.finishOnBackgroundThread;
|
mFinishOnBackgroundThread = builder.finishOnBackgroundThread;
|
||||||
mOnUnpackedCallback = builder.callback;
|
mOnUnpackedCallback = builder.callback;
|
||||||
mFileLocker = null;
|
mFileLocker = null;
|
||||||
|
mPrepared = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if any file needs to be extracted again, and if so, clears the destination
|
* Checks if any file needs to be extracted again, and if so, clears the destination
|
||||||
* directory and unpacks everything again.
|
* directory and unpacks everything again.
|
||||||
|
*
|
||||||
|
* This method does not do anything if called for the second time
|
||||||
*/
|
*/
|
||||||
/* package */ void prepare() {
|
public synchronized void prepare() {
|
||||||
|
if (mPrepared) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ReactMarker.logMarker(ReactMarkerConstants.UNPACKER_CHECK_START);
|
ReactMarker.logMarker(ReactMarkerConstants.UNPACKER_CHECK_START);
|
||||||
|
|
||||||
boolean unpacked = false;
|
boolean unpacked = false;
|
||||||
@ -131,6 +143,8 @@ public class UnpackingJSBundleLoader extends JSBundleLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReactMarker.logMarker(ReactMarkerConstants.UNPACKER_CHECK_END);
|
ReactMarker.logMarker(ReactMarkerConstants.UNPACKER_CHECK_END);
|
||||||
|
|
||||||
|
mPrepared = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean prepareLocked() throws IOException {
|
private boolean prepareLocked() throws IOException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user