mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Delete unnecessary NativeModuleSoLoader (#50199)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50199 We don't really need another wrapper around SoLoader to decide when to load a library. SoLoader already does this for us. See: https://github.com/facebook/SoLoader/blob/62c2028a07f146bbc56c0337dacf226fcd6f95ef/java/com/facebook/soloader/SoLoader.java#L1070-L1139 I'm removing this extra unnecessary class. Changelog: [Internal] [Changed] - Reviewed By: javache Differential Revision: D71637449 fbshipit-source-id: 33a146b56f8027fdb7fc48fd6f68bdbcf0b34fd6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
597c457b68
commit
526f6cbe07
@@ -3592,10 +3592,10 @@ public abstract interface class com/facebook/react/touch/ReactInterceptingViewGr
|
||||
public abstract fun setOnInterceptTouchEventListener (Lcom/facebook/react/touch/OnInterceptTouchEventListener;)V
|
||||
}
|
||||
|
||||
public final class com/facebook/react/turbomodule/core/CallInvokerHolderImpl : com/facebook/react/turbomodule/core/interfaces/CallInvokerHolder {
|
||||
public final class com/facebook/react/turbomodule/core/CallInvokerHolderImpl : com/facebook/jni/HybridClassBase, com/facebook/react/turbomodule/core/interfaces/CallInvokerHolder {
|
||||
}
|
||||
|
||||
public final class com/facebook/react/turbomodule/core/NativeMethodCallInvokerHolderImpl : com/facebook/react/turbomodule/core/interfaces/NativeMethodCallInvokerHolder {
|
||||
public final class com/facebook/react/turbomodule/core/NativeMethodCallInvokerHolderImpl : com/facebook/jni/HybridClassBase, com/facebook/react/turbomodule/core/interfaces/NativeMethodCallInvokerHolder {
|
||||
}
|
||||
|
||||
public final class com/facebook/react/turbomodule/core/interfaces/BindingsInstallerHolder {
|
||||
|
||||
-23
@@ -1,23 +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.internal.turbomodule.core
|
||||
|
||||
import com.facebook.soloader.SoLoader
|
||||
|
||||
internal object NativeModuleSoLoader {
|
||||
private var isSoLibraryLoaded = false
|
||||
|
||||
@Synchronized
|
||||
@JvmStatic
|
||||
public fun maybeLoadSoLibrary() {
|
||||
if (!isSoLibraryLoaded) {
|
||||
SoLoader.loadLibrary("turbomodulejsijni")
|
||||
isSoLibraryLoaded = true
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -23,6 +23,7 @@ import com.facebook.react.turbomodule.core.NativeMethodCallInvokerHolderImpl;
|
||||
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder;
|
||||
import com.facebook.react.turbomodule.core.interfaces.NativeMethodCallInvokerHolder;
|
||||
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -44,7 +45,7 @@ public class TurboModuleManager implements TurboModuleRegistry {
|
||||
private final TurboModuleManagerDelegate mDelegate;
|
||||
|
||||
static {
|
||||
NativeModuleSoLoader.maybeLoadSoLibrary();
|
||||
SoLoader.loadLibrary("turbomodulejsijni");
|
||||
}
|
||||
|
||||
// Prevents the creation of new TurboModules once cleanup as been initiated.
|
||||
|
||||
+2
-1
@@ -13,6 +13,7 @@ import com.facebook.jni.HybridData;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -23,7 +24,7 @@ public abstract class TurboModuleManagerDelegate {
|
||||
private final HybridData mHybridData;
|
||||
|
||||
static {
|
||||
NativeModuleSoLoader.maybeLoadSoLibrary();
|
||||
SoLoader.loadLibrary("turbomodulejsijni");
|
||||
}
|
||||
|
||||
protected abstract HybridData initHybrid();
|
||||
|
||||
+2
-1
@@ -9,13 +9,14 @@ package com.facebook.react.internal.turbomodule.core
|
||||
|
||||
import com.facebook.proguard.annotations.DoNotStrip
|
||||
import com.facebook.react.reactperflogger.NativeModulePerfLogger
|
||||
import com.facebook.soloader.SoLoader
|
||||
|
||||
@DoNotStrip
|
||||
internal object TurboModulePerfLogger {
|
||||
private var nativeModulePerfLogger: NativeModulePerfLogger? = null
|
||||
|
||||
init {
|
||||
NativeModuleSoLoader.maybeLoadSoLibrary()
|
||||
SoLoader.loadLibrary("turbomodulejsijni")
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
|
||||
+2
-11
@@ -7,10 +7,8 @@
|
||||
|
||||
package com.facebook.react.turbomodule.core
|
||||
|
||||
import com.facebook.jni.HybridData
|
||||
import com.facebook.proguard.annotations.DoNotStrip
|
||||
import com.facebook.jni.HybridClassBase
|
||||
import com.facebook.react.common.annotations.FrameworkAPI
|
||||
import com.facebook.react.internal.turbomodule.core.NativeModuleSoLoader
|
||||
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder
|
||||
|
||||
/**
|
||||
@@ -19,11 +17,4 @@ import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder
|
||||
* pass it from CatalystInstance, through Java, to TurboModuleManager::initHybrid.
|
||||
*/
|
||||
@FrameworkAPI
|
||||
public class CallInvokerHolderImpl
|
||||
private constructor(@field:DoNotStrip private val mHybridData: HybridData) : CallInvokerHolder {
|
||||
private companion object {
|
||||
init {
|
||||
NativeModuleSoLoader.maybeLoadSoLibrary()
|
||||
}
|
||||
}
|
||||
}
|
||||
public class CallInvokerHolderImpl private constructor() : HybridClassBase(), CallInvokerHolder {}
|
||||
|
||||
+3
-12
@@ -7,10 +7,8 @@
|
||||
|
||||
package com.facebook.react.turbomodule.core
|
||||
|
||||
import com.facebook.jni.HybridData
|
||||
import com.facebook.proguard.annotations.DoNotStrip
|
||||
import com.facebook.jni.HybridClassBase
|
||||
import com.facebook.react.common.annotations.FrameworkAPI
|
||||
import com.facebook.react.internal.turbomodule.core.NativeModuleSoLoader
|
||||
import com.facebook.react.turbomodule.core.interfaces.NativeMethodCallInvokerHolder
|
||||
|
||||
/**
|
||||
@@ -20,12 +18,5 @@ import com.facebook.react.turbomodule.core.interfaces.NativeMethodCallInvokerHol
|
||||
* TurboModuleManager::initHybrid.
|
||||
*/
|
||||
@FrameworkAPI
|
||||
public class NativeMethodCallInvokerHolderImpl
|
||||
private constructor(@field:DoNotStrip private val mHybridData: HybridData) :
|
||||
NativeMethodCallInvokerHolder {
|
||||
private companion object {
|
||||
init {
|
||||
NativeModuleSoLoader.maybeLoadSoLibrary()
|
||||
}
|
||||
}
|
||||
}
|
||||
public class NativeMethodCallInvokerHolderImpl private constructor() :
|
||||
HybridClassBase(), NativeMethodCallInvokerHolder {}
|
||||
|
||||
+1
-7
@@ -10,12 +10,6 @@
|
||||
namespace facebook::react {
|
||||
|
||||
CallInvokerHolder::CallInvokerHolder(std::shared_ptr<CallInvoker> callInvoker)
|
||||
: _callInvoker(callInvoker) {}
|
||||
|
||||
std::shared_ptr<CallInvoker> CallInvokerHolder::getCallInvoker() {
|
||||
return _callInvoker;
|
||||
}
|
||||
|
||||
void CallInvokerHolder::registerNatives() {}
|
||||
: callInvoker_(std::move(callInvoker)) {}
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
+4
-3
@@ -18,13 +18,14 @@ class CallInvokerHolder : public jni::HybridClass<CallInvokerHolder> {
|
||||
static auto constexpr kJavaDescriptor =
|
||||
"Lcom/facebook/react/turbomodule/core/CallInvokerHolderImpl;";
|
||||
|
||||
static void registerNatives();
|
||||
std::shared_ptr<CallInvoker> getCallInvoker();
|
||||
std::shared_ptr<CallInvoker> getCallInvoker() {
|
||||
return callInvoker_;
|
||||
}
|
||||
|
||||
private:
|
||||
friend HybridBase;
|
||||
CallInvokerHolder(std::shared_ptr<CallInvoker> callInvoker);
|
||||
std::shared_ptr<CallInvoker> _callInvoker;
|
||||
std::shared_ptr<CallInvoker> callInvoker_;
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
+1
-8
@@ -11,13 +11,6 @@ namespace facebook::react {
|
||||
|
||||
NativeMethodCallInvokerHolder::NativeMethodCallInvokerHolder(
|
||||
std::shared_ptr<NativeMethodCallInvoker> nativeMethodCallInvoker)
|
||||
: _nativeMethodCallInvoker(nativeMethodCallInvoker) {}
|
||||
|
||||
std::shared_ptr<NativeMethodCallInvoker>
|
||||
NativeMethodCallInvokerHolder::getNativeMethodCallInvoker() {
|
||||
return _nativeMethodCallInvoker;
|
||||
}
|
||||
|
||||
void NativeMethodCallInvokerHolder::registerNatives() {}
|
||||
: nativeMethodCallInvoker_(std::move(nativeMethodCallInvoker)) {}
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
+4
-3
@@ -19,14 +19,15 @@ class NativeMethodCallInvokerHolder
|
||||
static auto constexpr kJavaDescriptor =
|
||||
"Lcom/facebook/react/turbomodule/core/NativeMethodCallInvokerHolderImpl;";
|
||||
|
||||
static void registerNatives();
|
||||
std::shared_ptr<NativeMethodCallInvoker> getNativeMethodCallInvoker();
|
||||
std::shared_ptr<NativeMethodCallInvoker> getNativeMethodCallInvoker() {
|
||||
return nativeMethodCallInvoker_;
|
||||
}
|
||||
|
||||
private:
|
||||
friend HybridBase;
|
||||
NativeMethodCallInvokerHolder(
|
||||
std::shared_ptr<NativeMethodCallInvoker> nativeMethodCallInvoker);
|
||||
std::shared_ptr<NativeMethodCallInvoker> _nativeMethodCallInvoker;
|
||||
std::shared_ptr<NativeMethodCallInvoker> nativeMethodCallInvoker_;
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
Reference in New Issue
Block a user