RN: Support Cached Bundles in Systrace
Summary: When running Systrace, we currently only surface the JavaScript bundle that is pre-packaged in the binary. This changes `ReactInstanceManager` so that we prefer a cached bundle if one exists. This allows running Systrace with local changes (as long as you load them into the client before running Systrace). Differential Revision: D9389704 fbshipit-source-id: 031321b2e07539efc7f47a7c6947ab7b82dc7dfc
This commit is contained in:
parent
b9c28c236b
commit
735be8b24d
|
@ -350,9 +350,7 @@ public class ReactInstanceManager {
|
|||
.logMessage(ReactDebugOverlayTags.RN_CORE, "RNCore: recreateReactContextInBackground");
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
|
||||
if (mUseDeveloperSupport
|
||||
&& mJSMainModulePath != null
|
||||
&& !Systrace.isTracing(TRACE_TAG_REACT_APPS | TRACE_TAG_REACT_JS_VM_CALLS)) {
|
||||
if (mUseDeveloperSupport && mJSMainModulePath != null) {
|
||||
final DeveloperSettings devSettings = mDevSupportManager.getDevSettings();
|
||||
|
||||
// If remote JS debugging is enabled, load from dev server.
|
||||
|
@ -361,30 +359,35 @@ public class ReactInstanceManager {
|
|||
// If there is a up-to-date bundle downloaded from server,
|
||||
// with remote JS debugging disabled, always use that.
|
||||
onJSBundleLoadedFromServer(null);
|
||||
} else if (mBundleLoader == null) {
|
||||
mDevSupportManager.handleReloadJS();
|
||||
} else {
|
||||
mDevSupportManager.isPackagerRunning(
|
||||
new PackagerStatusCallback() {
|
||||
@Override
|
||||
public void onPackagerStatusFetched(final boolean packagerIsRunning) {
|
||||
UiThreadUtil.runOnUiThread(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (packagerIsRunning) {
|
||||
mDevSupportManager.handleReloadJS();
|
||||
} else {
|
||||
// If dev server is down, disable the remote JS debugging.
|
||||
devSettings.setRemoteJSDebugEnabled(false);
|
||||
recreateReactContextInBackgroundFromBundleLoader();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Systrace.isTracing(TRACE_TAG_REACT_APPS | TRACE_TAG_REACT_JS_VM_CALLS)) {
|
||||
if (mBundleLoader == null) {
|
||||
mDevSupportManager.handleReloadJS();
|
||||
} else {
|
||||
mDevSupportManager.isPackagerRunning(
|
||||
new PackagerStatusCallback() {
|
||||
@Override
|
||||
public void onPackagerStatusFetched(final boolean packagerIsRunning) {
|
||||
UiThreadUtil.runOnUiThread(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (packagerIsRunning) {
|
||||
mDevSupportManager.handleReloadJS();
|
||||
} else {
|
||||
// If dev server is down, disable the remote JS debugging.
|
||||
devSettings.setRemoteJSDebugEnabled(false);
|
||||
recreateReactContextInBackgroundFromBundleLoader();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
recreateReactContextInBackgroundFromBundleLoader();
|
||||
|
|
Loading…
Reference in New Issue