mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Migrate ReactBridge to kotlin (#48904)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48904 Migrate ReactBridge to kotlin changelog: [internal] internal Reviewed By: tdn120, cortinico Differential Revision: D68540709 fbshipit-source-id: 35a6d19f940dabdecbe7b7f835953d9f07f7222b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
73968dc778
commit
e44b2fa973
@@ -1124,12 +1124,12 @@ public abstract class com/facebook/react/bridge/ReactApplicationContext : com/fa
|
||||
public fun <init> (Landroid/content/Context;)V
|
||||
}
|
||||
|
||||
public class com/facebook/react/bridge/ReactBridge {
|
||||
public fun <init> ()V
|
||||
public static fun getLoadEndTime ()J
|
||||
public static fun getLoadStartTime ()J
|
||||
public static fun isInitialized ()Z
|
||||
public static fun staticInit ()V
|
||||
public final class com/facebook/react/bridge/ReactBridge {
|
||||
public static final field INSTANCE Lcom/facebook/react/bridge/ReactBridge;
|
||||
public static final fun getLoadEndTime ()J
|
||||
public static final fun getLoadStartTime ()J
|
||||
public static final fun isInitialized ()Z
|
||||
public static final fun staticInit ()V
|
||||
}
|
||||
|
||||
public abstract class com/facebook/react/bridge/ReactContext : android/content/ContextWrapper {
|
||||
|
||||
-48
@@ -1,48 +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.
|
||||
*/
|
||||
|
||||
package com.facebook.react.bridge;
|
||||
|
||||
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
|
||||
|
||||
import android.os.SystemClock;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
import com.facebook.systrace.Systrace;
|
||||
|
||||
public class ReactBridge {
|
||||
private static volatile long sLoadStartTime = 0;
|
||||
private static volatile long sLoadEndTime = 0;
|
||||
|
||||
private static volatile boolean sDidInit = false;
|
||||
|
||||
public static boolean isInitialized() {
|
||||
return sDidInit;
|
||||
}
|
||||
|
||||
public static synchronized void staticInit() {
|
||||
if (sDidInit) {
|
||||
return;
|
||||
}
|
||||
sLoadStartTime = SystemClock.uptimeMillis();
|
||||
Systrace.beginSection(
|
||||
TRACE_TAG_REACT_JAVA_BRIDGE, "ReactBridge.staticInit::load:reactnativejni");
|
||||
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);
|
||||
sLoadEndTime = SystemClock.uptimeMillis();
|
||||
sDidInit = true;
|
||||
}
|
||||
|
||||
public static long getLoadStartTime() {
|
||||
return sLoadStartTime;
|
||||
}
|
||||
|
||||
public static long getLoadEndTime() {
|
||||
return sLoadEndTime;
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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 android.os.SystemClock
|
||||
import com.facebook.soloader.SoLoader
|
||||
import com.facebook.systrace.Systrace
|
||||
import com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE
|
||||
|
||||
public object ReactBridge {
|
||||
@Volatile private var _loadStartTime: Long = 0
|
||||
@Volatile private var _loadEndTime: Long = 0
|
||||
@Volatile private var _didInit: Boolean = false
|
||||
|
||||
@JvmStatic
|
||||
@Synchronized
|
||||
public fun staticInit() {
|
||||
if (_didInit) {
|
||||
return
|
||||
}
|
||||
_loadStartTime = SystemClock.uptimeMillis()
|
||||
Systrace.beginSection(
|
||||
TRACE_TAG_REACT_JAVA_BRIDGE, "ReactBridge.staticInit::load:reactnativejni")
|
||||
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
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public val loadStartTime: Long
|
||||
get() = _loadStartTime
|
||||
|
||||
@JvmStatic
|
||||
public val loadEndTime: Long
|
||||
get() = _loadEndTime
|
||||
|
||||
@JvmStatic
|
||||
public val initialized: Boolean
|
||||
@JvmName("isInitialized") get() = _didInit
|
||||
}
|
||||
Reference in New Issue
Block a user