| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mojo/runner/child_process.h" | 5 #include "mojo/runner/child_process.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 const base::CommandLine& command_line = | 281 const base::CommandLine& command_line = |
| 282 *base::CommandLine::ForCurrentProcess(); | 282 *base::CommandLine::ForCurrentProcess(); |
| 283 | 283 |
| 284 #if defined(OS_LINUX) && !defined(OS_ANDROID) | 284 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
| 285 using sandbox::syscall_broker::BrokerFilePermission; | 285 using sandbox::syscall_broker::BrokerFilePermission; |
| 286 scoped_ptr<mandoline::LinuxSandbox> sandbox; | 286 scoped_ptr<mandoline::LinuxSandbox> sandbox; |
| 287 #endif | 287 #endif |
| 288 base::NativeLibrary app_library = 0; | 288 base::NativeLibrary app_library = 0; |
| 289 if (command_line.HasSwitch(switches::kChildProcess)) { | 289 if (command_line.HasSwitch(switches::kChildProcess)) { |
| 290 // Load the application library before we engage the sandbox. | 290 // Load the application library before we engage the sandbox. |
| 291 mojo::shell::NativeApplicationCleanup cleanup = | |
| 292 command_line.HasSwitch(switches::kDeleteAfterLoad) | |
| 293 ? mojo::shell::NativeApplicationCleanup::DELETE | |
| 294 : mojo::shell::NativeApplicationCleanup::DONT_DELETE; | |
| 295 app_library = mojo::runner::LoadNativeApplication( | 291 app_library = mojo::runner::LoadNativeApplication( |
| 296 command_line.GetSwitchValuePath(switches::kChildProcess), cleanup); | 292 command_line.GetSwitchValuePath(switches::kChildProcess)); |
| 297 | 293 |
| 298 #if defined(OS_LINUX) && !defined(OS_ANDROID) | 294 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
| 299 if (command_line.HasSwitch(switches::kEnableSandbox)) { | 295 if (command_line.HasSwitch(switches::kEnableSandbox)) { |
| 300 // Warm parts of base. | 296 // Warm parts of base. |
| 301 base::RandUint64(); | 297 base::RandUint64(); |
| 302 base::SysInfo::AmountOfPhysicalMemory(); | 298 base::SysInfo::AmountOfPhysicalMemory(); |
| 303 base::SysInfo::MaxSharedMemorySize(); | 299 base::SysInfo::MaxSharedMemorySize(); |
| 304 base::SysInfo::NumberOfProcessors(); | 300 base::SysInfo::NumberOfProcessors(); |
| 305 | 301 |
| 306 // Do whatever warming that the mojo application wants. | 302 // Do whatever warming that the mojo application wants. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 // This will block, then run whatever the controller wants. | 342 // This will block, then run whatever the controller wants. |
| 347 blocker.Block(); | 343 blocker.Block(); |
| 348 | 344 |
| 349 app_context.Shutdown(); | 345 app_context.Shutdown(); |
| 350 | 346 |
| 351 return 0; | 347 return 0; |
| 352 } | 348 } |
| 353 | 349 |
| 354 } // namespace runner | 350 } // namespace runner |
| 355 } // namespace mojo | 351 } // namespace mojo |
| OLD | NEW |