| 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 IPC::ChannelHandle channel_handle(pipe.Get()); | 462 IPC::ChannelHandle channel_handle(pipe.Get()); |
| 463 #elif defined(OS_POSIX) | 463 #elif defined(OS_POSIX) |
| 464 base::FileDescriptor pipe(pipe_handle, true); | 464 base::FileDescriptor pipe(pipe_handle, true); |
| 465 IPC::ChannelHandle channel_handle(channel_name, pipe); | 465 IPC::ChannelHandle channel_handle(channel_name, pipe); |
| 466 #endif // defined(OS_POSIX) | 466 #endif // defined(OS_POSIX) |
| 467 | 467 |
| 468 // Connect to the daemon process. | 468 // Connect to the daemon process. |
| 469 daemon_channel_ = IPC::ChannelProxy::Create(channel_handle, | 469 daemon_channel_ = IPC::ChannelProxy::Create(channel_handle, |
| 470 IPC::Channel::MODE_CLIENT, | 470 IPC::Channel::MODE_CLIENT, |
| 471 this, | 471 this, |
| 472 context_->network_task_runner(), | 472 context_->network_task_runner()); |
| 473 nullptr); | |
| 474 #else // !defined(REMOTING_MULTI_PROCESS) | 473 #else // !defined(REMOTING_MULTI_PROCESS) |
| 475 // Connect to the daemon process. | 474 // Connect to the daemon process. |
| 476 std::string channel_name = | 475 std::string channel_name = |
| 477 cmd_line->GetSwitchValueASCII(kDaemonPipeSwitchName); | 476 cmd_line->GetSwitchValueASCII(kDaemonPipeSwitchName); |
| 478 if (!channel_name.empty()) { | 477 if (!channel_name.empty()) { |
| 479 daemon_channel_ = | 478 daemon_channel_ = |
| 480 IPC::ChannelProxy::Create(channel_name, | 479 IPC::ChannelProxy::Create(channel_name, IPC::Channel::MODE_CLIENT, this, |
| 481 IPC::Channel::MODE_CLIENT, | 480 context_->network_task_runner().get()); |
| 482 this, | |
| 483 context_->network_task_runner().get(), | |
| 484 nullptr); | |
| 485 } | 481 } |
| 486 | 482 |
| 487 if (cmd_line->HasSwitch(kHostConfigSwitchName)) { | 483 if (cmd_line->HasSwitch(kHostConfigSwitchName)) { |
| 488 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName); | 484 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName); |
| 489 | 485 |
| 490 // Read config from stdin if necessary. | 486 // Read config from stdin if necessary. |
| 491 if (host_config_path_ == base::FilePath(kStdinConfigPath)) { | 487 if (host_config_path_ == base::FilePath(kStdinConfigPath)) { |
| 492 const size_t kBufferSize = 4096; | 488 const size_t kBufferSize = 4096; |
| 493 scoped_ptr<char[]> buf(new char[kBufferSize]); | 489 scoped_ptr<char[]> buf(new char[kBufferSize]); |
| 494 size_t len; | 490 size_t len; |
| (...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1645 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1641 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
| 1646 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); | 1642 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); |
| 1647 | 1643 |
| 1648 // Run the main (also UI) message loop until the host no longer needs it. | 1644 // Run the main (also UI) message loop until the host no longer needs it. |
| 1649 message_loop.Run(); | 1645 message_loop.Run(); |
| 1650 | 1646 |
| 1651 return exit_code; | 1647 return exit_code; |
| 1652 } | 1648 } |
| 1653 | 1649 |
| 1654 } // namespace remoting | 1650 } // namespace remoting |
| OLD | NEW |