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

Side by Side Diff: base/android/java/src/org/chromium/base/JavaExceptionReporter.java

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 | « base/android/base_jni_registrar.cc ('k') | base/android/java_exception_reporter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 package org.chromium.chrome.browser; 5 package org.chromium.base;
6 6
7 import android.support.annotation.UiThread; 7 import android.support.annotation.UiThread;
8 8
9 import org.chromium.base.ThreadUtils;
10 import org.chromium.base.annotations.CalledByNative; 9 import org.chromium.base.annotations.CalledByNative;
11 import org.chromium.base.annotations.JNINamespace; 10 import org.chromium.base.annotations.JNINamespace;
11 import org.chromium.base.annotations.MainDex;
12 12
13 /** 13 /**
14 * This UncaughtExceptionHandler will create a breakpad minidump when there is a n uncaught 14 * This UncaughtExceptionHandler will create a breakpad minidump when there is a n uncaught
15 * exception. 15 * exception.
16 * 16 *
17 * The exception's stack trace will be added to the minidump's data. This allows us to report 17 * The exception's stack trace will be added to the minidump's data. This allows java-only crashes
18 * java-only crashes in the same way that we report all other Chrome crashes. 18 * to be reported in the same way as other native crashes.
19 */ 19 */
20 @JNINamespace("chrome::android") 20 @JNINamespace("base::android")
21 @MainDex
21 public class JavaExceptionReporter implements Thread.UncaughtExceptionHandler { 22 public class JavaExceptionReporter implements Thread.UncaughtExceptionHandler {
22 private Thread.UncaughtExceptionHandler mParent; 23 private Thread.UncaughtExceptionHandler mParent;
23 private boolean mHandlingException; 24 private boolean mHandlingException;
24 25
25 JavaExceptionReporter(Thread.UncaughtExceptionHandler parent) { 26 private JavaExceptionReporter(Thread.UncaughtExceptionHandler parent) {
26 mParent = parent; 27 mParent = parent;
27 } 28 }
28 29
29 @Override 30 @Override
30 public void uncaughtException(Thread t, Throwable e) { 31 public void uncaughtException(Thread t, Throwable e) {
31 if (!mHandlingException) { 32 if (!mHandlingException) {
32 mHandlingException = true; 33 mHandlingException = true;
33 nativeReportJavaException(e); 34 nativeReportJavaException(e);
34 } 35 }
35 if (mParent != null) { 36 if (mParent != null) {
(...skipping 16 matching lines...) Expand all
52 53
53 @CalledByNative 54 @CalledByNative
54 private static void installHandler() { 55 private static void installHandler() {
55 Thread.setDefaultUncaughtExceptionHandler( 56 Thread.setDefaultUncaughtExceptionHandler(
56 new JavaExceptionReporter(Thread.getDefaultUncaughtExceptionHand ler())); 57 new JavaExceptionReporter(Thread.getDefaultUncaughtExceptionHand ler()));
57 } 58 }
58 59
59 private static native void nativeReportJavaException(Throwable e); 60 private static native void nativeReportJavaException(Throwable e);
60 private static native void nativeReportJavaStackTrace(String stackTrace); 61 private static native void nativeReportJavaStackTrace(String stackTrace);
61 } 62 }
OLDNEW
« no previous file with comments | « base/android/base_jni_registrar.cc ('k') | base/android/java_exception_reporter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698