summaryrefslogtreecommitdiffstats
path: root/chrome/common/sandbox_policy.cc
diff options
context:
space:
mode:
authorgregoryd@google.com <gregoryd@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-01 18:57:09 +0000
committergregoryd@google.com <gregoryd@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-01 18:57:09 +0000
commit103607e7bb3d18c9c5b78cf8dc558c2504047b1d (patch)
tree650fd33a0dfeded9eec339c24856307de5a86248 /chrome/common/sandbox_policy.cc
parent20c01928492aca53ee6ba6e1c84a199e889cb74d (diff)
downloadchromium_src-103607e7bb3d18c9c5b78cf8dc558c2504047b1d.zip
chromium_src-103607e7bb3d18c9c5b78cf8dc558c2504047b1d.tar.gz
chromium_src-103607e7bb3d18c9c5b78cf8dc558c2504047b1d.tar.bz2
Implement the broker process that launches NaCl loader processes on 64-bit Windows systems.
BUG=28176 TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=37578 Review URL: http://codereview.chromium.org/542030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37720 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/sandbox_policy.cc')
-rw-r--r--chrome/common/sandbox_policy.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/chrome/common/sandbox_policy.cc b/chrome/common/sandbox_policy.cc
index 7acb513..ba9b76d 100644
--- a/chrome/common/sandbox_policy.cc
+++ b/chrome/common/sandbox_policy.cc
@@ -23,6 +23,13 @@
#include "sandbox/src/sandbox.h"
#include "webkit/glue/plugins/plugin_list.h"
+#ifdef NACL_WIN64
+ // The sandbox can be used also by the NaCl broker process. In this case we
+ // define a global variable g_broker_services instead of g_browser_process.
+ // This can be changed if we discover that the broker process needs to be more
+ // similar to the browser process.
+ extern sandbox::BrokerServices* g_broker_services;
+#endif
namespace {
// The DLLs listed here are known (or under strong suspicion) of causing crashes
@@ -372,10 +379,12 @@ base::ProcessHandle StartProcessWithAccess(CommandLine* cmd_line,
type = ChildProcessInfo::PLUGIN_PROCESS;
} else if (type_str == switches::kWorkerProcess) {
type = ChildProcessInfo::WORKER_PROCESS;
- } else if (type_str == switches::kNaClProcess) {
- type = ChildProcessInfo::NACL_PROCESS;
+ } else if (type_str == switches::kNaClLoaderProcess) {
+ type = ChildProcessInfo::NACL_LOADER_PROCESS;
} else if (type_str == switches::kUtilityProcess) {
type = ChildProcessInfo::UTILITY_PROCESS;
+ } else if (type_str == switches::kNaClBrokerProcess) {
+ type = ChildProcessInfo::NACL_BROKER_PROCESS;
} else if (type_str == switches::kGpuProcess) {
type = ChildProcessInfo::GPU_PROCESS;
} else {
@@ -409,10 +418,15 @@ base::ProcessHandle StartProcessWithAccess(CommandLine* cmd_line,
return process;
}
+#ifdef NACL_WIN64
+ // When running in the broker we get the BrokerServices pointer from a global
+ // variable. It is initialized in NaClBrokerMain.
+ sandbox::BrokerServices* broker_service = g_broker_services;
+#else
// spawn the child process in the sandbox
sandbox::BrokerServices* broker_service =
g_browser_process->broker_services();
-
+#endif
sandbox::ResultCode result;
PROCESS_INFORMATION target = {0};
sandbox::TargetPolicy* policy = broker_service->CreatePolicy();