mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 01:40:08 +00:00
Remove Native Extensions
Reviewed By: michalgr Differential Revision: D8057885 fbshipit-source-id: 6af7f7729201d26a704adaadb15813979cd035f8
This commit is contained in:
parent
782971f60e
commit
7c5845a5a2
@ -338,7 +338,6 @@ struct RCTInstanceCallback : public InstanceCallback {
|
||||
#if RCT_PROFILE
|
||||
("StartSamplingProfilerOnInit", (bool)self.devSettings.startSamplingProfilerOnLaunch)
|
||||
#endif
|
||||
, nullptr
|
||||
));
|
||||
}
|
||||
} else {
|
||||
|
@ -113,9 +113,9 @@ void injectJSCExecutorAndroidPlatform() {
|
||||
}
|
||||
|
||||
std::unique_ptr<JSExecutorFactory> makeAndroidJSCExecutorFactory(
|
||||
const folly::dynamic& jscConfig, NativeExtensionsProvider nativeExtensionsProvider) {
|
||||
const folly::dynamic& jscConfig) {
|
||||
detail::injectJSCExecutorAndroidPlatform();
|
||||
return folly::make_unique<JSCExecutorFactory>(std::move(jscConfig), std::move(nativeExtensionsProvider));
|
||||
return folly::make_unique<JSCExecutorFactory>(std::move(jscConfig));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ void injectJSCExecutorAndroidPlatform();
|
||||
}
|
||||
|
||||
std::unique_ptr<JSExecutorFactory> makeAndroidJSCExecutorFactory(
|
||||
const folly::dynamic& jscConfig, NativeExtensionsProvider nativeExtensionsProvider);
|
||||
const folly::dynamic& jscConfig);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class JSCJavaScriptExecutorHolder : public HybridClass<JSCJavaScriptExecutorHold
|
||||
static constexpr auto kJavaDescriptor = "Lcom/facebook/react/bridge/JSCJavaScriptExecutor;";
|
||||
|
||||
static local_ref<jhybriddata> initHybrid(alias_ref<jclass>, ReadableNativeMap* jscConfig) {
|
||||
return makeCxxInstance(makeAndroidJSCExecutorFactory(jscConfig->consume(), nullptr));
|
||||
return makeCxxInstance(makeAndroidJSCExecutorFactory(jscConfig->consume()));
|
||||
}
|
||||
|
||||
static void registerNatives() {
|
||||
|
@ -120,19 +120,17 @@ std::unique_ptr<JSExecutor> JSCExecutorFactory::createJSExecutor(
|
||||
std::shared_ptr<ExecutorDelegate> delegate,
|
||||
std::shared_ptr<MessageQueueThread> jsQueue) {
|
||||
return folly::make_unique<JSCExecutor>(
|
||||
delegate, jsQueue, m_jscConfig, m_nativeExtensionsProvider);
|
||||
delegate, jsQueue, m_jscConfig);
|
||||
}
|
||||
|
||||
JSCExecutor::JSCExecutor(
|
||||
std::shared_ptr<ExecutorDelegate> delegate,
|
||||
std::shared_ptr<MessageQueueThread> messageQueueThread,
|
||||
const folly::dynamic& jscConfig,
|
||||
NativeExtensionsProvider nativeExtensionsProvider) throw(JSException)
|
||||
const folly::dynamic& jscConfig) throw(JSException)
|
||||
: m_delegate(delegate),
|
||||
m_messageQueueThread(messageQueueThread),
|
||||
m_nativeModules(delegate ? delegate->getModuleRegistry() : nullptr),
|
||||
m_jscConfig(jscConfig),
|
||||
m_nativeExtensionsProvider(nativeExtensionsProvider) {
|
||||
m_jscConfig(jscConfig) {
|
||||
initOnJSVMThread();
|
||||
|
||||
{
|
||||
@ -142,12 +140,6 @@ JSCExecutor::JSCExecutor(
|
||||
"nativeModuleProxy",
|
||||
exceptionWrapMethod<&JSCExecutor::getNativeModule>());
|
||||
}
|
||||
if (nativeExtensionsProvider) {
|
||||
installGlobalProxy(
|
||||
m_context,
|
||||
"nativeExtensions",
|
||||
exceptionWrapMethod<&JSCExecutor::getNativeExtension>());
|
||||
}
|
||||
}
|
||||
|
||||
JSCExecutor::~JSCExecutor() {
|
||||
@ -732,17 +724,6 @@ JSValueRef JSCExecutor::getNativeModule(
|
||||
return m_nativeModules.getModule(m_context, propertyName);
|
||||
}
|
||||
|
||||
JSValueRef JSCExecutor::getNativeExtension(
|
||||
JSObjectRef object,
|
||||
JSStringRef propertyName) {
|
||||
if (m_nativeExtensionsProvider) {
|
||||
folly::dynamic value =
|
||||
m_nativeExtensionsProvider(String::ref(m_context, propertyName).str());
|
||||
return Value::fromDynamic(m_context, std::move(value));
|
||||
}
|
||||
return JSC_JSValueMakeUndefined(m_context);
|
||||
}
|
||||
|
||||
JSValueRef JSCExecutor::nativeRequire(
|
||||
size_t count,
|
||||
const JSValueRef arguments[]) {
|
||||
|
@ -27,15 +27,14 @@ class RAMBundleRegistry;
|
||||
|
||||
class RN_EXPORT JSCExecutorFactory : public JSExecutorFactory {
|
||||
public:
|
||||
JSCExecutorFactory(const folly::dynamic& jscConfig, NativeExtensionsProvider provider) :
|
||||
m_jscConfig(jscConfig), m_nativeExtensionsProvider(provider) {}
|
||||
JSCExecutorFactory(const folly::dynamic& jscConfig) :
|
||||
m_jscConfig(jscConfig) {}
|
||||
std::unique_ptr<JSExecutor> createJSExecutor(
|
||||
std::shared_ptr<ExecutorDelegate> delegate,
|
||||
std::shared_ptr<MessageQueueThread> jsQueue) override;
|
||||
private:
|
||||
std::string m_cacheDir;
|
||||
folly::dynamic m_jscConfig;
|
||||
NativeExtensionsProvider m_nativeExtensionsProvider;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
@ -59,8 +58,7 @@ public:
|
||||
*/
|
||||
explicit JSCExecutor(std::shared_ptr<ExecutorDelegate> delegate,
|
||||
std::shared_ptr<MessageQueueThread> messageQueueThread,
|
||||
const folly::dynamic& jscConfig,
|
||||
NativeExtensionsProvider nativeExtensionsProvider) throw(JSException);
|
||||
const folly::dynamic& jscConfig) throw(JSException);
|
||||
~JSCExecutor() override;
|
||||
|
||||
virtual void loadApplicationScript(
|
||||
@ -104,7 +102,6 @@ private:
|
||||
JSCNativeModules m_nativeModules;
|
||||
folly::dynamic m_jscConfig;
|
||||
std::once_flag m_bindFlag;
|
||||
NativeExtensionsProvider m_nativeExtensionsProvider;
|
||||
|
||||
folly::Optional<Object> m_invokeCallbackAndReturnFlushedQueueJS;
|
||||
folly::Optional<Object> m_callFunctionReturnFlushedQueueJS;
|
||||
@ -126,7 +123,6 @@ private:
|
||||
void installNativeHook(const char* name);
|
||||
|
||||
JSValueRef getNativeModule(JSObjectRef object, JSStringRef propertyName);
|
||||
JSValueRef getNativeExtension(JSObjectRef object, JSStringRef propertyName);
|
||||
|
||||
JSValueRef nativeRequire(
|
||||
size_t argumentCount,
|
||||
|
Loading…
x
Reference in New Issue
Block a user