mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Rename ReactBridge to BridgeSoLoader (#50315)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50315 Make it clearer that the only purpose of this class is to manage the soloading of the core bridge so file. Changelog: [Internal] Reviewed By: Abbondanzo Differential Revision: D71965759 fbshipit-source-id: d333f3e768a2359b082d4df279548cbd4b58ec76
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d24db7b0ae
commit
f477dbcfde
+10
-24
@@ -7,7 +7,6 @@
|
||||
|
||||
package com.facebook.react.bridge
|
||||
|
||||
import android.os.SystemClock
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger
|
||||
import com.facebook.soloader.SoLoader
|
||||
@@ -15,41 +14,28 @@ import com.facebook.systrace.Systrace
|
||||
import com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE
|
||||
|
||||
@LegacyArchitecture
|
||||
internal object ReactBridge {
|
||||
internal object BridgeSoLoader {
|
||||
init {
|
||||
LegacyArchitectureLogger.assertWhenLegacyArchitectureMinifyingEnabled("ReactBridge")
|
||||
LegacyArchitectureLogger.assertWhenLegacyArchitectureMinifyingEnabled("BridgeSoLoader")
|
||||
}
|
||||
|
||||
@Volatile private var _loadStartTime: Long = 0
|
||||
@Volatile private var _loadEndTime: Long = 0
|
||||
@Volatile private var _didInit: Boolean = false
|
||||
|
||||
@JvmStatic
|
||||
@Synchronized
|
||||
fun staticInit() {
|
||||
if (_didInit) {
|
||||
if (initialized) {
|
||||
return
|
||||
}
|
||||
_loadStartTime = SystemClock.uptimeMillis()
|
||||
Systrace.beginSection(
|
||||
TRACE_TAG_REACT_JAVA_BRIDGE, "ReactBridge.staticInit::load:reactnativejni")
|
||||
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "BridgeSoLoader")
|
||||
ReactMarker.logMarker(ReactMarkerConstants.LOAD_REACT_NATIVE_SO_FILE_START)
|
||||
SoLoader.loadLibrary("reactnativejni")
|
||||
ReactMarker.logMarker(ReactMarkerConstants.LOAD_REACT_NATIVE_SO_FILE_END)
|
||||
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE)
|
||||
_loadEndTime = SystemClock.uptimeMillis()
|
||||
_didInit = true
|
||||
initialized = true
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
val loadStartTime: Long
|
||||
get() = _loadStartTime
|
||||
|
||||
@JvmStatic
|
||||
val loadEndTime: Long
|
||||
get() = _loadEndTime
|
||||
|
||||
@JvmStatic
|
||||
val initialized: Boolean
|
||||
@JvmName("isInitialized") get() = _didInit
|
||||
@get:JvmStatic
|
||||
@get:JvmName("isInitialized")
|
||||
@Volatile
|
||||
var initialized: Boolean = false
|
||||
private set
|
||||
}
|
||||
+1
-1
@@ -50,7 +50,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
@LegacyArchitecture
|
||||
public class CatalystInstanceImpl implements CatalystInstance {
|
||||
static {
|
||||
ReactBridge.staticInit();
|
||||
BridgeSoLoader.staticInit();
|
||||
LegacyArchitectureLogger.assertWhenLegacyArchitectureMinifyingEnabled(
|
||||
"CatalystInstanceImpl", LegacyArchitectureLogLevel.WARNING);
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ protected constructor(
|
||||
|
||||
private companion object {
|
||||
init {
|
||||
ReactBridge.staticInit()
|
||||
BridgeSoLoader.staticInit()
|
||||
LegacyArchitectureLogger.assertWhenLegacyArchitectureMinifyingEnabled(
|
||||
"CxxModuleWrapperBase", LegacyArchitectureLogLevel.WARNING)
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import java.util.List;
|
||||
@DoNotStrip
|
||||
public class Inspector {
|
||||
static {
|
||||
ReactBridge.staticInit();
|
||||
BridgeSoLoader.staticInit();
|
||||
}
|
||||
|
||||
private final HybridData mHybridData;
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ public abstract class NativeArray protected constructor() :
|
||||
|
||||
private companion object {
|
||||
init {
|
||||
ReactBridge.staticInit()
|
||||
BridgeSoLoader.staticInit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ public abstract class NativeMap : HybridClassBase() {
|
||||
|
||||
private companion object {
|
||||
init {
|
||||
ReactBridge.staticInit()
|
||||
BridgeSoLoader.staticInit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -70,6 +70,6 @@ public class ReactInstanceManagerInspectorTarget implements AutoCloseable {
|
||||
static {
|
||||
LegacyArchitectureLogger.assertWhenLegacyArchitectureMinifyingEnabled(
|
||||
"ReactInstanceManagerInspectorTarget", LegacyArchitectureLogLevel.WARNING);
|
||||
ReactBridge.staticInit();
|
||||
BridgeSoLoader.staticInit();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -211,7 +211,7 @@ public class ReactMarker {
|
||||
now = SystemClock.uptimeMillis();
|
||||
}
|
||||
|
||||
if (ReactBridge.isInitialized()) {
|
||||
if (BridgeSoLoader.isInitialized()) {
|
||||
// First send the current marker
|
||||
nativeLogMarker(name.name(), now);
|
||||
|
||||
|
||||
+10
-12
@@ -9,18 +9,16 @@ package com.facebook.react.defaults
|
||||
|
||||
import com.facebook.soloader.SoLoader
|
||||
|
||||
internal class DefaultSoLoader {
|
||||
companion object {
|
||||
@Synchronized
|
||||
@JvmStatic
|
||||
fun maybeLoadSoLibrary() {
|
||||
SoLoader.loadLibrary("react_newarchdefaults")
|
||||
try {
|
||||
SoLoader.loadLibrary("appmodules")
|
||||
} catch (e: UnsatisfiedLinkError) {
|
||||
// ignore: DefaultTurboModuleManagerDelegate is still used in apps that don't have
|
||||
// appmodules.so
|
||||
}
|
||||
internal object DefaultSoLoader {
|
||||
@Synchronized
|
||||
@JvmStatic
|
||||
fun maybeLoadSoLibrary() {
|
||||
SoLoader.loadLibrary("react_newarchdefaults")
|
||||
try {
|
||||
SoLoader.loadLibrary("appmodules")
|
||||
} catch (e: UnsatisfiedLinkError) {
|
||||
// ignore: DefaultTurboModuleManagerDelegate is still used in apps that don't have
|
||||
// appmodules.so
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -20,8 +20,7 @@ public object FabricSoLoader {
|
||||
if (didInit) {
|
||||
return
|
||||
}
|
||||
Systrace.beginSection(
|
||||
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricSoLoader.staticInit::load:fabricjni")
|
||||
Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricSoLoader")
|
||||
ReactMarker.logMarker(ReactMarkerConstants.LOAD_REACT_NATIVE_SO_FILE_START)
|
||||
SoLoader.loadLibrary("fabricjni")
|
||||
ReactMarker.logMarker(ReactMarkerConstants.LOAD_REACT_NATIVE_SO_FILE_END)
|
||||
|
||||
Reference in New Issue
Block a user