mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Use xplat-init for internal builds (#42738)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/42738 Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D53087308 fbshipit-source-id: a1d9365fe74ada58d94719a8598134a1a6cd6067
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b7025fe156
commit
c1c1f0d6b9
@@ -10,7 +10,6 @@
|
||||
#include <glog/logging.h>
|
||||
|
||||
#include <fb/glog_init.h>
|
||||
#include <fb/log.h>
|
||||
#include <fbjni/fbjni.h>
|
||||
|
||||
#include "CatalystInstanceImpl.h"
|
||||
@@ -27,27 +26,29 @@
|
||||
#define WITH_GLOGINIT 1
|
||||
#endif
|
||||
|
||||
using namespace facebook::jni;
|
||||
#ifdef WITH_XPLATINIT
|
||||
#include <fb/xplat_init.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
namespace {
|
||||
|
||||
struct JavaJSExecutor : public JavaClass<JavaJSExecutor> {
|
||||
struct JavaJSExecutor : public jni::JavaClass<JavaJSExecutor> {
|
||||
static constexpr auto kJavaDescriptor =
|
||||
"Lcom/facebook/react/bridge/JavaJSExecutor;";
|
||||
};
|
||||
|
||||
class ProxyJavaScriptExecutorHolder : public HybridClass<
|
||||
ProxyJavaScriptExecutorHolder,
|
||||
JavaScriptExecutorHolder> {
|
||||
class ProxyJavaScriptExecutorHolder
|
||||
: public jni::
|
||||
HybridClass<ProxyJavaScriptExecutorHolder, JavaScriptExecutorHolder> {
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor =
|
||||
"Lcom/facebook/react/bridge/ProxyJavaScriptExecutor;";
|
||||
|
||||
static local_ref<jhybriddata> initHybrid(
|
||||
alias_ref<jclass>,
|
||||
alias_ref<JavaJSExecutor::javaobject> executorInstance) {
|
||||
static jni::local_ref<jhybriddata> initHybrid(
|
||||
jni::alias_ref<jclass>,
|
||||
jni::alias_ref<JavaJSExecutor::javaobject> executorInstance) {
|
||||
return makeCxxInstance(std::make_shared<ProxyExecutorOneTimeFactory>(
|
||||
make_global(executorInstance)));
|
||||
}
|
||||
@@ -67,11 +68,16 @@ class ProxyJavaScriptExecutorHolder : public HybridClass<
|
||||
} // namespace
|
||||
|
||||
extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
|
||||
return initialize(vm, [] {
|
||||
#ifdef WITH_XPLATINIT
|
||||
return facebook::xplat::initialize(vm, [] {
|
||||
#else
|
||||
return jni::initialize(vm, [] {
|
||||
#endif
|
||||
#if WITH_GLOGINIT
|
||||
gloginit::initialize();
|
||||
FLAGS_minloglevel = 0;
|
||||
#endif
|
||||
|
||||
ProxyJavaScriptExecutorHolder::registerNatives();
|
||||
CatalystInstanceImpl::registerNatives();
|
||||
CxxModuleWrapperBase::registerNatives();
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and 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 <jni.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
jmethodID getLogMarkerMethod();
|
||||
|
||||
} // namespace facebook::react
|
||||
@@ -11,10 +11,7 @@
|
||||
#include <cxxreact/ModuleRegistry.h>
|
||||
#include <cxxreact/SystraceSection.h>
|
||||
#include <fb/assert.h>
|
||||
// #include <fb/Environment.h>
|
||||
#include <folly/json.h>
|
||||
// #include <jni/LocalReference.h>
|
||||
// #include <jni/LocalString.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <cxxreact/RAMBundleRegistry.h>
|
||||
#include <fbjni/fbjni.h>
|
||||
#include <jni.h>
|
||||
#include "OnLoad.h"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user