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