Chromium Code Reviews| Index: content/browser/gpu/gpu_process_host.cc |
| diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc |
| index 8c7a8825a0266151a0a8c1dac9b7e472e68b48b9..5c6f9f6c0102c4865cc641996e3cb78c14d088f2 100644 |
| --- a/content/browser/gpu/gpu_process_host.cc |
| +++ b/content/browser/gpu/gpu_process_host.cc |
| @@ -33,6 +33,7 @@ |
| #include "content/public/common/content_client.h" |
| #include "content/public/common/content_switches.h" |
| #include "content/public/common/result_codes.h" |
| +#include "content/public/common/sandboxed_process_launcher_delegate.h" |
| #include "gpu/command_buffer/service/gpu_switches.h" |
| #include "ipc/ipc_channel_handle.h" |
| #include "ipc/ipc_switches.h" |
| @@ -43,7 +44,6 @@ |
| #if defined(OS_WIN) |
| #include "base/win/windows_version.h" |
| #include "content/common/sandbox_win.h" |
| -#include "content/public/common/sandboxed_process_launcher_delegate.h" |
| #include "sandbox/win/src/sandbox_policy.h" |
| #include "ui/gfx/switches.h" |
| #endif |
| @@ -178,8 +178,9 @@ void AcceleratedSurfaceBuffersSwappedCompleted( |
| class GpuSandboxedProcessLauncherDelegate |
| : public SandboxedProcessLauncherDelegate { |
| public: |
| - explicit GpuSandboxedProcessLauncherDelegate(CommandLine* cmd_line) |
| - : cmd_line_(cmd_line) {} |
| + GpuSandboxedProcessLauncherDelegate(CommandLine* cmd_line, |
| + ChildProcessHost* /*host*/): |
|
jam
2014/02/26 19:47:52
nit: here and in other places, within content code
aberent
2014/02/28 08:51:06
Done.
|
| + cmd_line_(cmd_line) {} |
|
jam
2014/02/26 19:47:52
nit: indentation
aberent
2014/02/28 08:51:06
Done.
|
| virtual ~GpuSandboxedProcessLauncherDelegate() {} |
| virtual void ShouldSandbox(bool* in_sandbox) OVERRIDE { |
| @@ -277,7 +278,25 @@ class GpuSandboxedProcessLauncherDelegate |
| private: |
| CommandLine* cmd_line_; |
| }; |
| -#endif // defined(OS_WIN) |
| + |
| +#elif defined(OS_POSIX) |
| +// NOTE: changes to this class need to be reviewed by the security team. |
| +class GpuSandboxedProcessLauncherDelegate |
|
jam
2014/02/26 19:47:52
ditto, we should have one implementation of this f
aberent
2014/02/28 08:51:06
Done.
|
| + : public SandboxedProcessLauncherDelegate { |
| + public: |
| + GpuSandboxedProcessLauncherDelegate(CommandLine* /*cmd_line*/, |
| + ChildProcessHost* host) |
| + : ipc_fd_(host->TakeClientFileDescriptor()) {} |
| + virtual ~GpuSandboxedProcessLauncherDelegate() {} |
| + |
| + virtual int IpcFd() OVERRIDE { |
| + return ipc_fd_; |
| + } |
| + |
| + private: |
| + int ipc_fd_; |
| +}; |
| +#endif // OS_WIN |
| } // anonymous namespace |
| @@ -1141,13 +1160,8 @@ bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id) { |
| cmd_line->PrependWrapper(gpu_launcher); |
| process_->Launch( |
| -#if defined(OS_WIN) |
| - new GpuSandboxedProcessLauncherDelegate(cmd_line), |
| - false, |
| -#elif defined(OS_POSIX) |
| - false, |
| - base::EnvironmentMap(), |
| -#endif |
| + new GpuSandboxedProcessLauncherDelegate(cmd_line, |
| + process_->GetHost()), |
| cmd_line); |
| process_launched_ = true; |