Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: chrome/browser/android/java_exception_reporter.cc

Issue 2667263002: android: Move JavaExceptionReporter to base (Closed)
Patch Set: maindex Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/android/java_exception_reporter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 #include "chrome/browser/android/java_exception_reporter.h"
6
7 #include "base/android/build_info.h"
8 #include "base/android/jni_android.h"
9 #include "base/android/jni_string.h"
10 #include "base/debug/dump_without_crashing.h"
11 #include "jni/JavaExceptionReporter_jni.h"
12
13 using base::android::JavaParamRef;
14
15 namespace chrome {
16 namespace android {
17
18 void InitJavaExceptionReporter() {
19 JNIEnv* env = base::android::AttachCurrentThread();
20 Java_JavaExceptionReporter_installHandler(env);
21 }
22
23 void ReportJavaException(JNIEnv* env,
24 const JavaParamRef<jclass>& jcaller,
25 const JavaParamRef<jthrowable>& e) {
26 // Set the exception_string in BuildInfo so that breakpad can read it.
27 base::android::BuildInfo::GetInstance()->SetJavaExceptionInfo(
28 base::android::GetJavaExceptionInfo(env, e));
29 base::debug::DumpWithoutCrashing();
30 base::android::BuildInfo::GetInstance()->ClearJavaExceptionInfo();
31 }
32
33 void ReportJavaStackTrace(JNIEnv* env,
34 const JavaParamRef<jclass>& jcaller,
35 const JavaParamRef<jstring>& stackTrace) {
36 base::android::BuildInfo::GetInstance()->SetJavaExceptionInfo(
37 ConvertJavaStringToUTF8(stackTrace));
38 base::debug::DumpWithoutCrashing();
39 base::android::BuildInfo::GetInstance()->ClearJavaExceptionInfo();
40 }
41
42 bool RegisterJavaExceptionReporterJni(JNIEnv* env) {
43 return RegisterNativesImpl(env);
44 }
45
46
47 } // namespace android
48 } // namespace chrome
49
50
OLDNEW
« no previous file with comments | « chrome/browser/android/java_exception_reporter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698