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

Unified Diff: content/browser/gpu/gpu_process_host.cc

Issue 177863002: Refactor configuration of sandboxes - first steps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix remaining nits and rebase Created 6 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/child_process_launcher.cc ('k') | content/browser/plugin_process_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b4b6dfdfa1fcbfa70b069c49d2b3f885913ab5a2..297f75115f8838813da0a67e53eaa71be767eab2 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
@@ -169,20 +169,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,
@@ -269,11 +278,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
@@ -1137,13 +1155,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;
« no previous file with comments | « content/browser/child_process_launcher.cc ('k') | content/browser/plugin_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698