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..09bb3fb7f0a78526c23be549a7dddf4d034f5809 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 |
@@ -173,20 +173,29 @@ void AcceleratedSurfaceBuffersSwappedCompleted( |
AcceleratedSurfaceBuffersSwappedCompletedForRenderer( |
surface_id, timebase, interval, latency_info); |
} |
+#endif // OS_WIN |
// NOTE: changes to this class need to be reviewed by the security team. |
class GpuSandboxedProcessLauncherDelegate |
: public SandboxedProcessLauncherDelegate { |
public: |
- explicit GpuSandboxedProcessLauncherDelegate(CommandLine* cmd_line) |
+ GpuSandboxedProcessLauncherDelegate(CommandLine* cmd_line, |
+ ChildProcessHost* host) |
+#if defined(OS_WIN) |
: cmd_line_(cmd_line) {} |
+#elif defined(OS_POSIX) |
+ : ipc_fd_(host->TakeClientFileDescriptor()) {} |
+#endif |
+ |
virtual ~GpuSandboxedProcessLauncherDelegate() {} |
- virtual void ShouldSandbox(bool* in_sandbox) OVERRIDE { |
- if (cmd_line_->HasSwitch(switches::kDisableGpuSandbox)) { |
- *in_sandbox = false; |
+#if defined(OS_WIN) |
+ virtual bool ShouldSandbox() OVERRIDE { |
+ bool sandbox = !cmd_line_->HasSwitch(switches::kDisableGpuSandbox); |
+ if(! sandbox) { |
DVLOG(1) << "GPU sandbox is disabled"; |
} |
+ return sandbox; |
} |
virtual void PreSandbox(bool* disable_default_policy, |
@@ -273,11 +282,20 @@ class GpuSandboxedProcessLauncherDelegate |
} |
} |
} |
+#elif defined(OS_POSIX) |
+ |
+ virtual int GetIpcFd() OVERRIDE { |
+ return ipc_fd_; |
+ } |
+#endif // OS_WIN |
private: |
+#if defined(OS_WIN) |
CommandLine* cmd_line_; |
+#elif defined(OS_POSIX) |
+ int ipc_fd_; |
+#endif // OS_WIN |
}; |
-#endif // defined(OS_WIN) |
} // anonymous namespace |
@@ -1141,13 +1159,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; |