Chromium Code Reviews| Index: chrome/browser/crash_handler_host_linux.h |
| =================================================================== |
| --- chrome/browser/crash_handler_host_linux.h (revision 31186) |
| +++ chrome/browser/crash_handler_host_linux.h (working copy) |
| @@ -2,26 +2,31 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_CRASH_HANDLER_HOST_LINUX_H_ |
| -#define CHROME_BROWSER_RENDERER_HOST_RENDER_CRASH_HANDLER_HOST_LINUX_H_ |
| +#ifndef CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_ |
| +#define CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_ |
| +#include <string> |
| + |
| #include "base/singleton.h" |
| #include "base/message_loop.h" |
| -// This is a singleton object which crash dumps renderers on Linux. We perform |
| -// the crash dump from the browser because it allows us to be outside the |
| -// sandbox. |
| +// This is the base class for singleton objects which crash dumps renderers and |
|
agl
2009/11/06 20:00:22
s/dumps/dump/
|
| +// plugins on Linux. We perform the crash dump from the browser because it |
| +// allows us to be outside the sandbox. |
| // |
| -// Renderers signal that they need to be dumped by sending a datagram over a |
| -// UNIX domain socket. All renderers share the client end of this socket which |
| -// is installed in their descriptor table before exec. |
| -class RenderCrashHandlerHostLinux : public MessageLoopForIO::Watcher, |
| - public MessageLoop::DestructionObserver { |
| +// PluginCrashHandlerHostLinux and RendererCrashHandlerHostLinux are singletons |
| +// that handle plugin and renderer crashes, respectively. |
| +// |
| +// Processes signal that they need to be dumped by sending a datagram over a |
| +// UNIX domain socket. All processes of the same type share the client end of |
| +// this socket which is installed in their descriptor table before exec. |
| +class CrashHandlerHostLinux : public MessageLoopForIO::Watcher, |
| + public MessageLoop::DestructionObserver { |
| public: |
| - // Get the file descriptor which renderers should be given in order to signal |
| + // Get the file descriptor which processes should be given in order to signal |
| // crashes to the browser. |
| int GetDeathSignalSocket() const { |
| - return renderer_socket_; |
| + return process_socket_; |
| } |
| // MessagePumbLibevent::Watcher impl: |
| @@ -31,17 +36,52 @@ |
| // MessageLoop::DestructionObserver impl: |
| virtual void WillDestroyCurrentMessageLoop(); |
| + protected: |
| + CrashHandlerHostLinux(); |
| + ~CrashHandlerHostLinux(); |
| + // This is here on purpose to make CrashHandlerHostLinux abstract. |
| + virtual void SetProcessType() = 0; |
| + |
| + std::string process_type_; |
| + |
| private: |
| - friend struct DefaultSingletonTraits<RenderCrashHandlerHostLinux>; |
| - RenderCrashHandlerHostLinux(); |
| - ~RenderCrashHandlerHostLinux(); |
| void Init(); |
| - int renderer_socket_; |
| + int process_socket_; |
| int browser_socket_; |
| MessageLoopForIO::FileDescriptorWatcher file_descriptor_watcher_; |
| - DISALLOW_EVIL_CONSTRUCTORS(RenderCrashHandlerHostLinux); |
| + DISALLOW_COPY_AND_ASSIGN(CrashHandlerHostLinux); |
| }; |
| -#endif // CHROME_BROWSER_RENDERER_HOST_RENDER_CRASH_HANDLER_HOST_LINUX_H_ |
| +class PluginCrashHandlerHostLinux : public CrashHandlerHostLinux { |
| + private: |
| + friend struct DefaultSingletonTraits<PluginCrashHandlerHostLinux>; |
| + PluginCrashHandlerHostLinux() { |
| + SetProcessType(); |
| + } |
| + ~PluginCrashHandlerHostLinux() {} |
| + |
| + virtual void SetProcessType() { |
| + process_type_ = "plugin"; |
| + } |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PluginCrashHandlerHostLinux); |
| +}; |
| + |
| +class RendererCrashHandlerHostLinux : public CrashHandlerHostLinux { |
| + private: |
| + friend struct DefaultSingletonTraits<RendererCrashHandlerHostLinux>; |
| + RendererCrashHandlerHostLinux() { |
| + SetProcessType(); |
| + } |
| + ~RendererCrashHandlerHostLinux() {} |
| + |
| + virtual void SetProcessType() { |
| + process_type_ = "renderer"; |
| + } |
| + |
| + DISALLOW_COPY_AND_ASSIGN(RendererCrashHandlerHostLinux); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_ |
| Property changes on: chrome/browser/crash_handler_host_linux.h |
| ___________________________________________________________________ |
| Added: svn:mergeinfo |
| Merged /branches/chrome_webkit_merge_branch/chrome/browser/renderer_host/render_crash_handler_host_linux.h:r69-2775 |
| Added: svn:eol-style |
| + LF |