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

Side by Side Diff: chrome/browser/renderer_host/render_sandbox_host_linux.h

Issue 5519016: Add a new GetInstance() method for singleton classes used in chrome/browser files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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
OLDNEW
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 #pragma once 9 #pragma once
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/singleton.h" 14 #include "base/singleton.h"
joth 2010/12/08 17:15:07 remove
15 15
16 // This is a singleton object which handles sandbox requests from the 16 // This is a singleton object which handles sandbox requests from the
17 // renderers. 17 // renderers.
18 class RenderSandboxHostLinux { 18 class RenderSandboxHostLinux {
19 public: 19 public:
20 // Returns the singleton instance.
21 static RenderSandboxHostLinux* GetInstance();
22
20 // Get the file descriptor which renderers should be given in order to signal 23 // Get the file descriptor which renderers should be given in order to signal
21 // crashes to the browser. 24 // crashes to the browser.
22 int GetRendererSocket() const { 25 int GetRendererSocket() const {
23 DCHECK(initialized_); 26 DCHECK(initialized_);
24 return renderer_socket_; 27 return renderer_socket_;
25 } 28 }
26 pid_t pid() const { 29 pid_t pid() const {
27 DCHECK(initialized_); 30 DCHECK(initialized_);
28 return pid_; 31 return pid_;
29 } 32 }
30 void Init(const std::string& sandbox_path); 33 void Init(const std::string& sandbox_path);
31 34
32 private: 35 private:
33 friend struct DefaultSingletonTraits<RenderSandboxHostLinux>; 36 friend struct DefaultSingletonTraits<RenderSandboxHostLinux>;
34 // This object must be constructed on the main thread. 37 // This object must be constructed on the main thread.
35 RenderSandboxHostLinux(); 38 RenderSandboxHostLinux();
36 ~RenderSandboxHostLinux(); 39 ~RenderSandboxHostLinux();
37 40
38 // Whether Init() has been called yet. 41 // Whether Init() has been called yet.
39 bool initialized_; 42 bool initialized_;
40 43
41 int renderer_socket_; 44 int renderer_socket_;
42 int childs_lifeline_fd_; 45 int childs_lifeline_fd_;
43 pid_t pid_; 46 pid_t pid_;
44 47
45 DISALLOW_COPY_AND_ASSIGN(RenderSandboxHostLinux); 48 DISALLOW_COPY_AND_ASSIGN(RenderSandboxHostLinux);
46 }; 49 };
47 50
48 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_SANDBOX_HOST_LINUX_H_ 51 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_SANDBOX_HOST_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698