Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file implements the Windows service controlling Me2Me host processes | 5 // This file implements the Windows service controlling Me2Me host processes |
| 6 // running within user sessions. | 6 // running within user sessions. |
| 7 | 7 |
| 8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/bind.h" | |
| 10 #include "base/bind_helpers.h" | |
| 9 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/message_loop.h" | |
| 14 #include "base/run_loop.h" | |
| 11 #include "base/scoped_native_library.h" | 15 #include "base/scoped_native_library.h" |
| 12 #include "base/stringprintf.h" | 16 #include "base/stringprintf.h" |
| 13 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
| 14 #include "base/win/windows_version.h" | 18 #include "base/win/windows_version.h" |
| 19 #include "remoting/base/auto_thread_task_runner.h" | |
| 15 #include "remoting/host/desktop_process.h" | 20 #include "remoting/host/desktop_process.h" |
| 16 #include "remoting/host/host_exit_codes.h" | 21 #include "remoting/host/host_exit_codes.h" |
| 17 #include "remoting/host/logging.h" | 22 #include "remoting/host/logging.h" |
| 18 #include "remoting/host/usage_stats_consent.h" | 23 #include "remoting/host/usage_stats_consent.h" |
| 19 | 24 |
| 20 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
| 21 #include "base/mac/scoped_nsautorelease_pool.h" | 26 #include "base/mac/scoped_nsautorelease_pool.h" |
| 22 #endif // defined(OS_MACOSX) | 27 #endif // defined(OS_MACOSX) |
| 23 | 28 |
| 24 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 } | 75 } |
| 71 | 76 |
| 72 std::string channel_name = | 77 std::string channel_name = |
| 73 command_line->GetSwitchValueASCII(kDaemonIpcSwitchName); | 78 command_line->GetSwitchValueASCII(kDaemonIpcSwitchName); |
| 74 | 79 |
| 75 if (channel_name.empty()) { | 80 if (channel_name.empty()) { |
| 76 Usage(command_line->GetProgram()); | 81 Usage(command_line->GetProgram()); |
| 77 return remoting::kUsageExitCode; | 82 return remoting::kUsageExitCode; |
| 78 } | 83 } |
| 79 | 84 |
| 80 remoting::DesktopProcess desktop_process(channel_name); | 85 MessageLoop message_loop(MessageLoop::TYPE_UI); |
| 81 return desktop_process.Run(); | 86 base::Closure quit_ui_task_runner = base::Bind( |
| 87 base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask), | |
| 88 message_loop.message_loop_proxy(), | |
| 89 FROM_HERE, MessageLoop::QuitClosure()); | |
|
Sergey Ulanov
2012/10/25 20:29:32
this should be RunLoop::QuitClosure() created by t
alexeypa (please no reviews)
2012/10/25 20:36:21
Done.
| |
| 90 scoped_refptr<remoting::AutoThreadTaskRunner> ui_task_runner = | |
| 91 new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(), | |
| 92 quit_ui_task_runner); | |
| 93 | |
| 94 remoting::DesktopProcess desktop_process(ui_task_runner, channel_name); | |
| 95 if (!desktop_process.Start()) | |
| 96 return remoting::kInitializationFailed; | |
| 97 | |
| 98 // Run the UI message loop. | |
| 99 ui_task_runner = NULL; | |
| 100 base::RunLoop run_loop; | |
| 101 run_loop.Run(); | |
| 102 | |
| 103 return remoting::kSuccessExitCode; | |
| 82 } | 104 } |
| 83 | 105 |
| 84 #if defined(OS_WIN) | 106 #if defined(OS_WIN) |
| 85 | 107 |
| 86 int CALLBACK WinMain(HINSTANCE instance, | 108 int CALLBACK WinMain(HINSTANCE instance, |
| 87 HINSTANCE previous_instance, | 109 HINSTANCE previous_instance, |
| 88 LPSTR raw_command_line, | 110 LPSTR raw_command_line, |
| 89 int show_command) { | 111 int show_command) { |
| 90 #ifdef OFFICIAL_BUILD | 112 #ifdef OFFICIAL_BUILD |
| 91 if (remoting::IsUsageStatsAllowed()) { | 113 if (remoting::IsUsageStatsAllowed()) { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 112 user32.GetFunctionPointer("SetProcessDPIAware")); | 134 user32.GetFunctionPointer("SetProcessDPIAware")); |
| 113 set_process_dpi_aware(); | 135 set_process_dpi_aware(); |
| 114 } | 136 } |
| 115 | 137 |
| 116 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 138 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
| 117 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 139 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
| 118 return main(0, NULL); | 140 return main(0, NULL); |
| 119 } | 141 } |
| 120 | 142 |
| 121 #endif // defined(OS_WIN) | 143 #endif // defined(OS_WIN) |
| OLD | NEW |