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