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

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

Issue 11189068: Changing minidump process generation to be in-process on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 8 years, 2 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_ANDROID_CRASH_DUMP_MANAGER_H_
6 #define CHROME_BROWSER_ANDROID_CRASH_DUMP_MANAGER_H_
7
8 #include <map>
9
10 #include "base/file_path.h"
11 #include "base/memory/singleton.h"
Lei Zhang 2012/10/23 02:57:34 nit: unused
Jay Civelli 2012/10/23 20:39:55 Done.
12 #include "base/platform_file.h"
13 #include "base/synchronization/lock.h"
14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h"
16
17 namespace content {
18 class RenderProcessHost;
19 }
20
21 // This class manages the crash minidumps.
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
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.
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.
28 // This class creates these file descriptors and associates them with render
29 // processes and take the appropriate action when the render process terminates.
30 class CrashDumpManager : public content::NotificationObserver {
31 public:
32 // Should be created on the UI thread.
33 CrashDumpManager();
34 virtual ~CrashDumpManager();
35
36 // Returns a file descriptor that should be used to generate a minidump for
37 // the process |process_host_id|.
38 int CreateMinidumpFile(int process_host_id);
39
40 private:
41 struct MinidumpInfo {
42 MinidumpInfo() : file(base::kInvalidPlatformFileValue) {}
43 base::PlatformFile file;
44 FilePath path;
45 int pid;
46 };
47
48 static void ProcessMinidump(const MinidumpInfo& minidump);
49
50 // NotificationObserver implementation:
51 virtual void Observe(int type,
52 const content::NotificationSource& source,
53 const content::NotificationDetails& details) OVERRIDE;
54
55 content::NotificationRegistrar notification_registrar_;
56
57 // This map should only be accessed with its lock aquired as it is accessed
58 // from the PROCESS_LAUNCHER and UI threads.
59 base::Lock process_host_id_to_minidump_info_lock_;
60 typedef std::map<int, MinidumpInfo> ProcessHostIDToMinidumpInfo;
Lei Zhang 2012/10/23 02:57:34 nit: goes near the top of the private section, not
Jay Civelli 2012/10/23 20:39:55 Done.
61 ProcessHostIDToMinidumpInfo process_host_id_to_minidump_info_;
62
63 DISALLOW_COPY_AND_ASSIGN(CrashDumpManager);
64 };
65
66 #endif // CHROME_BROWSER_ANDROID_CRASH_DUMP_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698