| OLD | NEW |
| 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 #ifndef CHROMECAST_APP_ANDROID_CRASH_HANDLER_H_ | 5 #ifndef CHROMECAST_APP_ANDROID_CRASH_HANDLER_H_ |
| 6 #define CHROMECAST_APP_ANDROID_CRASH_HANDLER_H_ | 6 #define CHROMECAST_APP_ANDROID_CRASH_HANDLER_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 | 15 |
| 16 namespace chromecast { | 16 namespace chromecast { |
| 17 class CastCrashReporterClientAndroid; | 17 class CastCrashReporterClientAndroid; |
| 18 | 18 |
| 19 class CrashHandler { | 19 class CrashHandler { |
| 20 public: | 20 public: |
| 21 // Initializes the crash handler for attempting to upload crash dumps with | 21 // Initializes the crash handler for attempting to upload crash dumps with |
| 22 // the current process's log file. | 22 // the current process's log file. |
| 23 // Must not be called more than once. | 23 // Must not be called more than once. |
| 24 static void Initialize(const std::string& process_type, | 24 static void Initialize(const std::string& process_type, |
| 25 const base::FilePath& log_file_path); | 25 const base::FilePath& log_file_path); |
| 26 | 26 |
| 27 // Returns the directory location for crash dumps. | 27 // Returns the directory location for crash dumps. |
| 28 static bool GetCrashDumpLocation(base::FilePath* crash_dir); | 28 static bool GetCrashDumpLocation(base::FilePath* crash_dir); |
| 29 | 29 |
| 30 // Registers JNI methods for this module. | |
| 31 static bool RegisterCastCrashJni(JNIEnv* env); | |
| 32 | |
| 33 private: | 30 private: |
| 34 CrashHandler(const std::string& process_type, | 31 CrashHandler(const std::string& process_type, |
| 35 const base::FilePath& log_file_path); | 32 const base::FilePath& log_file_path); |
| 36 ~CrashHandler(); | 33 ~CrashHandler(); |
| 37 | 34 |
| 38 void Initialize(); | 35 void Initialize(); |
| 39 | 36 |
| 40 // Starts a thread to periodically check for uploads | 37 // Starts a thread to periodically check for uploads |
| 41 void InitializeUploader(); | 38 void InitializeUploader(); |
| 42 | 39 |
| 43 // Path to the current process's log file. | 40 // Path to the current process's log file. |
| 44 base::FilePath log_file_path_; | 41 base::FilePath log_file_path_; |
| 45 | 42 |
| 46 // Location to which crash dumps should be written. | 43 // Location to which crash dumps should be written. |
| 47 base::FilePath crash_dump_path_; | 44 base::FilePath crash_dump_path_; |
| 48 | 45 |
| 49 std::string process_type_; | 46 std::string process_type_; |
| 50 | 47 |
| 51 std::unique_ptr<CastCrashReporterClientAndroid> crash_reporter_client_; | 48 std::unique_ptr<CastCrashReporterClientAndroid> crash_reporter_client_; |
| 52 | 49 |
| 53 DISALLOW_COPY_AND_ASSIGN(CrashHandler); | 50 DISALLOW_COPY_AND_ASSIGN(CrashHandler); |
| 54 }; | 51 }; |
| 55 | 52 |
| 56 } // namespace chromecast | 53 } // namespace chromecast |
| 57 | 54 |
| 58 #endif // CHROMECAST_APP_ANDROID_CRASH_HANDLER_H_ | 55 #endif // CHROMECAST_APP_ANDROID_CRASH_HANDLER_H_ |
| OLD | NEW |