mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-06-18 06:58:48 +08:00
Make isInspectable safe to call from any thread
Summary: The bridge was not properly isolating isInspectable onto the JS thread. Reviewed By: fkgozali Differential Revision: D14991970 fbshipit-source-id: 92a06c90bade8f92bfa81fa3b7dfb23b17db6117
This commit is contained in:
committed by
Facebook Github Bot
parent
1149d85b9f
commit
0735873fbc
@@ -84,14 +84,15 @@ private:
|
||||
};
|
||||
|
||||
NativeToJsBridge::NativeToJsBridge(
|
||||
JSExecutorFactory* jsExecutorFactory,
|
||||
JSExecutorFactory *jsExecutorFactory,
|
||||
std::shared_ptr<ModuleRegistry> registry,
|
||||
std::shared_ptr<MessageQueueThread> jsQueue,
|
||||
std::shared_ptr<InstanceCallback> callback)
|
||||
: m_destroyed(std::make_shared<bool>(false))
|
||||
, m_delegate(std::make_shared<JsToNativeBridge>(registry, callback))
|
||||
, m_executor(jsExecutorFactory->createJSExecutor(m_delegate, jsQueue))
|
||||
, m_executorMessageQueueThread(std::move(jsQueue)) {}
|
||||
: m_destroyed(std::make_shared<bool>(false)),
|
||||
m_delegate(std::make_shared<JsToNativeBridge>(registry, callback)),
|
||||
m_executor(jsExecutorFactory->createJSExecutor(m_delegate, jsQueue)),
|
||||
m_executorMessageQueueThread(std::move(jsQueue)),
|
||||
m_inspectable(m_executor->isInspectable()) {}
|
||||
|
||||
// This must be called on the same thread on which the constructor was called.
|
||||
NativeToJsBridge::~NativeToJsBridge() {
|
||||
@@ -225,7 +226,7 @@ void* NativeToJsBridge::getJavaScriptContext() {
|
||||
}
|
||||
|
||||
bool NativeToJsBridge::isInspectable() {
|
||||
return m_executor->isInspectable();
|
||||
return m_inspectable;
|
||||
}
|
||||
|
||||
bool NativeToJsBridge::isBatchActive() {
|
||||
|
||||
Reference in New Issue
Block a user