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