| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/power_monitor/power_monitor.h" | 13 #include "base/power_monitor/power_monitor.h" |
| 14 #include "base/power_monitor/power_monitor_device_source.h" | 14 #include "base/power_monitor/power_monitor_device_source.h" |
| 15 #include "base/process/launch.h" | 15 #include "base/process/launch.h" |
| 16 #include "base/process/memory.h" | 16 #include "base/process/memory.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/timer/hi_res_timer_manager.h" | 18 #include "base/timer/hi_res_timer_manager.h" |
| 19 #include "base/win/process_startup_helper.h" | 19 #include "base/win/process_startup_helper.h" |
| 20 #include "components/nacl/broker/nacl_broker_listener.h" | 20 #include "components/nacl/broker/nacl_broker_listener.h" |
| 21 #include "components/nacl/common/nacl_switches.h" | 21 #include "components/nacl/common/nacl_switches.h" |
| 22 #include "components/nacl/loader/nacl_listener.h" | 22 #include "components/nacl/loader/nacl_listener.h" |
| 23 #include "components/nacl/loader/nacl_main_platform_delegate.h" | 23 #include "components/nacl/loader/nacl_main_platform_delegate.h" |
| 24 #include "content/public/app/sandbox_helper_win.h" | 24 #include "content/public/app/sandbox_helper_win.h" |
| 25 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 26 #include "content/public/common/main_function_params.h" | 26 #include "content/public/common/main_function_params.h" |
| 27 #include "content/public/common/sandbox_init.h" | 27 #include "content/public/common/sandbox_init.h" |
| 28 #include "mojo/edk/embedder/embedder.h" | 28 #include "mojo/edk/embedder/embedder.h" |
| 29 #include "mojo/edk/embedder/platform_channel_pair.h" | |
| 30 #include "mojo/edk/embedder/scoped_ipc_support.h" | |
| 31 #include "sandbox/win/src/sandbox_types.h" | 29 #include "sandbox/win/src/sandbox_types.h" |
| 32 | 30 |
| 33 extern int NaClMain(const content::MainFunctionParams&); | 31 extern int NaClMain(const content::MainFunctionParams&); |
| 34 | 32 |
| 35 namespace { | 33 namespace { |
| 36 // main() routine for the NaCl broker process. | 34 // main() routine for the NaCl broker process. |
| 37 // This is necessary for supporting NaCl in Chrome on Win64. | 35 // This is necessary for supporting NaCl in Chrome on Win64. |
| 38 int NaClBrokerMain(const content::MainFunctionParams& parameters) { | 36 int NaClBrokerMain(const content::MainFunctionParams& parameters) { |
| 39 base::MessageLoopForIO main_message_loop; | 37 base::MessageLoopForIO main_message_loop; |
| 40 base::PlatformThread::SetName("CrNaClBrokerMain"); | 38 base::PlatformThread::SetName("CrNaClBrokerMain"); |
| 41 | 39 |
| 42 mojo::edk::Init(); | 40 mojo::edk::Init(); |
| 43 mojo::edk::ScopedIPCSupport mojo_ipc_support(main_message_loop.task_runner()); | |
| 44 mojo::edk::ScopedPlatformHandle platform_channel( | |
| 45 mojo::edk::PlatformChannelPair::PassClientHandleFromParentProcess( | |
| 46 *base::CommandLine::ForCurrentProcess())); | |
| 47 DCHECK(platform_channel.is_valid()); | |
| 48 mojo::edk::SetParentPipeHandle(std::move(platform_channel)); | |
| 49 | 41 |
| 50 std::unique_ptr<base::PowerMonitorSource> power_monitor_source( | 42 std::unique_ptr<base::PowerMonitorSource> power_monitor_source( |
| 51 new base::PowerMonitorDeviceSource()); | 43 new base::PowerMonitorDeviceSource()); |
| 52 base::PowerMonitor power_monitor(std::move(power_monitor_source)); | 44 base::PowerMonitor power_monitor(std::move(power_monitor_source)); |
| 53 base::HighResolutionTimerManager hi_res_timer_manager; | 45 base::HighResolutionTimerManager hi_res_timer_manager; |
| 54 | 46 |
| 55 NaClBrokerListener listener; | 47 NaClBrokerListener listener; |
| 56 listener.Listen(); | 48 listener.Listen(); |
| 57 | 49 |
| 58 return 0; | 50 return 0; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 return NaClMain(main_params); | 84 return NaClMain(main_params); |
| 93 | 85 |
| 94 if (process_type == switches::kNaClBrokerProcess) | 86 if (process_type == switches::kNaClBrokerProcess) |
| 95 return NaClBrokerMain(main_params); | 87 return NaClBrokerMain(main_params); |
| 96 | 88 |
| 97 CHECK(false) << "Unknown NaCl 64 process."; | 89 CHECK(false) << "Unknown NaCl 64 process."; |
| 98 return -1; | 90 return -1; |
| 99 } | 91 } |
| 100 | 92 |
| 101 } // namespace nacl | 93 } // namespace nacl |
| OLD | NEW |