mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-06-13 18:56:40 +08:00
Support passing native modules to JSContext
Reviewed By: amnn Differential Revision: D4561036 fbshipit-source-id: b096a222103e895b14cba1ec5b2bb6e72dd72c37
This commit is contained in:
committed by
Facebook Github Bot
parent
bacee5ad56
commit
7e4b8ff000
@@ -95,9 +95,13 @@ NativeToJsBridge::NativeToJsBridge(
|
||||
std::shared_ptr<InstanceCallback> callback)
|
||||
: m_destroyed(std::make_shared<bool>(false))
|
||||
, m_mainExecutorToken(callback->createExecutorToken())
|
||||
, m_delegate(
|
||||
std::make_shared<JsToNativeBridge>(
|
||||
this, registry, std::move(nativeQueue), callback)) {
|
||||
, m_delegate(registry
|
||||
? std::make_shared<JsToNativeBridge>(
|
||||
this, registry, std::move(nativeQueue), callback)
|
||||
: nullptr) {
|
||||
if (!m_delegate) {
|
||||
nativeQueue->quitSynchronous();
|
||||
}
|
||||
std::unique_ptr<JSExecutor> mainExecutor =
|
||||
jsExecutorFactory->createJSExecutor(m_delegate, jsQueue);
|
||||
// cached to avoid locked map lookup in the common case
|
||||
@@ -314,7 +318,9 @@ ExecutorToken NativeToJsBridge::getTokenForExecutor(JSExecutor& executor) {
|
||||
}
|
||||
|
||||
void NativeToJsBridge::destroy() {
|
||||
m_delegate->quitQueueSynchronous();
|
||||
if (m_delegate) {
|
||||
m_delegate->quitQueueSynchronous();
|
||||
}
|
||||
auto* executorMessageQueueThread = getMessageQueueThread(m_mainExecutorToken);
|
||||
// All calls made through runOnExecutorQueue have an early exit if
|
||||
// m_destroyed is true. Setting this before the runOnQueueSync will cause
|
||||
|
||||
Reference in New Issue
Block a user