| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // http://code.google.com/p/chromium/wiki/LinuxSandboxIPC | 5 // http://code.google.com/p/chromium/wiki/LinuxSandboxIPC |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_SANDBOX_HOST_LINUX_H_ | 7 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_SANDBOX_HOST_LINUX_H_ |
| 8 #define CHROME_BROWSER_RENDERER_HOST_RENDER_SANDBOX_HOST_LINUX_H_ | 8 #define CHROME_BROWSER_RENDERER_HOST_RENDER_SANDBOX_HOST_LINUX_H_ |
| 9 | 9 |
| 10 #include <string> |
| 11 |
| 12 #include "base/logging.h" |
| 10 #include "base/singleton.h" | 13 #include "base/singleton.h" |
| 11 | 14 |
| 12 // This is a singleton object which handles sandbox requests from the | 15 // This is a singleton object which handles sandbox requests from the |
| 13 // renderers. | 16 // renderers. |
| 14 class RenderSandboxHostLinux { | 17 class RenderSandboxHostLinux { |
| 15 public: | 18 public: |
| 16 // Get the file descriptor which renderers should be given in order to signal | 19 // Get the file descriptor which renderers should be given in order to signal |
| 17 // crashes to the browser. | 20 // crashes to the browser. |
| 18 int GetRendererSocket() const { return renderer_socket_; } | 21 int GetRendererSocket() const { |
| 19 pid_t pid() const { return pid_; } | 22 DCHECK(init_); |
| 23 return renderer_socket_; |
| 24 } |
| 25 pid_t pid() const { |
| 26 DCHECK(init_); |
| 27 return pid_; |
| 28 } |
| 29 void Init(const std::string& sandbox_path); |
| 20 | 30 |
| 21 private: | 31 private: |
| 22 friend struct DefaultSingletonTraits<RenderSandboxHostLinux>; | 32 friend struct DefaultSingletonTraits<RenderSandboxHostLinux>; |
| 23 // This object must be constructed on the main thread. | 33 // This object must be constructed on the main thread. |
| 24 RenderSandboxHostLinux(); | 34 RenderSandboxHostLinux(); |
| 25 ~RenderSandboxHostLinux(); | 35 ~RenderSandboxHostLinux(); |
| 26 | 36 |
| 37 bool init_; |
| 27 int renderer_socket_; | 38 int renderer_socket_; |
| 28 int childs_lifeline_fd_; | 39 int childs_lifeline_fd_; |
| 29 pid_t pid_; | 40 pid_t pid_; |
| 30 | 41 |
| 31 DISALLOW_EVIL_CONSTRUCTORS(RenderSandboxHostLinux); | 42 DISALLOW_COPY_AND_ASSIGN(RenderSandboxHostLinux); |
| 32 }; | 43 }; |
| 33 | 44 |
| 34 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_SANDBOX_HOST_LINUX_H_ | 45 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_SANDBOX_HOST_LINUX_H_ |
| OLD | NEW |