Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(851)

Unified Diff: base/android/java_exception_reporter.cc

Issue 2687193003: android: Report child exception by crashing (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/android/java_exception_reporter.h ('k') | chrome/app/chrome_main_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « base/android/java_exception_reporter.h ('k') | chrome/app/chrome_main_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698