| 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 "remoting/host/win/host_service.h" | 8 #include "remoting/host/win/host_service.h" |
| 9 | 9 |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 190 } |
| 191 | 191 |
| 192 return true; | 192 return true; |
| 193 } | 193 } |
| 194 | 194 |
| 195 int HostService::Run() { | 195 int HostService::Run() { |
| 196 return (this->*run_routine_)(); | 196 return (this->*run_routine_)(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void HostService::RunMessageLoop(MessageLoop* message_loop) { | 199 void HostService::RunMessageLoop(MessageLoop* message_loop) { |
| 200 #if defined(REMOTING_MULTI_PROCESS) | |
| 201 | |
| 202 child_ = DaemonProcess::Create( | |
| 203 main_task_runner_, | |
| 204 base::Bind(&HostService::OnChildStopped, | |
| 205 base::Unretained(this))).PassAs<Stoppable>(); | |
| 206 | |
| 207 #else // !defined(REMOTING_MULTI_PROCESS) | |
| 208 | |
| 209 // Launch the I/O thread. | 200 // Launch the I/O thread. |
| 210 base::Thread io_thread(kIoThreadName); | 201 base::Thread io_thread(kIoThreadName); |
| 211 base::Thread::Options io_thread_options(MessageLoop::TYPE_IO, 0); | 202 base::Thread::Options io_thread_options(MessageLoop::TYPE_IO, 0); |
| 212 if (!io_thread.StartWithOptions(io_thread_options)) { | 203 if (!io_thread.StartWithOptions(io_thread_options)) { |
| 213 LOG(ERROR) << "Failed to start the I/O thread"; | 204 LOG(ERROR) << "Failed to start the I/O thread"; |
| 214 stopped_event_.Signal(); | 205 stopped_event_.Signal(); |
| 215 return; | 206 return; |
| 216 } | 207 } |
| 217 | 208 |
| 209 #if defined(REMOTING_MULTI_PROCESS) |
| 210 |
| 211 child_ = DaemonProcess::Create( |
| 212 main_task_runner_, |
| 213 io_thread.message_loop_proxy(), |
| 214 base::Bind(&HostService::OnChildStopped, |
| 215 base::Unretained(this))).PassAs<Stoppable>(); |
| 216 |
| 217 #else // !defined(REMOTING_MULTI_PROCESS) |
| 218 |
| 218 // Create the session process launcher. | 219 // Create the session process launcher. |
| 219 child_.reset(new WtsSessionProcessLauncher( | 220 child_.reset(new WtsSessionProcessLauncher( |
| 220 base::Bind(&HostService::OnChildStopped, base::Unretained(this)), | 221 base::Bind(&HostService::OnChildStopped, base::Unretained(this)), |
| 221 this, | 222 this, |
| 222 main_task_runner_, | 223 main_task_runner_, |
| 223 io_thread.message_loop_proxy())); | 224 io_thread.message_loop_proxy())); |
| 224 | 225 |
| 225 #endif // !defined(REMOTING_MULTI_PROCESS) | 226 #endif // !defined(REMOTING_MULTI_PROCESS) |
| 226 | 227 |
| 227 // Run the service. | 228 // Run the service. |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 } | 480 } |
| 480 | 481 |
| 481 remoting::HostService* service = remoting::HostService::GetInstance(); | 482 remoting::HostService* service = remoting::HostService::GetInstance(); |
| 482 if (!service->InitWithCommandLine(command_line)) { | 483 if (!service->InitWithCommandLine(command_line)) { |
| 483 usage(command_line->GetProgram()); | 484 usage(command_line->GetProgram()); |
| 484 return kUsageExitCode; | 485 return kUsageExitCode; |
| 485 } | 486 } |
| 486 | 487 |
| 487 return service->Run(); | 488 return service->Run(); |
| 488 } | 489 } |
| OLD | NEW |