forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate ReactBridge to kotlin (facebook#48904)
Summary: Pull Request resolved: facebook#48904 Migrate ReactBridge to kotlin chagelog: [internal] internal Reviewed By: tdn120, cortinico Differential Revision: D68540709
- Loading branch information
Showing
3 changed files
with
56 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 0 additions & 48 deletions
48
packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactBridge.java
This file was deleted.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactBridge.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* 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.soloader.annotation.SoLoaderLibrary | ||
import com.facebook.systrace.Systrace | ||
import com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE | ||
|
||
@SoLoaderLibrary("reactnativejni") | ||
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 | ||
} |