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

Side by Side Diff: chrome/browser/crash_handler_host_linux.h

Issue 18770006: Remove USE_LINUX_BREAKPAD ifdef since we don't need it for chromium anymore. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: android build fix per cjhopman Created 7 years, 5 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
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_CRASH_HANDLER_HOST_LINUX_H_ 5 #ifndef CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_
6 #define CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_ 6 #define CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 10
11 #if defined(USE_LINUX_BREAKPAD)
12 #include <sys/types.h> 11 #include <sys/types.h>
Lei Zhang 2013/07/15 20:55:35 ditto, sort all the #includes
jam 2013/07/15 21:15:28 Done.
13 12
14 #include <string> 13 #include <string>
15 14
16 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
17 16
18 struct BreakpadInfo; 17 struct BreakpadInfo;
19 18
20 namespace base { 19 namespace base {
21 class Thread; 20 class Thread;
22 } 21 }
23 #endif // defined(USE_LINUX_BREAKPAD)
24 22
25 template <typename T> struct DefaultSingletonTraits; 23 template <typename T> struct DefaultSingletonTraits;
26 24
27 // This is the base class for singleton objects which crash dump renderers and 25 // This is the base class for singleton objects which crash dump renderers and
28 // plugins on Linux or Android. We perform the crash dump from the browser 26 // plugins on Linux or Android. We perform the crash dump from the browser
29 // because it allows us to be outside the sandbox. 27 // because it allows us to be outside the sandbox.
30 // 28 //
31 // PluginCrashHandlerHostLinux and RendererCrashHandlerHostLinux are 29 // PluginCrashHandlerHostLinux and RendererCrashHandlerHostLinux are
32 // singletons that handle plugin and renderer crashes, respectively. 30 // singletons that handle plugin and renderer crashes, respectively.
33 // 31 //
34 // Processes signal that they need to be dumped by sending a datagram over a 32 // Processes signal that they need to be dumped by sending a datagram over a
35 // UNIX domain socket. All processes of the same type share the client end of 33 // UNIX domain socket. All processes of the same type share the client end of
36 // this socket which is installed in their descriptor table before exec. 34 // this socket which is installed in their descriptor table before exec.
37 class CrashHandlerHostLinux : public base::MessageLoopForIO::Watcher, 35 class CrashHandlerHostLinux : public base::MessageLoopForIO::Watcher,
38 public base::MessageLoop::DestructionObserver { 36 public base::MessageLoop::DestructionObserver {
39 public: 37 public:
40 // Get the file descriptor which processes should be given in order to signal 38 // Get the file descriptor which processes should be given in order to signal
41 // crashes to the browser. 39 // crashes to the browser.
42 int GetDeathSignalSocket() const { 40 int GetDeathSignalSocket() const {
43 return process_socket_; 41 return process_socket_;
44 } 42 }
45 43
46 // MessagePumbLibevent::Watcher impl: 44 // MessagePumbLibevent::Watcher impl:
47 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; 45 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;
48 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; 46 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
49 47
50 // MessageLoop::DestructionObserver impl: 48 // MessageLoop::DestructionObserver impl:
51 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; 49 virtual void WillDestroyCurrentMessageLoop() OVERRIDE;
52 50
53 #if defined(USE_LINUX_BREAKPAD)
54 // Whether we are shutting down or not. 51 // Whether we are shutting down or not.
55 bool IsShuttingDown() const; 52 bool IsShuttingDown() const;
56 #endif
57 53
58 protected: 54 protected:
59 CrashHandlerHostLinux(); 55 CrashHandlerHostLinux();
60 virtual ~CrashHandlerHostLinux(); 56 virtual ~CrashHandlerHostLinux();
61 57
62 #if defined(USE_LINUX_BREAKPAD)
63 // Only called in concrete subclasses. 58 // Only called in concrete subclasses.
64 void InitCrashUploaderThread(); 59 void InitCrashUploaderThread();
65 60
66 std::string process_type_; 61 std::string process_type_;
67 #endif
68 62
69 private: 63 private:
70 void Init(); 64 void Init();
71 65
72 #if defined(USE_LINUX_BREAKPAD)
73 // This is here on purpose to make CrashHandlerHostLinux abstract. 66 // This is here on purpose to make CrashHandlerHostLinux abstract.
74 virtual void SetProcessType() = 0; 67 virtual void SetProcessType() = 0;
75 68
76 // Do work on the FILE thread for OnFileCanReadWithoutBlocking(). 69 // Do work on the FILE thread for OnFileCanReadWithoutBlocking().
77 void WriteDumpFile(BreakpadInfo* info, 70 void WriteDumpFile(BreakpadInfo* info,
78 pid_t crashing_pid, 71 pid_t crashing_pid,
79 char* crash_context, 72 char* crash_context,
80 int signal_fd); 73 int signal_fd);
81 74
82 // Continue OnFileCanReadWithoutBlocking()'s work on the IO thread. 75 // Continue OnFileCanReadWithoutBlocking()'s work on the IO thread.
83 void QueueCrashDumpTask(BreakpadInfo* info, int signal_fd); 76 void QueueCrashDumpTask(BreakpadInfo* info, int signal_fd);
84 #endif
85 77
86 int process_socket_; 78 int process_socket_;
87 int browser_socket_; 79 int browser_socket_;
88 80
89 #if defined(USE_LINUX_BREAKPAD)
90 base::MessageLoopForIO::FileDescriptorWatcher file_descriptor_watcher_; 81 base::MessageLoopForIO::FileDescriptorWatcher file_descriptor_watcher_;
91 scoped_ptr<base::Thread> uploader_thread_; 82 scoped_ptr<base::Thread> uploader_thread_;
92 bool shutting_down_; 83 bool shutting_down_;
93 #endif
94 84
95 #if defined(ADDRESS_SANITIZER) 85 #if defined(ADDRESS_SANITIZER)
96 char* asan_report_str_; 86 char* asan_report_str_;
97 #endif 87 #endif
98 88
99 DISALLOW_COPY_AND_ASSIGN(CrashHandlerHostLinux); 89 DISALLOW_COPY_AND_ASSIGN(CrashHandlerHostLinux);
100 }; 90 };
101 91
102 class ExtensionCrashHandlerHostLinux : public CrashHandlerHostLinux { 92 class ExtensionCrashHandlerHostLinux : public CrashHandlerHostLinux {
103 public: 93 public:
104 // Returns the singleton instance. 94 // Returns the singleton instance.
105 static ExtensionCrashHandlerHostLinux* GetInstance(); 95 static ExtensionCrashHandlerHostLinux* GetInstance();
106 96
107 private: 97 private:
108 friend struct DefaultSingletonTraits<ExtensionCrashHandlerHostLinux>; 98 friend struct DefaultSingletonTraits<ExtensionCrashHandlerHostLinux>;
109 ExtensionCrashHandlerHostLinux(); 99 ExtensionCrashHandlerHostLinux();
110 virtual ~ExtensionCrashHandlerHostLinux(); 100 virtual ~ExtensionCrashHandlerHostLinux();
111 101
112 #if defined(USE_LINUX_BREAKPAD)
113 virtual void SetProcessType() OVERRIDE; 102 virtual void SetProcessType() OVERRIDE;
114 #endif
115 103
116 DISALLOW_COPY_AND_ASSIGN(ExtensionCrashHandlerHostLinux); 104 DISALLOW_COPY_AND_ASSIGN(ExtensionCrashHandlerHostLinux);
117 }; 105 };
118 106
119 class GpuCrashHandlerHostLinux : public CrashHandlerHostLinux { 107 class GpuCrashHandlerHostLinux : public CrashHandlerHostLinux {
120 public: 108 public:
121 // Returns the singleton instance. 109 // Returns the singleton instance.
122 static GpuCrashHandlerHostLinux* GetInstance(); 110 static GpuCrashHandlerHostLinux* GetInstance();
123 111
124 private: 112 private:
125 friend struct DefaultSingletonTraits<GpuCrashHandlerHostLinux>; 113 friend struct DefaultSingletonTraits<GpuCrashHandlerHostLinux>;
126 GpuCrashHandlerHostLinux(); 114 GpuCrashHandlerHostLinux();
127 virtual ~GpuCrashHandlerHostLinux(); 115 virtual ~GpuCrashHandlerHostLinux();
128 116
129 #if defined(USE_LINUX_BREAKPAD)
130 virtual void SetProcessType() OVERRIDE; 117 virtual void SetProcessType() OVERRIDE;
131 #endif
132 118
133 DISALLOW_COPY_AND_ASSIGN(GpuCrashHandlerHostLinux); 119 DISALLOW_COPY_AND_ASSIGN(GpuCrashHandlerHostLinux);
134 }; 120 };
135 121
136 class PluginCrashHandlerHostLinux : public CrashHandlerHostLinux { 122 class PluginCrashHandlerHostLinux : public CrashHandlerHostLinux {
137 public: 123 public:
138 // Returns the singleton instance. 124 // Returns the singleton instance.
139 static PluginCrashHandlerHostLinux* GetInstance(); 125 static PluginCrashHandlerHostLinux* GetInstance();
140 126
141 private: 127 private:
142 friend struct DefaultSingletonTraits<PluginCrashHandlerHostLinux>; 128 friend struct DefaultSingletonTraits<PluginCrashHandlerHostLinux>;
143 PluginCrashHandlerHostLinux(); 129 PluginCrashHandlerHostLinux();
144 virtual ~PluginCrashHandlerHostLinux(); 130 virtual ~PluginCrashHandlerHostLinux();
145 131
146 #if defined(USE_LINUX_BREAKPAD)
147 virtual void SetProcessType() OVERRIDE; 132 virtual void SetProcessType() OVERRIDE;
148 #endif
149 133
150 DISALLOW_COPY_AND_ASSIGN(PluginCrashHandlerHostLinux); 134 DISALLOW_COPY_AND_ASSIGN(PluginCrashHandlerHostLinux);
151 }; 135 };
152 136
153 class PpapiCrashHandlerHostLinux : public CrashHandlerHostLinux { 137 class PpapiCrashHandlerHostLinux : public CrashHandlerHostLinux {
154 public: 138 public:
155 // Returns the singleton instance. 139 // Returns the singleton instance.
156 static PpapiCrashHandlerHostLinux* GetInstance(); 140 static PpapiCrashHandlerHostLinux* GetInstance();
157 141
158 private: 142 private:
159 friend struct DefaultSingletonTraits<PpapiCrashHandlerHostLinux>; 143 friend struct DefaultSingletonTraits<PpapiCrashHandlerHostLinux>;
160 PpapiCrashHandlerHostLinux(); 144 PpapiCrashHandlerHostLinux();
161 virtual ~PpapiCrashHandlerHostLinux(); 145 virtual ~PpapiCrashHandlerHostLinux();
162 146
163 #if defined(USE_LINUX_BREAKPAD)
164 virtual void SetProcessType() OVERRIDE; 147 virtual void SetProcessType() OVERRIDE;
165 #endif
166 148
167 DISALLOW_COPY_AND_ASSIGN(PpapiCrashHandlerHostLinux); 149 DISALLOW_COPY_AND_ASSIGN(PpapiCrashHandlerHostLinux);
168 }; 150 };
169 151
170 class RendererCrashHandlerHostLinux : public CrashHandlerHostLinux { 152 class RendererCrashHandlerHostLinux : public CrashHandlerHostLinux {
171 public: 153 public:
172 // Returns the singleton instance. 154 // Returns the singleton instance.
173 static RendererCrashHandlerHostLinux* GetInstance(); 155 static RendererCrashHandlerHostLinux* GetInstance();
174 156
175 private: 157 private:
176 friend struct DefaultSingletonTraits<RendererCrashHandlerHostLinux>; 158 friend struct DefaultSingletonTraits<RendererCrashHandlerHostLinux>;
177 RendererCrashHandlerHostLinux(); 159 RendererCrashHandlerHostLinux();
178 virtual ~RendererCrashHandlerHostLinux(); 160 virtual ~RendererCrashHandlerHostLinux();
179 161
180 #if defined(USE_LINUX_BREAKPAD)
181 virtual void SetProcessType() OVERRIDE; 162 virtual void SetProcessType() OVERRIDE;
182 #endif
183 163
184 DISALLOW_COPY_AND_ASSIGN(RendererCrashHandlerHostLinux); 164 DISALLOW_COPY_AND_ASSIGN(RendererCrashHandlerHostLinux);
185 }; 165 };
186 166
187 #endif // CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_ 167 #endif // CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698