10
10
#include < glog/logging.h>
11
11
12
12
#include < fb/glog_init.h>
13
- #include < fb/log.h>
14
13
#include < fbjni/fbjni.h>
15
14
16
15
#include " CatalystInstanceImpl.h"
27
26
#define WITH_GLOGINIT 1
28
27
#endif
29
28
30
- using namespace facebook ::jni;
29
+ #ifdef WITH_XPLATINIT
30
+ #include < fb/xplat_init.h>
31
+ #endif
31
32
32
33
namespace facebook ::react {
33
34
34
35
namespace {
35
36
36
- struct JavaJSExecutor : public JavaClass <JavaJSExecutor> {
37
+ struct JavaJSExecutor : public jni :: JavaClass<JavaJSExecutor> {
37
38
static constexpr auto kJavaDescriptor =
38
39
" Lcom/facebook/react/bridge/JavaJSExecutor;" ;
39
40
};
40
41
41
- class ProxyJavaScriptExecutorHolder : public HybridClass <
42
- ProxyJavaScriptExecutorHolder,
43
- JavaScriptExecutorHolder> {
42
+ class ProxyJavaScriptExecutorHolder
43
+ : public jni::
44
+ HybridClass<ProxyJavaScriptExecutorHolder, JavaScriptExecutorHolder> {
44
45
public:
45
46
static constexpr auto kJavaDescriptor =
46
47
" Lcom/facebook/react/bridge/ProxyJavaScriptExecutor;" ;
47
48
48
- static local_ref<jhybriddata> initHybrid (
49
- alias_ref<jclass>,
50
- alias_ref<JavaJSExecutor::javaobject> executorInstance) {
49
+ static jni:: local_ref<jhybriddata> initHybrid (
50
+ jni:: alias_ref<jclass>,
51
+ jni:: alias_ref<JavaJSExecutor::javaobject> executorInstance) {
51
52
return makeCxxInstance (std::make_shared<ProxyExecutorOneTimeFactory>(
52
53
make_global (executorInstance)));
53
54
}
@@ -67,11 +68,16 @@ class ProxyJavaScriptExecutorHolder : public HybridClass<
67
68
} // namespace
68
69
69
70
extern " C" JNIEXPORT jint JNI_OnLoad (JavaVM* vm, void * reserved) {
70
- return initialize (vm, [] {
71
+ #ifdef WITH_XPLATINIT
72
+ return facebook::xplat::initialize (vm, [] {
73
+ #else
74
+ return jni::initialize (vm, [] {
75
+ #endif
71
76
#if WITH_GLOGINIT
72
77
gloginit::initialize ();
73
78
FLAGS_minloglevel = 0 ;
74
79
#endif
80
+
75
81
ProxyJavaScriptExecutorHolder::registerNatives ();
76
82
CatalystInstanceImpl::registerNatives ();
77
83
CxxModuleWrapperBase::registerNatives ();
0 commit comments