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

Side by Side Diff: chrome/browser/android/crash_dump_manager.h

Issue 11884042: Fix for a crasher when starting a renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/android/crash_dump_manager.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_ANDROID_CRASH_DUMP_MANAGER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_CRASH_DUMP_MANAGER_H_
6 #define CHROME_BROWSER_ANDROID_CRASH_DUMP_MANAGER_H_ 6 #define CHROME_BROWSER_ANDROID_CRASH_DUMP_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 11 matching lines...) Expand all
22 // On Android, because of process isolation, each renderer process runs with a 22 // On Android, because of process isolation, each renderer process runs with a
23 // different UID. As a result, we cannot generate the minidumps in the browser 23 // different UID. As a result, we cannot generate the minidumps in the browser
24 // (as the browser process does not have access to some system files for the 24 // (as the browser process does not have access to some system files for the
25 // crashed process). So the minidump is generated in the renderer process. 25 // crashed process). So the minidump is generated in the renderer process.
26 // Since the isolated process cannot open files, we provide it on creation with 26 // Since the isolated process cannot open files, we provide it on creation with
27 // a file descriptor where to write the minidump in the event of a crash. 27 // a file descriptor where to write the minidump in the event of a crash.
28 // This class creates these file descriptors and associates them with render 28 // This class creates these file descriptors and associates them with render
29 // processes and take the appropriate action when the render process terminates. 29 // processes and take the appropriate action when the render process terminates.
30 class CrashDumpManager : public content::NotificationObserver { 30 class CrashDumpManager : public content::NotificationObserver {
31 public: 31 public:
32 // Should be created on the UI thread. 32 // This object is a singleton created and owned by the
33 CrashDumpManager(); 33 // ChromeBrowserMainPartsAndroid.
34 static CrashDumpManager* GetInstance();
35
34 virtual ~CrashDumpManager(); 36 virtual ~CrashDumpManager();
35 37
36 // Returns a file descriptor that should be used to generate a minidump for 38 // Returns a file descriptor that should be used to generate a minidump for
37 // the process |child_process_id|. 39 // the process |child_process_id|.
38 int CreateMinidumpFile(int child_process_id); 40 int CreateMinidumpFile(int child_process_id);
39 41
40 private: 42 private:
43 friend class ChromeBrowserMainPartsAndroid;
44
45 // Should be created on the UI thread.
46 CrashDumpManager();
47
41 typedef std::map<int, FilePath> ChildProcessIDToMinidumpPath; 48 typedef std::map<int, FilePath> ChildProcessIDToMinidumpPath;
42 49
43 static void ProcessMinidump(const FilePath& minidump_path, 50 static void ProcessMinidump(const FilePath& minidump_path,
44 base::ProcessHandle pid); 51 base::ProcessHandle pid);
45 52
46 // NotificationObserver implementation: 53 // NotificationObserver implementation:
47 virtual void Observe(int type, 54 virtual void Observe(int type,
48 const content::NotificationSource& source, 55 const content::NotificationSource& source,
49 const content::NotificationDetails& details) OVERRIDE; 56 const content::NotificationDetails& details) OVERRIDE;
50 57
51 content::NotificationRegistrar notification_registrar_; 58 content::NotificationRegistrar notification_registrar_;
52 59
53 // This map should only be accessed with its lock aquired as it is accessed 60 // This map should only be accessed with its lock aquired as it is accessed
54 // from the PROCESS_LAUNCHER and UI threads. 61 // from the PROCESS_LAUNCHER and UI threads.
55 base::Lock child_process_id_to_minidump_path_lock_; 62 base::Lock child_process_id_to_minidump_path_lock_;
56 ChildProcessIDToMinidumpPath child_process_id_to_minidump_path_; 63 ChildProcessIDToMinidumpPath child_process_id_to_minidump_path_;
57 64
65 static CrashDumpManager* instance_;
66
58 DISALLOW_COPY_AND_ASSIGN(CrashDumpManager); 67 DISALLOW_COPY_AND_ASSIGN(CrashDumpManager);
59 }; 68 };
60 69
61 #endif // CHROME_BROWSER_ANDROID_CRASH_DUMP_MANAGER_H_ 70 #endif // CHROME_BROWSER_ANDROID_CRASH_DUMP_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/crash_dump_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698