1 // Copyright 2015 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef BASE_ANDROID_JAVA_EXCEPTION_REPORTER_H_
6 #define BASE_ANDROID_JAVA_EXCEPTION_REPORTER_H_
10 #include "base/android/scoped_java_ref.h"
11 #include "base/base_export.h"
12 #include "base/functional/callback_forward.h"
17 // Install the exception handler. This should only be called once per process.
18 BASE_EXPORT void InitJavaExceptionReporter();
20 // Same as above except the handler ensures child process exists immediately
21 // after an unhandled exception. This is used for child processes because
22 // DumpWithoutCrashing does not work for child processes on Android.
23 BASE_EXPORT void InitJavaExceptionReporterForChildProcess();
25 // Sets a callback to be called with the contents of a Java exception, which may
27 BASE_EXPORT void SetJavaExceptionCallback(void (*)(const char* exception));
29 // Calls the Java exception callback, if any, with exception.
30 void SetJavaException(const char* exception);
32 // Sets a filter that determines whether a java exception should cause a crash
33 // report. |java_exception_filter| should return true if a crash report should
35 BASE_EXPORT void SetJavaExceptionFilter(
36 base::RepeatingCallback<bool(const JavaRef<jthrowable>&)>
37 java_exception_filter);
39 } // namespace android
42 #endif // BASE_ANDROID_JAVA_EXCEPTION_REPORTER_H_