Commit 6f55e9ea authored by mdempsky@chromium.org's avatar mdempsky@chromium.org

Fix misuses of DISALLOW_IMPLICIT_CONSTRUCTORS()

DISALLOW_IMPLICIT_CONSTRUCTORS() should be used when we don't want any
implicit functions; but in the cases this CL touches, we just want the
default constructor to be private, not disallowed.

BUG=375000

Review URL: https://codereview.chromium.org/291063002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271592 0039d316-1c4b-4281-b951-d872f2087c98
parent f2f4404f
...@@ -85,6 +85,9 @@ class LinuxSandbox { ...@@ -85,6 +85,9 @@ class LinuxSandbox {
private: private:
friend struct DefaultSingletonTraits<LinuxSandbox>; friend struct DefaultSingletonTraits<LinuxSandbox>;
LinuxSandbox();
~LinuxSandbox();
// Some methods are static and get an instance of the Singleton. These // Some methods are static and get an instance of the Singleton. These
// are the non-static implementations. // are the non-static implementations.
bool InitializeSandboxImpl(); bool InitializeSandboxImpl();
...@@ -118,8 +121,7 @@ class LinuxSandbox { ...@@ -118,8 +121,7 @@ class LinuxSandbox {
bool yama_is_enforcing_; // Accurate if pre_initialized_. bool yama_is_enforcing_; // Accurate if pre_initialized_.
scoped_ptr<sandbox::SetuidSandboxClient> setuid_sandbox_client_; scoped_ptr<sandbox::SetuidSandboxClient> setuid_sandbox_client_;
~LinuxSandbox(); DISALLOW_COPY_AND_ASSIGN(LinuxSandbox);
DISALLOW_IMPLICIT_CONSTRUCTORS(LinuxSandbox);
}; };
} // namespace content } // namespace content
......
...@@ -63,10 +63,6 @@ class SANDBOX_EXPORT Trap { ...@@ -63,10 +63,6 @@ class SANDBOX_EXPORT Trap {
static ErrorCode ErrorCodeFromTrapId(uint16_t id); static ErrorCode ErrorCodeFromTrapId(uint16_t id);
private: private:
// The destructor is unimplemented. Don't ever attempt to destruct this
// object. It'll break subsequent system calls that trigger a SIGSYS.
~Trap();
struct TrapKey { struct TrapKey {
TrapKey(TrapFnc f, const void* a, bool s) : fnc(f), aux(a), safe(s) {} TrapKey(TrapFnc f, const void* a, bool s) : fnc(f), aux(a), safe(s) {}
TrapFnc fnc; TrapFnc fnc;
...@@ -76,6 +72,14 @@ class SANDBOX_EXPORT Trap { ...@@ -76,6 +72,14 @@ class SANDBOX_EXPORT Trap {
}; };
typedef std::map<TrapKey, uint16_t> TrapIds; typedef std::map<TrapKey, uint16_t> TrapIds;
// Our constructor is private. A shared global instance is created
// automatically as needed.
Trap();
// The destructor is unimplemented. Don't ever attempt to destruct this
// object. It'll break subsequent system calls that trigger a SIGSYS.
~Trap();
// We only have a very small number of methods. We opt to make them static // We only have a very small number of methods. We opt to make them static
// and have them internally call GetInstance(). This is a little more // and have them internally call GetInstance(). This is a little more
// convenient than having each caller obtain short-lived reference to the // convenient than having each caller obtain short-lived reference to the
...@@ -105,11 +109,9 @@ class SANDBOX_EXPORT Trap { ...@@ -105,11 +109,9 @@ class SANDBOX_EXPORT Trap {
size_t trap_array_capacity_; // Currently allocated capacity of array size_t trap_array_capacity_; // Currently allocated capacity of array
bool has_unsafe_traps_; // Whether unsafe traps have been enabled bool has_unsafe_traps_; // Whether unsafe traps have been enabled
// Our constructor is private. A shared global instance is created
// automatically as needed.
// Copying and assigning is unimplemented. It doesn't make sense for a // Copying and assigning is unimplemented. It doesn't make sense for a
// singleton. // singleton.
DISALLOW_IMPLICIT_CONSTRUCTORS(Trap); DISALLOW_COPY_AND_ASSIGN(Trap);
}; };
} // namespace sandbox } // namespace sandbox
......
...@@ -92,10 +92,13 @@ class SANDBOX_EXPORT SetuidSandboxClient { ...@@ -92,10 +92,13 @@ class SANDBOX_EXPORT SetuidSandboxClient {
void SetupLaunchEnvironment(); void SetupLaunchEnvironment();
private: private:
SetuidSandboxClient();
// Holds the environment. Will never be NULL. // Holds the environment. Will never be NULL.
base::Environment* env_; base::Environment* env_;
bool sandboxed_; bool sandboxed_;
DISALLOW_IMPLICIT_CONSTRUCTORS(SetuidSandboxClient);
DISALLOW_COPY_AND_ASSIGN(SetuidSandboxClient);
}; };
} // namespace sandbox } // namespace sandbox
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment