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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 | 458 |
459 #if defined(OS_WIN) | 459 #if defined(OS_WIN) |
460 base::win::ScopedHandle pipe(reinterpret_cast<HANDLE>(pipe_handle)); | 460 base::win::ScopedHandle pipe(reinterpret_cast<HANDLE>(pipe_handle)); |
461 IPC::ChannelHandle channel_handle(pipe.Get()); | 461 IPC::ChannelHandle channel_handle(pipe.Get()); |
462 #elif defined(OS_POSIX) | 462 #elif defined(OS_POSIX) |
463 base::FileDescriptor pipe(pipe_handle, true); | 463 base::FileDescriptor pipe(pipe_handle, true); |
464 IPC::ChannelHandle channel_handle(channel_name, pipe); | 464 IPC::ChannelHandle channel_handle(channel_name, pipe); |
465 #endif // defined(OS_POSIX) | 465 #endif // defined(OS_POSIX) |
466 | 466 |
467 // Connect to the daemon process. | 467 // Connect to the daemon process. |
468 daemon_channel_ = IPC::ChannelProxy::Create(channel_handle, | 468 daemon_channel_ = |
469 IPC::Channel::MODE_CLIENT, | 469 IPC::ChannelProxy::Create(channel_handle, IPC::Channel::MODE_CLIENT, this, |
470 this, | 470 context_->network_task_runner(), nullptr); |
471 context_->network_task_runner()); | |
472 #else // !defined(REMOTING_MULTI_PROCESS) | 471 #else // !defined(REMOTING_MULTI_PROCESS) |
473 // Connect to the daemon process. | 472 // Connect to the daemon process. |
474 std::string channel_name = | 473 std::string channel_name = |
475 cmd_line->GetSwitchValueASCII(kDaemonPipeSwitchName); | 474 cmd_line->GetSwitchValueASCII(kDaemonPipeSwitchName); |
476 if (!channel_name.empty()) { | 475 if (!channel_name.empty()) { |
477 daemon_channel_ = | 476 daemon_channel_ = IPC::ChannelProxy::Create( |
478 IPC::ChannelProxy::Create(channel_name, | 477 channel_name, IPC::Channel::MODE_CLIENT, this, |
479 IPC::Channel::MODE_CLIENT, | 478 context_->network_task_runner().get(), nullptr); |
480 this, | |
481 context_->network_task_runner().get()); | |
482 } | 479 } |
483 | 480 |
484 if (cmd_line->HasSwitch(kHostConfigSwitchName)) { | 481 if (cmd_line->HasSwitch(kHostConfigSwitchName)) { |
485 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName); | 482 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName); |
486 | 483 |
487 // Read config from stdin if necessary. | 484 // Read config from stdin if necessary. |
488 if (host_config_path_ == base::FilePath(kStdinConfigPath)) { | 485 if (host_config_path_ == base::FilePath(kStdinConfigPath)) { |
489 char buf[4096]; | 486 char buf[4096]; |
490 size_t len; | 487 size_t len; |
491 while ((len = fread(buf, 1, sizeof(buf), stdin)) > 0) { | 488 while ((len = fread(buf, 1, sizeof(buf), stdin)) > 0) { |
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1630 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
1634 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); | 1631 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); |
1635 | 1632 |
1636 // Run the main (also UI) message loop until the host no longer needs it. | 1633 // Run the main (also UI) message loop until the host no longer needs it. |
1637 message_loop.Run(); | 1634 message_loop.Run(); |
1638 | 1635 |
1639 return exit_code; | 1636 return exit_code; |
1640 } | 1637 } |
1641 | 1638 |
1642 } // namespace remoting | 1639 } // namespace remoting |
OLD | NEW |