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

Side by Side Diff: chromecast/app/android/crash_handler.cc

Issue 1154383006: Adding crash utilities to chromecast/crash. (Closed) Base URL: https://eureka-internal.googlesource.com/chromium/src@master
Patch Set: cast_shell_unittests not built for android Created 5 years, 6 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 | « chromecast/app/android/crash_handler.h ('k') | chromecast/app/cast_main_delegate.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chromecast/crash/android/crash_handler.h" 5 #include "chromecast/app/android/crash_handler.h"
6 6
7 #include <jni.h> 7 #include <jni.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string> 9 #include <string>
10 10
11 #include "base/android/jni_android.h" 11 #include "base/android/jni_android.h"
12 #include "base/android/jni_string.h" 12 #include "base/android/jni_string.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "breakpad/src/client/linux/handler/exception_handler.h" 16 #include "breakpad/src/client/linux/handler/exception_handler.h"
17 #include "breakpad/src/client/linux/handler/minidump_descriptor.h" 17 #include "breakpad/src/client/linux/handler/minidump_descriptor.h"
18 #include "chromecast/app/android/cast_crash_reporter_client_android.h"
18 #include "chromecast/base/version.h" 19 #include "chromecast/base/version.h"
19 #include "chromecast/crash/android/cast_crash_reporter_client_android.h"
20 #include "components/crash/app/breakpad_linux.h" 20 #include "components/crash/app/breakpad_linux.h"
21 #include "components/crash/app/crash_reporter_client.h" 21 #include "components/crash/app/crash_reporter_client.h"
22 #include "content/public/common/content_switches.h" 22 #include "content/public/common/content_switches.h"
23 #include "jni/CastCrashHandler_jni.h" 23 #include "jni/CastCrashHandler_jni.h"
24 24
25 namespace { 25 namespace {
26 26
27 chromecast::CrashHandler* g_crash_handler = NULL; 27 chromecast::CrashHandler* g_crash_handler = NULL;
28 28
29 // Debug builds: always to crash-staging 29 // Debug builds: always to crash-staging
(...skipping 17 matching lines...) Expand all
47 void CrashHandler::Initialize(const std::string& process_type, 47 void CrashHandler::Initialize(const std::string& process_type,
48 const base::FilePath& log_file_path) { 48 const base::FilePath& log_file_path) {
49 DCHECK(!g_crash_handler); 49 DCHECK(!g_crash_handler);
50 g_crash_handler = new CrashHandler(process_type, log_file_path); 50 g_crash_handler = new CrashHandler(process_type, log_file_path);
51 g_crash_handler->Initialize(); 51 g_crash_handler->Initialize();
52 } 52 }
53 53
54 // static 54 // static
55 bool CrashHandler::GetCrashDumpLocation(base::FilePath* crash_dir) { 55 bool CrashHandler::GetCrashDumpLocation(base::FilePath* crash_dir) {
56 DCHECK(g_crash_handler); 56 DCHECK(g_crash_handler);
57 return g_crash_handler->crash_reporter_client_-> 57 return g_crash_handler->crash_reporter_client_->GetCrashDumpLocation(
58 GetCrashDumpLocation(crash_dir); 58 crash_dir);
59 } 59 }
60 60
61 // static 61 // static
62 bool CrashHandler::RegisterCastCrashJni(JNIEnv* env) { 62 bool CrashHandler::RegisterCastCrashJni(JNIEnv* env) {
63 return RegisterNativesImpl(env); 63 return RegisterNativesImpl(env);
64 } 64 }
65 65
66 CrashHandler::CrashHandler(const std::string& process_type, 66 CrashHandler::CrashHandler(const std::string& process_type,
67 const base::FilePath& log_file_path) 67 const base::FilePath& log_file_path)
68 : log_file_path_(log_file_path), 68 : log_file_path_(log_file_path),
(...skipping 18 matching lines...) Expand all
87 } 87 }
88 88
89 if (process_type_ != switches::kZygoteProcess) { 89 if (process_type_ != switches::kZygoteProcess) {
90 breakpad::InitNonBrowserCrashReporterForAndroid(process_type_); 90 breakpad::InitNonBrowserCrashReporterForAndroid(process_type_);
91 } 91 }
92 } 92 }
93 93
94 void CrashHandler::InitializeUploader() { 94 void CrashHandler::InitializeUploader() {
95 JNIEnv* env = base::android::AttachCurrentThread(); 95 JNIEnv* env = base::android::AttachCurrentThread();
96 base::android::ScopedJavaLocalRef<jstring> crash_dump_path_java = 96 base::android::ScopedJavaLocalRef<jstring> crash_dump_path_java =
97 base::android::ConvertUTF8ToJavaString(env, 97 base::android::ConvertUTF8ToJavaString(env, crash_dump_path_.value());
98 crash_dump_path_.value());
99 Java_CastCrashHandler_initializeUploader( 98 Java_CastCrashHandler_initializeUploader(
100 env, base::android::GetApplicationContext(), 99 env,
101 crash_dump_path_java.obj(), UploadCrashToStaging()); 100 base::android::GetApplicationContext(),
101 crash_dump_path_java.obj(),
102 UploadCrashToStaging());
102 } 103 }
103 104
104 } // namespace chromecast 105 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/app/android/crash_handler.h ('k') | chromecast/app/cast_main_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698