mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Move ReactMarker to reactnativejni_common as it's used in NewArch also (#50471)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50471 ReactMarker is currently loading the whole `reactnativejni` which we should not be loading in NewArch. This is resulting in a warning fired for all the NewArch users with `legacyWarningsEnabled`. I'm cleaning this up by moving it inside `reactnativejni_common`. Changelog: [Internal] [Changed] - Move ReactMarker to `reactnativejni_common` as it's used in NewArch also Reviewed By: javache Differential Revision: D72384347 fbshipit-source-id: 83965c3e4eb7847184856485d1cc1c478b2888d5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
280caaecfd
commit
87e78ec75d
-1
@@ -35,7 +35,6 @@ internal object BridgeSoLoader {
|
||||
|
||||
@get:JvmStatic
|
||||
@get:JvmName("isInitialized")
|
||||
@Volatile
|
||||
var initialized: Boolean = false
|
||||
private set
|
||||
}
|
||||
|
||||
+1
-2
@@ -9,7 +9,6 @@ package com.facebook.react.bridge
|
||||
|
||||
import com.facebook.jni.HybridClassBase
|
||||
import com.facebook.proguard.annotations.DoNotStripAny
|
||||
import com.facebook.soloader.SoLoader
|
||||
|
||||
/**
|
||||
* An implementation of [Dynamic] that has a C++ implementation.
|
||||
@@ -49,7 +48,7 @@ private class DynamicNative : HybridClassBase(), Dynamic {
|
||||
|
||||
private companion object {
|
||||
init {
|
||||
SoLoader.loadLibrary("reactnativejni_common")
|
||||
ReactNativeJniCommonSoLoader.staticInit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -9,7 +9,6 @@ package com.facebook.react.bridge
|
||||
|
||||
import com.facebook.jni.HybridClassBase
|
||||
import com.facebook.proguard.annotations.DoNotStrip
|
||||
import com.facebook.soloader.SoLoader
|
||||
|
||||
/** Base class for an array whose members are stored in native code (C++). */
|
||||
@DoNotStrip
|
||||
@@ -20,7 +19,7 @@ public abstract class NativeArray protected constructor() :
|
||||
|
||||
private companion object {
|
||||
init {
|
||||
SoLoader.loadLibrary("reactnativejni_common")
|
||||
ReactNativeJniCommonSoLoader.staticInit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -9,7 +9,6 @@ package com.facebook.react.bridge
|
||||
|
||||
import com.facebook.jni.HybridClassBase
|
||||
import com.facebook.proguard.annotations.DoNotStrip
|
||||
import com.facebook.soloader.SoLoader
|
||||
|
||||
/** Base class for a Map whose keys and values are stored in native code (C++). */
|
||||
@DoNotStrip
|
||||
@@ -18,7 +17,7 @@ public abstract class NativeMap : HybridClassBase() {
|
||||
|
||||
private companion object {
|
||||
init {
|
||||
SoLoader.loadLibrary("reactnativejni_common")
|
||||
ReactNativeJniCommonSoLoader.staticInit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -211,7 +211,7 @@ public class ReactMarker {
|
||||
now = SystemClock.uptimeMillis();
|
||||
}
|
||||
|
||||
if (BridgeSoLoader.isInitialized()) {
|
||||
if (ReactNativeJniCommonSoLoader.isInitialized()) {
|
||||
// First send the current marker
|
||||
nativeLogMarker(name.name(), now);
|
||||
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.facebook.react.bridge
|
||||
|
||||
import com.facebook.soloader.SoLoader
|
||||
|
||||
internal object ReactNativeJniCommonSoLoader {
|
||||
|
||||
@JvmStatic
|
||||
@Synchronized
|
||||
fun staticInit() {
|
||||
if (initialized) {
|
||||
return
|
||||
}
|
||||
ReactMarker.logMarker(ReactMarkerConstants.LOAD_REACT_NATIVE_SO_FILE_START)
|
||||
SoLoader.loadLibrary("reactnativejni_common")
|
||||
ReactMarker.logMarker(ReactMarkerConstants.LOAD_REACT_NATIVE_SO_FILE_END)
|
||||
initialized = true
|
||||
}
|
||||
|
||||
@get:JvmStatic
|
||||
@get:JvmName("isInitialized")
|
||||
@Volatile
|
||||
var initialized: Boolean = false
|
||||
private set
|
||||
}
|
||||
+1
-1
@@ -62,7 +62,7 @@ public object LegacyArchitectureLogger {
|
||||
}
|
||||
LegacyArchitectureLogLevel.WARNING -> {
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
tag, ReactNoCrashSoftException("$name $exceptionMessage."))
|
||||
tag, ReactNoCrashSoftException("$name $exceptionMessage"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,11 @@ add_library(
|
||||
reactnativejni_common
|
||||
OBJECT
|
||||
JDynamicNative.cpp
|
||||
JReactMarker.cpp
|
||||
NativeArray.cpp
|
||||
NativeCommon.cpp
|
||||
NativeMap.cpp
|
||||
OnLoad-common.cpp
|
||||
OnLoad-common.cpp
|
||||
ReadableNativeArray.cpp
|
||||
ReadableNativeMap.cpp
|
||||
WritableNativeArray.cpp
|
||||
@@ -36,7 +37,7 @@ add_library(
|
||||
target_merge_so(reactnativejni_common)
|
||||
target_include_directories(reactnativejni_common PUBLIC ../../)
|
||||
|
||||
target_link_libraries(reactnativejni_common fbjni folly_runtime)
|
||||
target_link_libraries(reactnativejni_common fbjni folly_runtime react_cxxreact)
|
||||
target_compile_reactnative_options(reactnativejni_common PRIVATE)
|
||||
target_compile_options(reactnativejni_common PRIVATE -Wno-unused-lambda-capture)
|
||||
|
||||
@@ -55,7 +56,6 @@ add_library(
|
||||
JInspector.cpp
|
||||
JMessageQueueThread.cpp
|
||||
JReactCxxErrorHandler.cpp
|
||||
JReactMarker.cpp
|
||||
JReactSoftExceptionLogger.cpp
|
||||
JRuntimeExecutor.cpp
|
||||
JRuntimeScheduler.cpp
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <fbjni/fbjni.h>
|
||||
#include "JCallback.h"
|
||||
#include "JDynamicNative.h"
|
||||
#include "JReactMarker.h"
|
||||
#include "NativeArray.h"
|
||||
#include "NativeMap.h"
|
||||
#include "WritableNativeArray.h"
|
||||
@@ -19,6 +20,7 @@ extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
|
||||
return facebook::jni::initialize(vm, [] {
|
||||
JCxxCallbackImpl::registerNatives();
|
||||
JDynamicNative::registerNatives();
|
||||
JReactMarker::registerNatives();
|
||||
NativeArray::registerNatives();
|
||||
NativeMap::registerNatives();
|
||||
ReadableNativeArray::registerNatives();
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "CxxModuleWrapperBase.h"
|
||||
#include "InspectorNetworkRequestListener.h"
|
||||
#include "JInspector.h"
|
||||
#include "JReactMarker.h"
|
||||
#include "JavaScriptExecutorHolder.h"
|
||||
#include "ReactInstanceManagerInspectorTarget.h"
|
||||
|
||||
@@ -42,7 +41,6 @@ extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
|
||||
#endif
|
||||
CatalystInstanceImpl::registerNatives();
|
||||
CxxModuleWrapperBase::registerNatives();
|
||||
JReactMarker::registerNatives();
|
||||
JInspector::registerNatives();
|
||||
ReactInstanceManagerInspectorTarget::registerNatives();
|
||||
InspectorNetworkRequestListener::registerNatives();
|
||||
|
||||
Reference in New Issue
Block a user