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 a standalone host process for Me2Me. | 5 // This file implements a standalone host process for Me2Me. |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 } | 437 } |
| 438 | 438 |
| 439 void HostProcess::StartHostProcess() { | 439 void HostProcess::StartHostProcess() { |
| 440 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); | 440 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); |
| 441 | 441 |
| 442 if (!InitWithCommandLine(CommandLine::ForCurrentProcess())) { | 442 if (!InitWithCommandLine(CommandLine::ForCurrentProcess())) { |
| 443 OnConfigWatcherError(); | 443 OnConfigWatcherError(); |
| 444 return; | 444 return; |
| 445 } | 445 } |
| 446 | 446 |
| 447 #if defined(OS_LINUX) | |
| 448 // TODO(sergeyu): Pass configuration parameters to the Linux-specific version | |
| 449 // of DesktopEnvironmentFactory when we have it. | |
| 450 remoting::VideoFrameCapturer::EnableXDamage(true); | |
| 451 remoting::AudioCapturerLinuxCore::Initialize( | |
| 452 context_->audio_task_runner(), | |
| 453 CommandLine::ForCurrentProcess()->GetSwitchValuePath( | |
| 454 kAudioPipeSwitchName)); | |
|
Wez
2012/10/30 04:20:11
nit: I think this call has become sufficiently com
Sergey Ulanov
2012/10/30 23:59:48
Done.
| |
| 455 #endif // defined(OS_LINUX) | |
| 456 | |
| 447 // Create a desktop environment factory appropriate to the build type & | 457 // Create a desktop environment factory appropriate to the build type & |
| 448 // platform. | 458 // platform. |
| 449 #if defined(OS_WIN) | 459 #if defined(OS_WIN) |
| 450 | 460 |
| 451 #if defined(REMOTING_MULTI_PROCESS) | 461 #if defined(REMOTING_MULTI_PROCESS) |
| 452 IpcDesktopEnvironmentFactory* desktop_environment_factory = | 462 IpcDesktopEnvironmentFactory* desktop_environment_factory = |
| 453 new IpcDesktopEnvironmentFactory( | 463 new IpcDesktopEnvironmentFactory( |
| 454 daemon_channel_.get(), | 464 daemon_channel_.get(), |
| 455 context_->input_task_runner(), | 465 context_->input_task_runner(), |
| 456 context_->network_task_runner(), | 466 context_->network_task_runner(), |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 885 net::EnableSSLServerSockets(); | 895 net::EnableSSLServerSockets(); |
| 886 | 896 |
| 887 // Create the main message loop and start helper threads. | 897 // Create the main message loop and start helper threads. |
| 888 MessageLoop message_loop(MessageLoop::TYPE_UI); | 898 MessageLoop message_loop(MessageLoop::TYPE_UI); |
| 889 base::Closure quit_message_loop = base::Bind(&QuitMessageLoop, &message_loop); | 899 base::Closure quit_message_loop = base::Bind(&QuitMessageLoop, &message_loop); |
| 890 scoped_ptr<remoting::ChromotingHostContext> context( | 900 scoped_ptr<remoting::ChromotingHostContext> context( |
| 891 new remoting::ChromotingHostContext( | 901 new remoting::ChromotingHostContext( |
| 892 new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(), | 902 new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(), |
| 893 quit_message_loop))); | 903 quit_message_loop))); |
| 894 | 904 |
| 895 #if defined(OS_LINUX) | |
| 896 // TODO(sergeyu): Pass configuration parameters to the Linux-specific version | |
| 897 // of DesktopEnvironmentFactory when we have it. | |
| 898 remoting::VideoFrameCapturer::EnableXDamage(true); | |
| 899 remoting::AudioCapturerLinux::SetPipeName(CommandLine::ForCurrentProcess()-> | |
| 900 GetSwitchValuePath(kAudioPipeSwitchName)); | |
| 901 #endif // defined(OS_LINUX) | |
| 902 | |
| 903 if (!context->Start()) | 905 if (!context->Start()) |
| 904 return remoting::kInitializationFailed; | 906 return remoting::kInitializationFailed; |
| 905 | 907 |
| 906 // Create the host process instance and enter the main message loop. | 908 // Create the host process instance and enter the main message loop. |
| 907 remoting::HostProcess me2me_host(context.Pass()); | 909 remoting::HostProcess me2me_host(context.Pass()); |
| 908 me2me_host.StartHostProcess(); | 910 me2me_host.StartHostProcess(); |
| 909 message_loop.Run(); | 911 message_loop.Run(); |
| 910 return me2me_host.get_exit_code(); | 912 return me2me_host.get_exit_code(); |
| 911 } | 913 } |
| 912 | 914 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 944 user32.GetFunctionPointer("SetProcessDPIAware")); | 946 user32.GetFunctionPointer("SetProcessDPIAware")); |
| 945 set_process_dpi_aware(); | 947 set_process_dpi_aware(); |
| 946 } | 948 } |
| 947 | 949 |
| 948 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 950 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
| 949 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 951 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
| 950 return main(0, NULL); | 952 return main(0, NULL); |
| 951 } | 953 } |
| 952 | 954 |
| 953 #endif // defined(OS_WIN) | 955 #endif // defined(OS_WIN) |
| OLD | NEW |