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

Side by Side Diff: components/crash/content/browser/crash_dump_manager_android.h

Issue 1447213002: Add stats to distinguish android renderer crashes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Punting exit status change to make merging easier. Created 5 years, 1 month 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
OLDNEW
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"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/process/process.h" 12 #include "base/process/process.h"
13 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
14 #include "content/public/browser/browser_child_process_observer.h" 14 #include "content/public/browser/browser_child_process_observer.h"
15 #include "content/public/browser/notification_observer.h" 15 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 16 #include "content/public/browser/notification_registrar.h"
17 #include "content/public/common/process_type.h"
17 18
18 namespace content { 19 namespace content {
19 class RenderProcessHost; 20 class RenderProcessHost;
20 } 21 }
21 22
22 namespace breakpad { 23 namespace breakpad {
23 24
24 // This class manages the crash minidumps. 25 // This class manages the crash minidumps.
25 // On Android, because of process isolation, each renderer process runs with a 26 // On Android, because of process isolation, each renderer process runs with a
26 // different UID. As a result, we cannot generate the minidumps in the browser 27 // different UID. As a result, we cannot generate the minidumps in the browser
(...skipping 14 matching lines...) Expand all
41 42
42 ~CrashDumpManager() override; 43 ~CrashDumpManager() override;
43 44
44 // Returns a file that should be used to generate a minidump for the process 45 // Returns a file that should be used to generate a minidump for the process
45 // |child_process_id|. 46 // |child_process_id|.
46 base::File CreateMinidumpFile(int child_process_id); 47 base::File CreateMinidumpFile(int child_process_id);
47 48
48 private: 49 private:
49 typedef std::map<int, base::FilePath> ChildProcessIDToMinidumpPath; 50 typedef std::map<int, base::FilePath> ChildProcessIDToMinidumpPath;
50 51
52 // This enum is used to back a UMA histogram, and must be treated as
53 // append-only.
54 enum ExitStatus {
55 EMPTY_MINIDUMP = 0,
56 VALID_MINIDUMP = 1,
57 COUNT = 2
58 };
59
51 static void ProcessMinidump(const base::FilePath& minidump_path, 60 static void ProcessMinidump(const base::FilePath& minidump_path,
52 base::ProcessHandle pid); 61 base::ProcessHandle pid,
62 content::ProcessType process_type,
63 bool record_exit_status);
53 64
54 // content::BrowserChildProcessObserver implementation: 65 // content::BrowserChildProcessObserver implementation:
55 void BrowserChildProcessHostDisconnected( 66 void BrowserChildProcessHostDisconnected(
56 const content::ChildProcessData& data) override; 67 const content::ChildProcessData& data) override;
57 void BrowserChildProcessCrashed( 68 void BrowserChildProcessCrashed(
58 const content::ChildProcessData& data, 69 const content::ChildProcessData& data,
59 int exit_code) override; 70 int exit_code) override;
60 71
61 // NotificationObserver implementation: 72 // NotificationObserver implementation:
62 void Observe(int type, 73 void Observe(int type,
63 const content::NotificationSource& source, 74 const content::NotificationSource& source,
64 const content::NotificationDetails& details) override; 75 const content::NotificationDetails& details) override;
65 76
66 // Called on child process exit (including crash). 77 // Called on child process exit (including crash).
67 void OnChildExit(int child_process_id, base::ProcessHandle pid); 78 void OnChildExit(int child_process_id,
79 base::ProcessHandle pid,
80 content::ProcessType process_type,
81 bool record_exit_status);
68 82
69 content::NotificationRegistrar notification_registrar_; 83 content::NotificationRegistrar notification_registrar_;
70 84
71 // This map should only be accessed with its lock aquired as it is accessed 85 // This map should only be accessed with its lock aquired as it is accessed
72 // from the PROCESS_LAUNCHER and UI threads. 86 // from the PROCESS_LAUNCHER and UI threads.
73 base::Lock child_process_id_to_minidump_path_lock_; 87 base::Lock child_process_id_to_minidump_path_lock_;
74 ChildProcessIDToMinidumpPath child_process_id_to_minidump_path_; 88 ChildProcessIDToMinidumpPath child_process_id_to_minidump_path_;
75 89
76 base::FilePath crash_dump_dir_; 90 base::FilePath crash_dump_dir_;
77 91
78 static CrashDumpManager* instance_; 92 static CrashDumpManager* instance_;
79 93
80 DISALLOW_COPY_AND_ASSIGN(CrashDumpManager); 94 DISALLOW_COPY_AND_ASSIGN(CrashDumpManager);
81 }; 95 };
82 96
83 } // namespace breakpad 97 } // namespace breakpad
84 98
85 #endif // COMPONENTS_CRASH_CONTENT_BROWSER_CRASH_DUMP_MANAGER_ANDROID_H_ 99 #endif // COMPONENTS_CRASH_CONTENT_BROWSER_CRASH_DUMP_MANAGER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698