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 | |
| 452 // Initialize AudioCapturer with the pipe name we get in command line and | |
| 453 // provide it with a task runner for the thread it should work on. | |
|
Wez
2012/10/31 00:56:28
nit: Suggest "If an audio pipe is specific on the
Sergey Ulanov
2012/10/31 18:41:24
Done.
| |
| 454 FilePath audio_pipe_name = CommandLine::ForCurrentProcess()-> | |
| 455 GetSwitchValuePath(kAudioPipeSwitchName); | |
| 456 if (!audio_pipe_name.empty()) { | |
| 457 remoting::AudioCapturerLinux::InitializePipeReader( | |
| 458 context_->audio_task_runner(), audio_pipe_name); | |
| 459 } | |
| 460 #endif // defined(OS_LINUX) | |
| 461 | |
| 447 // Create a desktop environment factory appropriate to the build type & | 462 // Create a desktop environment factory appropriate to the build type & |
| 448 // platform. | 463 // platform. |
| 449 #if defined(OS_WIN) | 464 #if defined(OS_WIN) |
| 450 | 465 |
| 451 #if defined(REMOTING_MULTI_PROCESS) | 466 #if defined(REMOTING_MULTI_PROCESS) |
| 452 IpcDesktopEnvironmentFactory* desktop_environment_factory = | 467 IpcDesktopEnvironmentFactory* desktop_environment_factory = |
| 453 new IpcDesktopEnvironmentFactory( | 468 new IpcDesktopEnvironmentFactory( |
| 454 daemon_channel_.get(), | 469 daemon_channel_.get(), |
| 455 context_->input_task_runner(), | 470 context_->input_task_runner(), |
| 456 context_->network_task_runner(), | 471 context_->network_task_runner(), |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 890 net::EnableSSLServerSockets(); | 905 net::EnableSSLServerSockets(); |
| 891 | 906 |
| 892 // Create the main message loop and start helper threads. | 907 // Create the main message loop and start helper threads. |
| 893 MessageLoop message_loop(MessageLoop::TYPE_UI); | 908 MessageLoop message_loop(MessageLoop::TYPE_UI); |
| 894 base::Closure quit_message_loop = base::Bind(&QuitMessageLoop, &message_loop); | 909 base::Closure quit_message_loop = base::Bind(&QuitMessageLoop, &message_loop); |
| 895 scoped_ptr<remoting::ChromotingHostContext> context( | 910 scoped_ptr<remoting::ChromotingHostContext> context( |
| 896 new remoting::ChromotingHostContext( | 911 new remoting::ChromotingHostContext( |
| 897 new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(), | 912 new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(), |
| 898 quit_message_loop))); | 913 quit_message_loop))); |
| 899 | 914 |
| 900 #if defined(OS_LINUX) | |
| 901 // TODO(sergeyu): Pass configuration parameters to the Linux-specific version | |
| 902 // of DesktopEnvironmentFactory when we have it. | |
| 903 remoting::VideoFrameCapturer::EnableXDamage(true); | |
| 904 remoting::AudioCapturerLinux::SetPipeName(CommandLine::ForCurrentProcess()-> | |
| 905 GetSwitchValuePath(kAudioPipeSwitchName)); | |
| 906 #endif // defined(OS_LINUX) | |
| 907 | |
| 908 if (!context->Start()) | 915 if (!context->Start()) |
| 909 return remoting::kInitializationFailed; | 916 return remoting::kInitializationFailed; |
| 910 | 917 |
| 911 // Create the host process instance and enter the main message loop. | 918 // Create the host process instance and enter the main message loop. |
| 912 remoting::HostProcess me2me_host(context.Pass()); | 919 remoting::HostProcess me2me_host(context.Pass()); |
| 913 me2me_host.StartHostProcess(); | 920 me2me_host.StartHostProcess(); |
| 914 message_loop.Run(); | 921 message_loop.Run(); |
| 915 return me2me_host.get_exit_code(); | 922 return me2me_host.get_exit_code(); |
| 916 } | 923 } |
| 917 | 924 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 949 user32.GetFunctionPointer("SetProcessDPIAware")); | 956 user32.GetFunctionPointer("SetProcessDPIAware")); |
| 950 set_process_dpi_aware(); | 957 set_process_dpi_aware(); |
| 951 } | 958 } |
| 952 | 959 |
| 953 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 960 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
| 954 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 961 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
| 955 return main(0, NULL); | 962 return main(0, NULL); |
| 956 } | 963 } |
| 957 | 964 |
| 958 #endif // defined(OS_WIN) | 965 #endif // defined(OS_WIN) |
| OLD | NEW |