Skip to content

Commit dba18bb

Browse files
cortinicometa-codesync[bot]
authored andcommitted
Remove unnecessary ReactCxxErrorHandler (#54704)
Summary: Pull Request resolved: #54704 This class is coming from Legacy Architecture and is no longer used so can be cleaned up. Changelog: [Internal] [Changed] - Reviewed By: mdvacca Differential Revision: D87925037 fbshipit-source-id: 30faffef0da2b7055a6d381b41dc72bead2dd8de
1 parent 7ba231d commit dba18bb

File tree

7 files changed

+0
-133
lines changed

7 files changed

+0
-133
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
import com.facebook.react.bridge.NativeModuleRegistry;
6060
import com.facebook.react.bridge.ReactApplicationContext;
6161
import com.facebook.react.bridge.ReactContext;
62-
import com.facebook.react.bridge.ReactCxxErrorHandler;
6362
import com.facebook.react.bridge.ReactMarker;
6463
import com.facebook.react.bridge.ReactMarkerConstants;
6564
import com.facebook.react.bridge.ReactNoCrashSoftException;
@@ -75,7 +74,6 @@
7574
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
7675
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel;
7776
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;
78-
import com.facebook.react.common.build.ReactBuildConfig;
7977
import com.facebook.react.devsupport.DevSupportManagerFactory;
8078
import com.facebook.react.devsupport.ReactInstanceDevHelper;
8179
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
@@ -107,7 +105,6 @@
107105
import com.facebook.soloader.SoLoader;
108106
import com.facebook.systrace.Systrace;
109107
import com.facebook.systrace.SystraceMessage;
110-
import java.lang.reflect.Method;
111108
import java.util.ArrayList;
112109
import java.util.Collection;
113110
import java.util.Collections;
@@ -304,8 +301,6 @@ public static ReactInstanceManagerBuilder builder() {
304301
mDevSupportManager.startInspector();
305302
}
306303

307-
registerCxxErrorHandlerFunc();
308-
309304
// Using `if (true)` just to prevent tests / lint errors.
310305
if (true) {
311306
// Legacy architecture of React Native is deprecated and can't be initialized anymore.
@@ -402,24 +397,6 @@ public void handleCxxError(Exception e) {
402397
mDevSupportManager.handleException(e);
403398
}
404399

405-
private void registerCxxErrorHandlerFunc() {
406-
if (!ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE) {
407-
Class[] parameterTypes = new Class[1];
408-
parameterTypes[0] = Exception.class;
409-
Method handleCxxErrorFunc = null;
410-
try {
411-
handleCxxErrorFunc = ReactInstanceManager.class.getMethod("handleCxxError", parameterTypes);
412-
} catch (NoSuchMethodException e) {
413-
FLog.e("ReactInstanceHolder", "Failed to set cxx error handler function", e);
414-
}
415-
ReactCxxErrorHandler.setHandleErrorFunc(this, handleCxxErrorFunc);
416-
}
417-
}
418-
419-
private void unregisterCxxErrorHandlerFunc() {
420-
ReactCxxErrorHandler.setHandleErrorFunc(null, null);
421-
}
422-
423400
static void initializeSoLoaderIfNecessary(Context applicationContext) {
424401
// Call SoLoader.initialize here, this is required for apps that does not use exopackage and
425402
// does not use SoLoader for loading other native code except from the one used by React Native
@@ -799,7 +776,6 @@ public void destroy() {
799776

800777
moveToBeforeCreateLifecycleState();
801778
mMemoryPressureRouter.destroy(mApplicationContext);
802-
unregisterCxxErrorHandlerFunc();
803779

804780
mCreateReactContextThread = null;
805781
synchronized (mAttachedReactRoots) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactCxxErrorHandler.kt

Lines changed: 0 additions & 54 deletions
This file was deleted.

packages/react-native/ReactAndroid/src/main/jni/react/jni/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ add_library(
5555
InspectorNetworkRequestListener.cpp
5656
JExecutor.cpp
5757
JMessageQueueThread.cpp
58-
JReactCxxErrorHandler.cpp
5958
JReactSoftExceptionLogger.cpp
6059
JRuntimeExecutor.cpp
6160
JRuntimeScheduler.cpp

packages/react-native/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
#include <logger/react_native_log.h>
3232

33-
#include "JReactCxxErrorHandler.h"
3433
#include "JReactSoftExceptionLogger.h"
3534
#include "JavaScriptExecutorHolder.h"
3635
#include "JniJSModulesUnbundle.h"
@@ -147,7 +146,6 @@ void log(ReactNativeLogLevel level, const char* message) {
147146
break;
148147
case ReactNativeLogLevelError:
149148
LOG(ERROR) << message;
150-
JReactCxxErrorHandler::handleError(message);
151149
break;
152150
case ReactNativeLogLevelFatal:
153151
LOG(FATAL) << message;

packages/react-native/ReactAndroid/src/main/jni/react/jni/JReactCxxErrorHandler.cpp

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/react-native/ReactAndroid/src/main/jni/react/jni/JReactCxxErrorHandler.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

scripts/cxx-api/ReactNativeCPP.api

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7182,16 +7182,6 @@ class JMessageQueueThread : public MessageQueueThread {
71827182
};
71837183
} // namespace facebook::react
71847184

7185-
/// @src {packages/react-native/ReactAndroid/src/main/jni/react/jni/JReactCxxErrorHandler.h}:
7186-
namespace facebook::react {
7187-
class JReactCxxErrorHandler : public jni::JavaClass<JReactCxxErrorHandler> {
7188-
public:
7189-
static constexpr const char* kJavaDescriptor =
7190-
"Lcom/facebook/react/bridge/ReactCxxErrorHandler;";
7191-
static void handleError(std::string message);
7192-
};
7193-
} // namespace facebook::react
7194-
71957185
/// @src {packages/react-native/ReactAndroid/src/main/jni/react/jni/JReactMarker.h}:
71967186
namespace facebook::react {
71977187
class JReactMarker : public facebook::jni::JavaClass<JReactMarker> {

0 commit comments

Comments
 (0)