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. 4 5 #ifndef BASE_ANDROID_JAVA_EXCEPTION_REPORTER_H_ 6 #define BASE_ANDROID_JAVA_EXCEPTION_REPORTER_H_ 7 8 #include <jni.h> 9 10 #include "base/base_export.h" 11 12 namespace base { 13 namespace android { 14 15 // Install the exception handler. This should only be called once per process. 16 BASE_EXPORT void InitJavaExceptionReporter(); 17 18 // Same as above except the handler ensures child process exists immediately 19 // after an unhandled exception. This is used for child processes because 20 // DumpWithoutCrashing does not work for child processes on Android. 21 BASE_EXPORT void InitJavaExceptionReporterForChildProcess(); 22 23 // Sets a callback to be called with the contents of a Java exception, which may 24 // be nullptr. 25 BASE_EXPORT void SetJavaExceptionCallback(void (*)(const char* exception)); 26 27 // Calls the Java exception callback, if any, with exception. 28 void SetJavaException(const char* exception); 29 30 } // namespace android 31 } // namespace base 32 33 #endif // BASE_ANDROID_JAVA_EXCEPTION_REPORTER_H_ 34