OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_CRASH_CONTENT_BROWSER_CRASH_DUMP_MANAGER_ANDROID_H_ | 5 #ifndef COMPONENTS_CRASH_CONTENT_BROWSER_CRASH_DUMP_MANAGER_ANDROID_H_ |
6 #define COMPONENTS_CRASH_CONTENT_BROWSER_CRASH_DUMP_MANAGER_ANDROID_H_ | 6 #define COMPONENTS_CRASH_CONTENT_BROWSER_CRASH_DUMP_MANAGER_ANDROID_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 ~CrashDumpManager() override; | 42 ~CrashDumpManager() override; |
43 | 43 |
44 // Returns a file that should be used to generate a minidump for the process | 44 // Returns a file that should be used to generate a minidump for the process |
45 // |child_process_id|. | 45 // |child_process_id|. |
46 base::File CreateMinidumpFile(int child_process_id); | 46 base::File CreateMinidumpFile(int child_process_id); |
47 | 47 |
48 private: | 48 private: |
49 typedef std::map<int, base::FilePath> ChildProcessIDToMinidumpPath; | 49 typedef std::map<int, base::FilePath> ChildProcessIDToMinidumpPath; |
50 | 50 |
| 51 // This enum is used to back a UMA histogram, and must be treated as |
| 52 // append-only. |
| 53 enum ExitStatus { |
| 54 EMPTY_MINIDUMP = 0, |
| 55 VALID_MINIDUMP = 1, |
| 56 COUNT = 2 |
| 57 }; |
| 58 |
51 static void ProcessMinidump(const base::FilePath& minidump_path, | 59 static void ProcessMinidump(const base::FilePath& minidump_path, |
52 base::ProcessHandle pid); | 60 base::ProcessHandle pid, |
| 61 bool recordExitStatus); |
53 | 62 |
54 // content::BrowserChildProcessObserver implementation: | 63 // content::BrowserChildProcessObserver implementation: |
55 void BrowserChildProcessHostDisconnected( | 64 void BrowserChildProcessHostDisconnected( |
56 const content::ChildProcessData& data) override; | 65 const content::ChildProcessData& data) override; |
57 void BrowserChildProcessCrashed( | 66 void BrowserChildProcessCrashed( |
58 const content::ChildProcessData& data, | 67 const content::ChildProcessData& data, |
59 int exit_code) override; | 68 int exit_code) override; |
60 | 69 |
61 // NotificationObserver implementation: | 70 // NotificationObserver implementation: |
62 void Observe(int type, | 71 void Observe(int type, |
63 const content::NotificationSource& source, | 72 const content::NotificationSource& source, |
64 const content::NotificationDetails& details) override; | 73 const content::NotificationDetails& details) override; |
65 | 74 |
66 // Called on child process exit (including crash). | 75 // Called on child process exit (including crash). |
67 void OnChildExit(int child_process_id, base::ProcessHandle pid); | 76 void OnChildExit(int child_process_id, |
| 77 base::ProcessHandle pid, |
| 78 bool recordExitStatus); |
68 | 79 |
69 content::NotificationRegistrar notification_registrar_; | 80 content::NotificationRegistrar notification_registrar_; |
70 | 81 |
71 // This map should only be accessed with its lock aquired as it is accessed | 82 // This map should only be accessed with its lock aquired as it is accessed |
72 // from the PROCESS_LAUNCHER and UI threads. | 83 // from the PROCESS_LAUNCHER and UI threads. |
73 base::Lock child_process_id_to_minidump_path_lock_; | 84 base::Lock child_process_id_to_minidump_path_lock_; |
74 ChildProcessIDToMinidumpPath child_process_id_to_minidump_path_; | 85 ChildProcessIDToMinidumpPath child_process_id_to_minidump_path_; |
75 | 86 |
76 base::FilePath crash_dump_dir_; | 87 base::FilePath crash_dump_dir_; |
77 | 88 |
78 static CrashDumpManager* instance_; | 89 static CrashDumpManager* instance_; |
79 | 90 |
80 DISALLOW_COPY_AND_ASSIGN(CrashDumpManager); | 91 DISALLOW_COPY_AND_ASSIGN(CrashDumpManager); |
81 }; | 92 }; |
82 | 93 |
83 } // namespace breakpad | 94 } // namespace breakpad |
84 | 95 |
85 #endif // COMPONENTS_CRASH_CONTENT_BROWSER_CRASH_DUMP_MANAGER_ANDROID_H_ | 96 #endif // COMPONENTS_CRASH_CONTENT_BROWSER_CRASH_DUMP_MANAGER_ANDROID_H_ |
OLD | NEW |