| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/power_monitor/power_monitor.h" | 8 #include "base/power_monitor/power_monitor.h" |
| 9 #include "base/power_monitor/power_monitor_device_source.h" | 9 #include "base/power_monitor/power_monitor_device_source.h" |
| 10 #include "base/process/launch.h" | 10 #include "base/process/launch.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 std::string process_type = | 54 std::string process_type = |
| 55 command_line.GetSwitchValueASCII(switches::kProcessType); | 55 command_line.GetSwitchValueASCII(switches::kProcessType); |
| 56 | 56 |
| 57 // Copy what ContentMain() does. | 57 // Copy what ContentMain() does. |
| 58 base::EnableTerminationOnHeapCorruption(); | 58 base::EnableTerminationOnHeapCorruption(); |
| 59 base::EnableTerminationOnOutOfMemory(); | 59 base::EnableTerminationOnOutOfMemory(); |
| 60 content::RegisterInvalidParamHandler(); | 60 content::RegisterInvalidParamHandler(); |
| 61 content::SetupCRT(command_line); | 61 content::SetupCRT(command_line); |
| 62 // Route stdio to parent console (if any) or create one. | 62 // Route stdio to parent console (if any) or create one. |
| 63 if (command_line.HasSwitch(switches::kEnableLogging)) | 63 if (command_line.HasSwitch(switches::kEnableLogging)) |
| 64 base::RouteStdioToConsole(); | 64 base::RouteStdioToConsole(true); |
| 65 | 65 |
| 66 // Initialize the sandbox for this process. | 66 // Initialize the sandbox for this process. |
| 67 bool sandbox_initialized_ok = content::InitializeSandbox(&sandbox_info); | 67 bool sandbox_initialized_ok = content::InitializeSandbox(&sandbox_info); |
| 68 // Die if the sandbox can't be enabled. | 68 // Die if the sandbox can't be enabled. |
| 69 CHECK(sandbox_initialized_ok) << "Error initializing sandbox for " | 69 CHECK(sandbox_initialized_ok) << "Error initializing sandbox for " |
| 70 << process_type; | 70 << process_type; |
| 71 content::MainFunctionParams main_params(command_line); | 71 content::MainFunctionParams main_params(command_line); |
| 72 main_params.sandbox_info = &sandbox_info; | 72 main_params.sandbox_info = &sandbox_info; |
| 73 | 73 |
| 74 if (process_type == switches::kNaClLoaderProcess) | 74 if (process_type == switches::kNaClLoaderProcess) |
| 75 return NaClMain(main_params); | 75 return NaClMain(main_params); |
| 76 | 76 |
| 77 if (process_type == switches::kNaClBrokerProcess) | 77 if (process_type == switches::kNaClBrokerProcess) |
| 78 return NaClBrokerMain(main_params); | 78 return NaClBrokerMain(main_params); |
| 79 | 79 |
| 80 CHECK(false) << "Unknown NaCl 64 process."; | 80 CHECK(false) << "Unknown NaCl 64 process."; |
| 81 return -1; | 81 return -1; |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace nacl | 84 } // namespace nacl |
| OLD | NEW |