Chromium Code Reviews| Index: content/common/sandbox_init_win.cc |
| =================================================================== |
| --- content/common/sandbox_init_win.cc (revision 188735) |
| +++ content/common/sandbox_init_win.cc (working copy) |
| @@ -18,24 +18,22 @@ |
| std::string process_type = |
| command_line.GetSwitchValueASCII(switches::kProcessType); |
| sandbox::BrokerServices* broker_services = sandbox_info->broker_services; |
| - if (broker_services && !InitBrokerServices(broker_services)) |
| - return false; |
| + if (broker_services) { |
| + if (!InitBrokerServices(broker_services)) |
| + return false; |
| - if (process_type.empty() || process_type == switches::kNaClBrokerProcess) { |
|
cpu_(ooo_6.6-7.5)
2013/03/18 19:46:26
we should leave the if (process_type.empty())
The
jam
2013/03/18 19:50:19
I would much rather have this code be generic. The
|
| // IMPORTANT: This piece of code needs to run as early as possible in the |
| // process because it will initialize the sandbox broker, which requires the |
| // process to swap its window station. During this time all the UI will be |
| // broken. This has to run before threads and windows are created. |
| - if (broker_services) { |
| - if (!command_line.HasSwitch(switches::kNoSandbox)) { |
| - bool use_winsta = !command_line.HasSwitch( |
| - switches::kDisableAltWinstation); |
| - // Precreate the desktop and window station used by the renderers. |
| - sandbox::TargetPolicy* policy = broker_services->CreatePolicy(); |
| - sandbox::ResultCode result = policy->CreateAlternateDesktop(use_winsta); |
| - CHECK(sandbox::SBOX_ERROR_FAILED_TO_SWITCH_BACK_WINSTATION != result); |
| - policy->Release(); |
| - } |
| + if (!command_line.HasSwitch(switches::kNoSandbox)) { |
| + bool use_winsta = !command_line.HasSwitch( |
| + switches::kDisableAltWinstation); |
| + // Precreate the desktop and window station used by the renderers. |
| + sandbox::TargetPolicy* policy = broker_services->CreatePolicy(); |
| + sandbox::ResultCode result = policy->CreateAlternateDesktop(use_winsta); |
| + CHECK(sandbox::SBOX_ERROR_FAILED_TO_SWITCH_BACK_WINSTATION != result); |
| + policy->Release(); |
| } |
| return true; |
| } |
| @@ -44,20 +42,6 @@ |
| return true; |
| sandbox::TargetServices* target_services = sandbox_info->target_services; |
| - if ((process_type == switches::kRendererProcess) || |
| - (process_type == switches::kWorkerProcess) || |
| - (process_type == switches::kNaClLoaderProcess) || |
| - (process_type == switches::kUtilityProcess)) { |
| - // The above five process types must be sandboxed unless --no-sandbox |
| - // is present in the command line. |
| - if (!target_services) |
| - return false; |
| - } else { |
| - // Other process types might or might not be sandboxed. |
| - // TODO(cpu): clean this mess. |
| - if (!target_services) |
| - return true; |
| - } |
| return InitTargetServices(target_services); |
| } |