1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/android/java_exception_reporter.h"
7 #include "base/android/build_info.h"
8 #include "base/android/jni_android.h"
9 #include "base/debug/dump_without_crashing.h"
10 #include "jni/JavaExceptionReporter_jni.h"
15 void InitJavaExceptionReporter() {
16 JNIEnv
* env
= base::android::AttachCurrentThread();
17 Java_JavaExceptionReporter_installHandler(env
);
20 void ReportJavaException(JNIEnv
* env
,
21 const JavaParamRef
<jclass
>& jcaller
,
22 const JavaParamRef
<jthrowable
>& e
) {
23 // Set the exception_string in BuildInfo so that breakpad can read it.
24 base::android::BuildInfo::GetInstance()->SetJavaExceptionInfo(
25 base::android::GetJavaExceptionInfo(env
, e
));
26 base::debug::DumpWithoutCrashing();
27 base::android::BuildInfo::GetInstance()->ClearJavaExceptionInfo();
30 bool RegisterJavaExceptionReporterJni(JNIEnv
* env
) {
31 return RegisterNativesImpl(env
);
35 } // namespace android