mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-06-18 22:05:06 +08:00
Remove JsToNativeBridge's nativeQueue
Reviewed By: mhorowitz Differential Revision: D4589737 fbshipit-source-id: 3b2730417d99c4f98cfaad386bc50328f2551592
This commit is contained in:
committed by
Facebook Github Bot
parent
fbf6d1aaeb
commit
d7b37c4050
@@ -33,24 +33,14 @@ void Instance::initializeBridge(
|
||||
std::unique_ptr<InstanceCallback> callback,
|
||||
std::shared_ptr<JSExecutorFactory> jsef,
|
||||
std::shared_ptr<MessageQueueThread> jsQueue,
|
||||
std::unique_ptr<MessageQueueThread> nativeQueue,
|
||||
std::shared_ptr<ModuleRegistry> moduleRegistry) {
|
||||
callback_ = std::move(callback);
|
||||
|
||||
if (!nativeQueue) {
|
||||
// TODO pass down a thread/queue from java, instead of creating our own.
|
||||
|
||||
auto queue = folly::make_unique<CxxMessageQueue>();
|
||||
std::thread t(queue->getUnregisteredRunLoop());
|
||||
t.detach();
|
||||
nativeQueue = std::move(queue);
|
||||
}
|
||||
|
||||
jsQueue->runOnQueueSync(
|
||||
[this, &jsef, moduleRegistry, jsQueue,
|
||||
nativeQueue=folly::makeMoveWrapper(std::move(nativeQueue))] () mutable {
|
||||
[this, &jsef, moduleRegistry, jsQueue] () mutable {
|
||||
nativeToJsBridge_ = folly::make_unique<NativeToJsBridge>(
|
||||
jsef.get(), moduleRegistry, jsQueue, nativeQueue.move(), callback_);
|
||||
jsef.get(), moduleRegistry, jsQueue, callback_);
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_syncMutex);
|
||||
m_syncReady = true;
|
||||
|
||||
Reference in New Issue
Block a user