Move thread jump for js loading into NativeToJSBridge, out of platform code

Reviewed By: javache

Differential Revision: D3906009

fbshipit-source-id: b9782a6c209e3c1626899dac7fd50233cdef87f3
This commit is contained in:
Marc Horowitz
2016-09-26 16:01:38 -07:00
committed by Facebook Github Bot 7
parent 72e203bf95
commit 971cda8794
6 changed files with 28 additions and 62 deletions

View File

@@ -18,8 +18,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import android.app.Activity;
import android.app.Application;
@@ -924,33 +922,8 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
catalystInstance.addBridgeIdleDebugListener(mBridgeIdleDebugListener);
}
ReactMarker.logMarker(RUN_JS_BUNDLE_START);
try {
catalystInstance.getReactQueueConfiguration().getJSQueueThread().callOnQueue(
new Callable<Void>() {
@Override
public Void call() throws Exception {
reactContext.initializeWithInstance(catalystInstance);
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "runJSBundle");
try {
catalystInstance.runJSBundle();
} finally {
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
ReactMarker.logMarker(RUN_JS_BUNDLE_END);
}
return null;
}
}).get();
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (ExecutionException e) {
if (e.getCause() instanceof RuntimeException) {
throw (RuntimeException) e.getCause();
} else {
throw new RuntimeException(e);
}
}
reactContext.initializeWithInstance(catalystInstance);
catalystInstance.runJSBundle();
return reactContext;
}