Skip to content

Commit

Permalink
Migrate ReactBridge to kotlin (facebook#48904)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#48904

Migrate ReactBridge to kotlin

chagelog: [internal] internal

Differential Revision: D68540709
  • Loading branch information
mdvacca committed Jan 23, 2025
1 parent d40f90b commit f7e5d60
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 54 deletions.
12 changes: 6 additions & 6 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -1128,12 +1128,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 {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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 fun isInitialized(): Boolean = _didInit
}

0 comments on commit f7e5d60

Please sign in to comment.