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" | |
13 #include "base/singleton.h" | 10 #include "base/singleton.h" |
14 | 11 |
15 // This is a singleton object which handles sandbox requests from the | 12 // This is a singleton object which handles sandbox requests from the |
16 // renderers. | 13 // renderers. |
17 class RenderSandboxHostLinux { | 14 class RenderSandboxHostLinux { |
18 public: | 15 public: |
19 // Get the file descriptor which renderers should be given in order to signal | 16 // Get the file descriptor which renderers should be given in order to signal |
20 // crashes to the browser. | 17 // crashes to the browser. |
21 int GetRendererSocket() const { | 18 int GetRendererSocket() const { return renderer_socket_; } |
22 DCHECK(init_); | 19 pid_t pid() const { return pid_; } |
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); | |
30 | 20 |
31 private: | 21 private: |
32 friend struct DefaultSingletonTraits<RenderSandboxHostLinux>; | 22 friend struct DefaultSingletonTraits<RenderSandboxHostLinux>; |
33 // This object must be constructed on the main thread. | 23 // This object must be constructed on the main thread. |
34 RenderSandboxHostLinux(); | 24 RenderSandboxHostLinux(); |
35 ~RenderSandboxHostLinux(); | 25 ~RenderSandboxHostLinux(); |
36 | 26 |
37 bool init_; | |
38 int renderer_socket_; | 27 int renderer_socket_; |
39 int childs_lifeline_fd_; | 28 int childs_lifeline_fd_; |
40 pid_t pid_; | 29 pid_t pid_; |
41 | 30 |
42 DISALLOW_COPY_AND_ASSIGN(RenderSandboxHostLinux); | 31 DISALLOW_EVIL_CONSTRUCTORS(RenderSandboxHostLinux); |
43 }; | 32 }; |
44 | 33 |
45 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_SANDBOX_HOST_LINUX_H_ | 34 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_SANDBOX_HOST_LINUX_H_ |
OLD | NEW |