Revert 268405 "Make sure that ScratchBuffer::Allocate() always r..."
[chromium-blink-merge.git] / content / browser / renderer_host / render_sandbox_host_linux.h
blob2c5df388bd29f84540d179947420c4ca22158efc
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_SANDBOX_HOST_LINUX_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_SANDBOX_HOST_LINUX_H_
8 #include <string>
10 #include "base/logging.h"
11 #include "content/common/content_export.h"
13 template <typename T> struct DefaultSingletonTraits;
15 namespace content {
17 // This is a singleton object which handles sandbox requests from the
18 // renderers.
19 class CONTENT_EXPORT RenderSandboxHostLinux {
20 public:
21 // Returns the singleton instance.
22 static RenderSandboxHostLinux* GetInstance();
24 // Get the file descriptor which renderers should be given in order to signal
25 // crashes to the browser.
26 int GetRendererSocket() const {
27 DCHECK(initialized_);
28 return renderer_socket_;
30 pid_t pid() const {
31 DCHECK(initialized_);
32 return pid_;
34 void Init(const std::string& sandbox_path);
36 private:
37 friend struct DefaultSingletonTraits<RenderSandboxHostLinux>;
38 // This object must be constructed on the main thread.
39 RenderSandboxHostLinux();
40 ~RenderSandboxHostLinux();
42 // Whether Init() has been called yet.
43 bool initialized_;
45 int renderer_socket_;
46 int childs_lifeline_fd_;
47 pid_t pid_;
49 DISALLOW_COPY_AND_ASSIGN(RenderSandboxHostLinux);
52 } // namespace content
54 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_SANDBOX_HOST_LINUX_H_