Refactor: In JavaTurboModule, use jobject to hold module object

Summary:
## Rationale
JavaTurboModule holds the module object as a JTurboModule. With the TurboModule inteorp layer, JavaTurboModule will also need to hold NativeModule objects.

## Changes
So, this diff makes JavaTurboModule hold the module object as a jobject instead.

This shouldn't impact method dispatch, because method dispatch doesn't rely on the JTurboModule interface.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D43918939

fbshipit-source-id: 7cc43dfe2df7571e39bcf4d6f362dde0e500e2fe
This commit is contained in:
Ramanpreet Nara 2023-03-11 16:59:39 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 43ef2ffe78
Коммит cfa03db98b
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -30,7 +30,7 @@ class JSI_EXPORT JavaTurboModule : public TurboModule {
// TODO(T65603471): Should we unify this with a Fabric abstraction?
struct InitParams {
std::string moduleName;
jni::alias_ref<JTurboModule> instance;
jni::alias_ref<jobject> instance;
std::shared_ptr<CallInvoker> jsInvoker;
std::shared_ptr<CallInvoker> nativeInvoker;
};
@ -48,7 +48,8 @@ class JSI_EXPORT JavaTurboModule : public TurboModule {
jmethodID &cachedMethodID);
private:
jni::global_ref<JTurboModule> instance_;
// instance_ can be of type JTurboModule, or JNativeModule
jni::global_ref<jobject> instance_;
std::shared_ptr<CallInvoker> nativeInvoker_;
};