Index: base/android/java_exception_reporter.cc |
diff --git a/base/android/java_exception_reporter.cc b/base/android/java_exception_reporter.cc |
index 43f8be252b3a3f72ea697937afb4f5d835e3da92..eb83a578d8c718ad5d780f2589c750ab81b2fe4c 100644 |
--- a/base/android/java_exception_reporter.cc |
+++ b/base/android/java_exception_reporter.cc |
@@ -17,15 +17,27 @@ namespace android { |
void InitJavaExceptionReporter() { |
JNIEnv* env = base::android::AttachCurrentThread(); |
- Java_JavaExceptionReporter_installHandler(env); |
+ constexpr bool crash_after_report = false; |
+ Java_JavaExceptionReporter_installHandler(env, crash_after_report); |
+} |
+ |
+void InitJavaExceptionReporterForChildProcess() { |
+ JNIEnv* env = base::android::AttachCurrentThread(); |
+ constexpr bool crash_after_report = true; |
+ Java_JavaExceptionReporter_installHandler(env, crash_after_report); |
} |
void ReportJavaException(JNIEnv* env, |
const JavaParamRef<jclass>& jcaller, |
+ jboolean crash_after_report, |
const JavaParamRef<jthrowable>& e) { |
+ std::string exception_info = base::android::GetJavaExceptionInfo(env, e); |
// Set the exception_string in BuildInfo so that breakpad can read it. |
- base::android::BuildInfo::GetInstance()->SetJavaExceptionInfo( |
- base::android::GetJavaExceptionInfo(env, e)); |
+ base::android::BuildInfo::GetInstance()->SetJavaExceptionInfo(exception_info); |
+ if (crash_after_report) { |
+ LOG(ERROR) << exception_info; |
+ LOG(FATAL) << "Uncaught exception"; |
+ } |
base::debug::DumpWithoutCrashing(); |
base::android::BuildInfo::GetInstance()->ClearJavaExceptionInfo(); |
} |