diff --git a/ReactAndroid/src/main/jni/react/JSCWebWorker.cpp b/ReactAndroid/src/main/jni/react/JSCWebWorker.cpp index 91895b800..62902fcf0 100644 --- a/ReactAndroid/src/main/jni/react/JSCWebWorker.cpp +++ b/ReactAndroid/src/main/jni/react/JSCWebWorker.cpp @@ -35,7 +35,7 @@ JSCWebWorker::JSCWebWorker(int id, JSCWebWorkerOwner *owner, std::string scriptS owner_(owner) { ownerMessageQueueThread_ = owner->getMessageQueueThread(); CHECK(ownerMessageQueueThread_) << "Owner MessageQueue must not be null"; - workerMessageQueueThread_ = WebWorkers::createWebWorkerThread(id, ownerMessageQueueThread_.get()); + workerMessageQueueThread_ = WebWorkerUtil::createWebWorkerThread(id, ownerMessageQueueThread_.get()); CHECK(workerMessageQueueThread_) << "Failed to create worker thread"; workerMessageQueueThread_->runOnQueue([this] () { diff --git a/ReactAndroid/src/main/jni/react/Platform.cpp b/ReactAndroid/src/main/jni/react/Platform.cpp index d91cfcaeb..03edca72c 100644 --- a/ReactAndroid/src/main/jni/react/Platform.cpp +++ b/ReactAndroid/src/main/jni/react/Platform.cpp @@ -14,6 +14,7 @@ GetCurrentMessageQueueThread getCurrentMessageQueueThread; }; namespace WebWorkerUtil { +WebWorkerQueueFactory createWebWorkerThread; LoadScriptFromAssets loadScriptFromAssets; }; diff --git a/ReactAndroid/src/main/jni/react/Platform.h b/ReactAndroid/src/main/jni/react/Platform.h index 4fa42591a..c5c1c5043 100644 --- a/ReactAndroid/src/main/jni/react/Platform.h +++ b/ReactAndroid/src/main/jni/react/Platform.h @@ -24,6 +24,9 @@ extern GetCurrentMessageQueueThread getCurrentMessageQueueThread; }; namespace WebWorkerUtil { +using WebWorkerQueueFactory = std::function(int id, MessageQueueThread* ownerMessageQueue)>; +extern WebWorkerQueueFactory createWebWorkerThread; + using LoadScriptFromAssets = std::function; extern LoadScriptFromAssets loadScriptFromAssets; }; diff --git a/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp b/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp index 10f1399f2..2617fae7c 100644 --- a/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp +++ b/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp @@ -24,6 +24,7 @@ #include "JMessageQueueThread.h" #include "JSLogging.h" #include "JSCPerfLogging.h" +#include "WebWorkers.h" #include #ifdef WITH_FBSYSTRACE @@ -839,6 +840,7 @@ extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { return initialize(vm, [] { // Inject some behavior into react/ ReactMarker::logMarker = bridge::logMarker; + WebWorkerUtil::createWebWorkerThread = WebWorkers::createWebWorkerThread; WebWorkerUtil::loadScriptFromAssets = [] (const std::string& assetName) { return loadScriptFromAssets(assetName);