OLD | NEW |
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 #include "android_webview/native/aw_debug.h" | 5 #include "android_webview/native/aw_debug.h" |
6 | 6 |
7 #include "android_webview/common/crash_reporter/aw_microdump_crash_reporter.h" | 7 #include "android_webview/common/crash_reporter/aw_microdump_crash_reporter.h" |
| 8 #include "android_webview/common/crash_reporter/crash_keys.h" |
8 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
9 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
10 #include "base/debug/dump_without_crashing.h" | 11 #include "base/debug/dump_without_crashing.h" |
11 #include "base/files/file.h" | 12 #include "base/files/file.h" |
12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
13 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
14 #include "jni/AwDebug_jni.h" | 15 #include "jni/AwDebug_jni.h" |
15 | 16 |
16 using base::android::ConvertJavaStringToUTF16; | 17 using base::android::ConvertJavaStringToUTF16; |
17 using base::android::ConvertUTF8ToJavaString; | 18 using base::android::ConvertUTF8ToJavaString; |
(...skipping 11 matching lines...) Expand all Loading... |
29 base::ThreadRestrictions::ScopedAllowIO allow_io; | 30 base::ThreadRestrictions::ScopedAllowIO allow_io; |
30 base::File target(base::FilePath(ConvertJavaStringToUTF8(env, dump_path)), | 31 base::File target(base::FilePath(ConvertJavaStringToUTF8(env, dump_path)), |
31 base::File::FLAG_OPEN_TRUNCATED | base::File::FLAG_READ | | 32 base::File::FLAG_OPEN_TRUNCATED | base::File::FLAG_READ | |
32 base::File::FLAG_WRITE); | 33 base::File::FLAG_WRITE); |
33 if (!target.IsValid()) | 34 if (!target.IsValid()) |
34 return false; | 35 return false; |
35 // breakpad_linux::HandleCrashDump will close this fd once it is done. | 36 // breakpad_linux::HandleCrashDump will close this fd once it is done. |
36 return crash_reporter::DumpWithoutCrashingToFd(target.TakePlatformFile()); | 37 return crash_reporter::DumpWithoutCrashingToFd(target.TakePlatformFile()); |
37 } | 38 } |
38 | 39 |
| 40 static void InitCrashKeysForWebViewTesting(JNIEnv* env, |
| 41 const JavaParamRef<jclass>& clazz) { |
| 42 crash_keys::InitCrashKeysForWebViewTesting(); |
| 43 } |
| 44 |
| 45 static void SetCrashKeyValue(JNIEnv* env, |
| 46 const JavaParamRef<jclass>& clazz, |
| 47 const JavaParamRef<jstring>& key, |
| 48 const JavaParamRef<jstring>& value) { |
| 49 crash_keys::SetCrashKeyValue(ConvertJavaStringToUTF8(env, key), |
| 50 ConvertJavaStringToUTF8(env, value)); |
| 51 } |
| 52 |
39 bool RegisterAwDebug(JNIEnv* env) { | 53 bool RegisterAwDebug(JNIEnv* env) { |
40 return RegisterNativesImpl(env); | 54 return RegisterNativesImpl(env); |
41 } | 55 } |
42 | 56 |
43 } // namespace android_webview | 57 } // namespace android_webview |
OLD | NEW |