OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 9 #include <string> |
10 | 10 |
| 11 #include "base/message_loop.h" |
| 12 #include "base/scoped_ptr.h" |
11 #include "base/singleton.h" | 13 #include "base/singleton.h" |
12 #include "base/message_loop.h" | 14 |
| 15 namespace base { |
| 16 class Thread; |
| 17 } |
13 | 18 |
14 // This is the base class for singleton objects which crash dump renderers and | 19 // This is the base class for singleton objects which crash dump renderers and |
15 // plugins on Linux. We perform the crash dump from the browser because it | 20 // plugins on Linux. We perform the crash dump from the browser because it |
16 // allows us to be outside the sandbox. | 21 // allows us to be outside the sandbox. |
17 // | 22 // |
18 // PluginCrashHandlerHostLinux and RendererCrashHandlerHostLinux are singletons | 23 // PluginCrashHandlerHostLinux and RendererCrashHandlerHostLinux are singletons |
19 // that handle plugin and renderer crashes, respectively. | 24 // that handle plugin and renderer crashes, respectively. |
20 // | 25 // |
21 // Processes signal that they need to be dumped by sending a datagram over a | 26 // Processes signal that they need to be dumped by sending a datagram over a |
22 // UNIX domain socket. All processes of the same type share the client end of | 27 // UNIX domain socket. All processes of the same type share the client end of |
(...skipping 21 matching lines...) Expand all Loading... |
44 virtual void SetProcessType() = 0; | 49 virtual void SetProcessType() = 0; |
45 | 50 |
46 std::string process_type_; | 51 std::string process_type_; |
47 | 52 |
48 private: | 53 private: |
49 void Init(); | 54 void Init(); |
50 | 55 |
51 int process_socket_; | 56 int process_socket_; |
52 int browser_socket_; | 57 int browser_socket_; |
53 MessageLoopForIO::FileDescriptorWatcher file_descriptor_watcher_; | 58 MessageLoopForIO::FileDescriptorWatcher file_descriptor_watcher_; |
| 59 scoped_ptr<base::Thread> uploader_thread_; |
54 | 60 |
55 DISALLOW_COPY_AND_ASSIGN(CrashHandlerHostLinux); | 61 DISALLOW_COPY_AND_ASSIGN(CrashHandlerHostLinux); |
56 }; | 62 }; |
57 | 63 |
58 class PluginCrashHandlerHostLinux : public CrashHandlerHostLinux { | 64 class PluginCrashHandlerHostLinux : public CrashHandlerHostLinux { |
59 private: | 65 private: |
60 friend struct DefaultSingletonTraits<PluginCrashHandlerHostLinux>; | 66 friend struct DefaultSingletonTraits<PluginCrashHandlerHostLinux>; |
61 PluginCrashHandlerHostLinux() { | 67 PluginCrashHandlerHostLinux(); |
62 SetProcessType(); | 68 virtual ~PluginCrashHandlerHostLinux(); |
63 } | |
64 virtual ~PluginCrashHandlerHostLinux() {} | |
65 | 69 |
66 virtual void SetProcessType() { | 70 virtual void SetProcessType(); |
67 process_type_ = "plugin"; | |
68 } | |
69 | 71 |
70 DISALLOW_COPY_AND_ASSIGN(PluginCrashHandlerHostLinux); | 72 DISALLOW_COPY_AND_ASSIGN(PluginCrashHandlerHostLinux); |
71 }; | 73 }; |
72 | 74 |
73 class RendererCrashHandlerHostLinux : public CrashHandlerHostLinux { | 75 class RendererCrashHandlerHostLinux : public CrashHandlerHostLinux { |
74 private: | 76 private: |
75 friend struct DefaultSingletonTraits<RendererCrashHandlerHostLinux>; | 77 friend struct DefaultSingletonTraits<RendererCrashHandlerHostLinux>; |
76 RendererCrashHandlerHostLinux() { | 78 RendererCrashHandlerHostLinux(); |
77 SetProcessType(); | 79 virtual ~RendererCrashHandlerHostLinux(); |
78 } | |
79 virtual ~RendererCrashHandlerHostLinux() {} | |
80 | 80 |
81 virtual void SetProcessType() { | 81 virtual void SetProcessType(); |
82 process_type_ = "renderer"; | |
83 } | |
84 | 82 |
85 DISALLOW_COPY_AND_ASSIGN(RendererCrashHandlerHostLinux); | 83 DISALLOW_COPY_AND_ASSIGN(RendererCrashHandlerHostLinux); |
86 }; | 84 }; |
87 | 85 |
88 #endif // CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_ | 86 #endif // CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_ |
OLD | NEW |