| 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 "components/nacl/loader/nacl_helper_win_64.h" | 5 #include "components/nacl/loader/nacl_helper_win_64.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 return 0; | 47 return 0; |
| 48 } | 48 } |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 namespace nacl { | 52 namespace nacl { |
| 53 | 53 |
| 54 int NaClWin64Main() { | 54 int NaClWin64Main() { |
| 55 sandbox::SandboxInterfaceInfo sandbox_info = {0}; | 55 sandbox::SandboxInterfaceInfo sandbox_info = {0}; |
| 56 content::InitializeSandboxInfo(&sandbox_info); | |
| 57 | 56 |
| 58 const base::CommandLine& command_line = | 57 const base::CommandLine& command_line = |
| 59 *base::CommandLine::ForCurrentProcess(); | 58 *base::CommandLine::ForCurrentProcess(); |
| 60 std::string process_type = | 59 std::string process_type = |
| 61 command_line.GetSwitchValueASCII(switches::kProcessType); | 60 command_line.GetSwitchValueASCII(switches::kProcessType); |
| 62 | 61 |
| 63 // Copy what ContentMain() does. | 62 // Copy what ContentMain() does. |
| 64 base::EnableTerminationOnHeapCorruption(); | 63 base::EnableTerminationOnHeapCorruption(); |
| 65 base::EnableTerminationOnOutOfMemory(); | 64 base::EnableTerminationOnOutOfMemory(); |
| 66 base::win::RegisterInvalidParamHandler(); | 65 base::win::RegisterInvalidParamHandler(); |
| 67 base::win::SetupCRT(command_line); | 66 base::win::SetupCRT(command_line); |
| 68 // Route stdio to parent console (if any) or create one. | 67 // Route stdio to parent console (if any) or create one. |
| 69 if (command_line.HasSwitch(switches::kEnableLogging)) | 68 if (command_line.HasSwitch(switches::kEnableLogging)) |
| 70 base::RouteStdioToConsole(true); | 69 base::RouteStdioToConsole(true); |
| 71 | 70 |
| 72 // Initialize the sandbox for this process. | |
| 73 bool sandbox_initialized_ok = content::InitializeSandbox(&sandbox_info); | |
| 74 // Die if the sandbox can't be enabled. | |
| 75 CHECK(sandbox_initialized_ok) << "Error initializing sandbox for " | |
| 76 << process_type; | |
| 77 content::MainFunctionParams main_params(command_line); | 71 content::MainFunctionParams main_params(command_line); |
| 78 main_params.sandbox_info = &sandbox_info; | 72 main_params.sandbox_info = &sandbox_info; |
| 79 | 73 |
| 80 if (process_type == switches::kNaClLoaderProcess) | 74 if (process_type == switches::kNaClLoaderProcess) |
| 81 return NaClMain(main_params); | 75 return NaClMain(main_params); |
| 82 | 76 |
| 83 if (process_type == switches::kNaClBrokerProcess) | 77 if (process_type == switches::kNaClBrokerProcess) |
| 84 return NaClBrokerMain(main_params); | 78 return NaClBrokerMain(main_params); |
| 85 | 79 |
| 86 CHECK(false) << "Unknown NaCl 64 process."; | 80 CHECK(false) << "Unknown NaCl 64 process."; |
| 87 return -1; | 81 return -1; |
| 88 } | 82 } |
| 89 | 83 |
| 90 } // namespace nacl | 84 } // namespace nacl |
| OLD | NEW |