@@ -31,22 +31,12 @@ struct MultithreadingModule : jni::JavaClass<MultithreadingModule> {
3131
3232private:
3333 static std::shared_ptr<react::JSExecutorFactory> makeJSExecutorFactory () {
34- std::shared_ptr<react::JSExecutorFactory> factory;
35-
36- ThreadScope::WithClassLoader ([&factory]() {
37- __android_log_write (ANDROID_LOG_INFO, TAG, " Calling Java method MultithreadingModule.makeJSExecutor()..." );
38- static const auto cls = javaClassStatic ();
39- static const auto method = cls->getStaticMethod <react::JavaScriptExecutorHolder ()>(" makeJSExecutor" );
40- auto result = method (cls);
41- __android_log_write (ANDROID_LOG_INFO, TAG, " JavaScriptExecutor created! Getting factory..." );
42- auto cxxInstance = result->cthis ()->getExecutorFactory ();
43- factory = cxxInstance;
44- });
45- if (factory == nullptr ) {
46- throw std::runtime_error (" Failed to create the JSExecutorFactory! shared_ptr was null." );
47- }
48-
49- return factory;
34+ __android_log_write (ANDROID_LOG_INFO, TAG, " Calling Java method MultithreadingModule.makeJSExecutor()..." );
35+ static const auto cls = javaClassStatic ();
36+ static const auto method = cls->getStaticMethod <react::JavaScriptExecutorHolder ()>(" makeJSExecutor" );
37+ auto result = method (cls);
38+ __android_log_write (ANDROID_LOG_INFO, TAG, " JavaScriptExecutor created! Getting factory..." );
39+ return result->cthis ()->getExecutorFactory ();
5040 }
5141
5242 static void installNative (jni::alias_ref<JClass>,
@@ -69,9 +59,6 @@ struct MultithreadingModule : jni::JavaClass<MultithreadingModule> {
6959 auto makeJsExecutor = []() -> std::unique_ptr<jsi::Runtime> {
7060 __android_log_write (ANDROID_LOG_INFO, TAG, " Creating JSExecutorFactory.." );
7161 try {
72- // JNI needs to attach this thread because this function is being called from a different Thread
73- __unused ThreadScope scope; // RAII
74-
7562 std::shared_ptr<react::ExecutorDelegate> delegate = std::shared_ptr<react::ExecutorDelegate>();
7663 std::shared_ptr<react::MessageQueueThread> jsQueue = std::shared_ptr<react::MessageQueueThread>();
7764
0 commit comments