mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
5be44456f2
Summary: This is to prepare for enabling TurboModule on Android. This commit compiles in all the core files (C++) into the ReactAndroid NDK build step. This doesn't yet enable TurboModule by default, just compiling in the infra, just like for iOS. New shared libs: * libreact_nativemodule_core.so: The TurboModule Android core * libreact_nativemodule_manager.so: The TurboModule manager/delegate To be compatible with `<ReactCommon/` .h include prefix, the files had to move to local `ReactCommon` subdirs. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D23805717 fbshipit-source-id: b41c392a592dd095ae003f7b2a689f4add2c37a9
59 lines
1.3 KiB
C++
59 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <ReactCommon/TurboModule.h>
|
|
#include <jsi/jsi.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
class JSCallInvoker;
|
|
|
|
/**
|
|
* Represents the JavaScript binding for the TurboModule system.
|
|
*/
|
|
class TurboModuleBinding {
|
|
public:
|
|
/*
|
|
* Installs TurboModuleBinding into JavaScript runtime.
|
|
* Thread synchronization must be enforced externally.
|
|
*/
|
|
static void install(
|
|
jsi::Runtime &runtime,
|
|
const TurboModuleProviderFunctionType &&moduleProvider);
|
|
|
|
TurboModuleBinding(const TurboModuleProviderFunctionType &&moduleProvider);
|
|
virtual ~TurboModuleBinding();
|
|
|
|
/**
|
|
* Get an TurboModule instance for the given module name.
|
|
*/
|
|
std::shared_ptr<TurboModule> getModule(
|
|
const std::string &name,
|
|
const jsi::Value *schema);
|
|
|
|
private:
|
|
/**
|
|
* A lookup function exposed to JS to get an instance of a TurboModule
|
|
* for the given name.
|
|
*/
|
|
jsi::Value jsProxy(
|
|
jsi::Runtime &runtime,
|
|
const jsi::Value &thisVal,
|
|
const jsi::Value *args,
|
|
size_t count);
|
|
|
|
TurboModuleProviderFunctionType moduleProvider_;
|
|
};
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|