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

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

Issue 3333012: Linux: Handle renderer and plugin crashes on a separate thread. (try 2)... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 3 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 | « chrome/app/breakpad_linux.cc ('k') | chrome/browser/crash_handler_host_linux.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) 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 10 matching lines...) Expand all
33 // MessagePumbLibevent::Watcher impl: 38 // MessagePumbLibevent::Watcher impl:
34 virtual void OnFileCanWriteWithoutBlocking(int fd); 39 virtual void OnFileCanWriteWithoutBlocking(int fd);
35 virtual void OnFileCanReadWithoutBlocking(int fd); 40 virtual void OnFileCanReadWithoutBlocking(int fd);
36 41
37 // MessageLoop::DestructionObserver impl: 42 // MessageLoop::DestructionObserver impl:
38 virtual void WillDestroyCurrentMessageLoop(); 43 virtual void WillDestroyCurrentMessageLoop();
39 44
40 protected: 45 protected:
41 CrashHandlerHostLinux(); 46 CrashHandlerHostLinux();
42 virtual ~CrashHandlerHostLinux(); 47 virtual ~CrashHandlerHostLinux();
48 #if defined(USE_LINUX_BREAKPAD)
43 // This is here on purpose to make CrashHandlerHostLinux abstract. 49 // This is here on purpose to make CrashHandlerHostLinux abstract.
44 virtual void SetProcessType() = 0; 50 virtual void SetProcessType() = 0;
45 51
46 std::string process_type_; 52 std::string process_type_;
53 #endif
47 54
48 private: 55 private:
49 void Init(); 56 void Init();
50 57
51 int process_socket_; 58 int process_socket_;
52 int browser_socket_; 59 int browser_socket_;
60 #if defined(USE_LINUX_BREAKPAD)
53 MessageLoopForIO::FileDescriptorWatcher file_descriptor_watcher_; 61 MessageLoopForIO::FileDescriptorWatcher file_descriptor_watcher_;
62 scoped_ptr<base::Thread> uploader_thread_;
63 #endif
54 64
55 DISALLOW_COPY_AND_ASSIGN(CrashHandlerHostLinux); 65 DISALLOW_COPY_AND_ASSIGN(CrashHandlerHostLinux);
56 }; 66 };
57 67
58 class PluginCrashHandlerHostLinux : public CrashHandlerHostLinux { 68 class PluginCrashHandlerHostLinux : public CrashHandlerHostLinux {
59 private: 69 private:
60 friend struct DefaultSingletonTraits<PluginCrashHandlerHostLinux>; 70 friend struct DefaultSingletonTraits<PluginCrashHandlerHostLinux>;
61 PluginCrashHandlerHostLinux() { 71 PluginCrashHandlerHostLinux();
62 SetProcessType(); 72 virtual ~PluginCrashHandlerHostLinux();
63 }
64 virtual ~PluginCrashHandlerHostLinux() {}
65 73
66 virtual void SetProcessType() { 74 #if defined(USE_LINUX_BREAKPAD)
67 process_type_ = "plugin"; 75 virtual void SetProcessType();
68 } 76 #endif
69 77
70 DISALLOW_COPY_AND_ASSIGN(PluginCrashHandlerHostLinux); 78 DISALLOW_COPY_AND_ASSIGN(PluginCrashHandlerHostLinux);
71 }; 79 };
72 80
73 class RendererCrashHandlerHostLinux : public CrashHandlerHostLinux { 81 class RendererCrashHandlerHostLinux : public CrashHandlerHostLinux {
74 private: 82 private:
75 friend struct DefaultSingletonTraits<RendererCrashHandlerHostLinux>; 83 friend struct DefaultSingletonTraits<RendererCrashHandlerHostLinux>;
76 RendererCrashHandlerHostLinux() { 84 RendererCrashHandlerHostLinux();
77 SetProcessType(); 85 virtual ~RendererCrashHandlerHostLinux();
78 }
79 virtual ~RendererCrashHandlerHostLinux() {}
80 86
81 virtual void SetProcessType() { 87 #if defined(USE_LINUX_BREAKPAD)
82 process_type_ = "renderer"; 88 virtual void SetProcessType();
83 } 89 #endif
84 90
85 DISALLOW_COPY_AND_ASSIGN(RendererCrashHandlerHostLinux); 91 DISALLOW_COPY_AND_ASSIGN(RendererCrashHandlerHostLinux);
86 }; 92 };
87 93
88 #endif // CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_ 94 #endif // CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_
OLDNEW
« no previous file with comments | « chrome/app/breakpad_linux.cc ('k') | chrome/browser/crash_handler_host_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698