mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Create ReactFeatureFlag to initialize MapBufferSo file during Fabric initialization
Summary: This diff creates a ReactFeatureFlag to initialize MapBufferSo file during Fabric initialization. This is necessary to be able to compare properly Mapbuffer vs ReadableNativeMap (because ReadableNativeMap c++ files is already included in the bridge so file) changelog: [internal] Reviewed By: JoshuaGross Differential Revision: D28436044 fbshipit-source-id: 338e1bb72b5313dc29a309e1b0e979e7c8bd1c18
This commit is contained in:
committed by
Facebook GitHub Bot
parent
73fbe80fc4
commit
0b371304aa
@@ -21,6 +21,9 @@ rn_android_library(
|
||||
react_native_dep("third-party/android/androidx:annotation"),
|
||||
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
||||
react_native_target("java/com/facebook/react/common:common"),
|
||||
# dependencies used for systraces
|
||||
react_native_dep("java/com/facebook/systrace:systrace"),
|
||||
react_native_target("java/com/facebook/react/bridge:bridge"),
|
||||
],
|
||||
exported_deps = [],
|
||||
)
|
||||
|
||||
+1
-2
@@ -10,7 +10,6 @@ package com.facebook.react.common.mapbuffer;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.jni.HybridData;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Iterator;
|
||||
@@ -23,7 +22,7 @@ import java.util.Iterator;
|
||||
public class ReadableMapBuffer implements Iterable<ReadableMapBuffer.MapBufferEntry> {
|
||||
|
||||
static {
|
||||
SoLoader.loadLibrary("mapbufferjni");
|
||||
ReadableMapBufferSoLoader.staticInit();
|
||||
}
|
||||
|
||||
// Value used to verify if the data is serialized with LittleEndian order.
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its 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.common.mapbuffer;
|
||||
|
||||
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
|
||||
|
||||
import com.facebook.react.bridge.ReactMarker;
|
||||
import com.facebook.react.bridge.ReactMarkerConstants;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
import com.facebook.systrace.Systrace;
|
||||
|
||||
public class ReadableMapBufferSoLoader {
|
||||
private static volatile boolean sDidInit = false;
|
||||
|
||||
public static void staticInit() {
|
||||
if (sDidInit) {
|
||||
return;
|
||||
}
|
||||
Systrace.beginSection(
|
||||
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
|
||||
"ReadableMapBufferSoLoader.staticInit::load:mapbufferjni");
|
||||
ReactMarker.logMarker(ReactMarkerConstants.LOAD_REACT_NATIVE_MAPBUFFER_SO_FILE_START);
|
||||
SoLoader.loadLibrary("mapbufferjni");
|
||||
ReactMarker.logMarker(ReactMarkerConstants.LOAD_REACT_NATIVE_MAPBUFFER_SO_FILE_END);
|
||||
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
sDidInit = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user