OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include "base/message_loop.h" |
| 10 |
| 11 #if defined(USE_LINUX_BREAKPAD) |
| 12 #include <sys/types.h> |
| 13 |
9 #include <string> | 14 #include <string> |
10 | 15 |
11 #include "base/message_loop.h" | |
12 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
13 | 17 |
14 template <typename T> struct DefaultSingletonTraits; | 18 class BreakpadInfo; |
15 | 19 |
16 namespace base { | 20 namespace base { |
17 class Thread; | 21 class Thread; |
18 } | 22 } |
| 23 #endif // defined(USE_LINUX_BREAKPAD) |
| 24 |
| 25 template <typename T> struct DefaultSingletonTraits; |
19 | 26 |
20 // This is the base class for singleton objects which crash dump renderers and | 27 // This is the base class for singleton objects which crash dump renderers and |
21 // plugins on Linux. We perform the crash dump from the browser because it | 28 // plugins on Linux. We perform the crash dump from the browser because it |
22 // allows us to be outside the sandbox. | 29 // allows us to be outside the sandbox. |
23 // | 30 // |
24 // PluginCrashHandlerHostLinux and RendererCrashHandlerHostLinux are singletons | 31 // PluginCrashHandlerHostLinux and RendererCrashHandlerHostLinux are singletons |
25 // that handle plugin and renderer crashes, respectively. | 32 // that handle plugin and renderer crashes, respectively. |
26 // | 33 // |
27 // Processes signal that they need to be dumped by sending a datagram over a | 34 // Processes signal that they need to be dumped by sending a datagram over a |
28 // UNIX domain socket. All processes of the same type share the client end of | 35 // UNIX domain socket. All processes of the same type share the client end of |
(...skipping 29 matching lines...) Expand all Loading... |
58 | 65 |
59 std::string process_type_; | 66 std::string process_type_; |
60 #endif | 67 #endif |
61 | 68 |
62 private: | 69 private: |
63 void Init(); | 70 void Init(); |
64 | 71 |
65 #if defined(USE_LINUX_BREAKPAD) | 72 #if defined(USE_LINUX_BREAKPAD) |
66 // This is here on purpose to make CrashHandlerHostLinux abstract. | 73 // This is here on purpose to make CrashHandlerHostLinux abstract. |
67 virtual void SetProcessType() = 0; | 74 virtual void SetProcessType() = 0; |
| 75 |
| 76 // Do work on the FILE thread for OnFileCanReadWithoutBlocking(). |
| 77 void WriteDumpFile(BreakpadInfo* info, |
| 78 pid_t crashing_pid, |
| 79 char* crash_context, |
| 80 int signal_fd); |
| 81 |
| 82 // Continue OnFileCanReadWithoutBlocking()'s work on the IO thread. |
| 83 void QueueCrashDumpTask(BreakpadInfo* info, int signal_fd); |
68 #endif | 84 #endif |
69 | 85 |
70 int process_socket_; | 86 int process_socket_; |
71 int browser_socket_; | 87 int browser_socket_; |
72 | 88 |
73 #if defined(USE_LINUX_BREAKPAD) | 89 #if defined(USE_LINUX_BREAKPAD) |
74 MessageLoopForIO::FileDescriptorWatcher file_descriptor_watcher_; | 90 MessageLoopForIO::FileDescriptorWatcher file_descriptor_watcher_; |
75 scoped_ptr<base::Thread> uploader_thread_; | 91 scoped_ptr<base::Thread> uploader_thread_; |
76 bool shutting_down_; | 92 bool shutting_down_; |
77 #endif | 93 #endif |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 virtual ~RendererCrashHandlerHostLinux(); | 140 virtual ~RendererCrashHandlerHostLinux(); |
125 | 141 |
126 #if defined(USE_LINUX_BREAKPAD) | 142 #if defined(USE_LINUX_BREAKPAD) |
127 virtual void SetProcessType(); | 143 virtual void SetProcessType(); |
128 #endif | 144 #endif |
129 | 145 |
130 DISALLOW_COPY_AND_ASSIGN(RendererCrashHandlerHostLinux); | 146 DISALLOW_COPY_AND_ASSIGN(RendererCrashHandlerHostLinux); |
131 }; | 147 }; |
132 | 148 |
133 #endif // CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_ | 149 #endif // CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_ |
OLD | NEW |