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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 377 |
378 #if defined(OS_WIN) | 378 #if defined(OS_WIN) |
379 base::win::ScopedHandle pipe(reinterpret_cast<HANDLE>(pipe_handle)); | 379 base::win::ScopedHandle pipe(reinterpret_cast<HANDLE>(pipe_handle)); |
380 IPC::ChannelHandle channel_handle(pipe); | 380 IPC::ChannelHandle channel_handle(pipe); |
381 #elif defined(OS_POSIX) | 381 #elif defined(OS_POSIX) |
382 base::FileDescriptor pipe(pipe_handle, true); | 382 base::FileDescriptor pipe(pipe_handle, true); |
383 IPC::ChannelHandle channel_handle(channel_name, pipe); | 383 IPC::ChannelHandle channel_handle(channel_name, pipe); |
384 #endif // defined(OS_POSIX) | 384 #endif // defined(OS_POSIX) |
385 | 385 |
386 // Connect to the daemon process. | 386 // Connect to the daemon process. |
387 daemon_channel_.reset(new IPC::ChannelProxy( | 387 daemon_channel_ = IPC::ChannelProxy::Create(channel_handle, |
388 channel_handle, | 388 IPC::Channel::MODE_CLIENT, |
389 IPC::Channel::MODE_CLIENT, | 389 this, |
390 this, | 390 context_->network_task_runner()); |
391 context_->network_task_runner())); | |
392 #else // !defined(REMOTING_MULTI_PROCESS) | 391 #else // !defined(REMOTING_MULTI_PROCESS) |
393 // Connect to the daemon process. | 392 // Connect to the daemon process. |
394 std::string channel_name = | 393 std::string channel_name = |
395 cmd_line->GetSwitchValueASCII(kDaemonPipeSwitchName); | 394 cmd_line->GetSwitchValueASCII(kDaemonPipeSwitchName); |
396 if (!channel_name.empty()) { | 395 if (!channel_name.empty()) { |
397 daemon_channel_.reset( | 396 daemon_channel_ = |
398 new IPC::ChannelProxy(channel_name, | 397 IPC::ChannelProxy::Create(channel_name, |
399 IPC::Channel::MODE_CLIENT, | 398 IPC::Channel::MODE_CLIENT, |
400 this, | 399 this, |
401 context_->network_task_runner().get())); | 400 context_->network_task_runner().get()); |
402 } | 401 } |
403 | 402 |
404 if (cmd_line->HasSwitch(kHostConfigSwitchName)) { | 403 if (cmd_line->HasSwitch(kHostConfigSwitchName)) { |
405 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName); | 404 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName); |
406 | 405 |
407 // Read config from stdin if necessary. | 406 // Read config from stdin if necessary. |
408 if (host_config_path_ == base::FilePath(kStdinConfigPath)) { | 407 if (host_config_path_ == base::FilePath(kStdinConfigPath)) { |
409 char buf[4096]; | 408 char buf[4096]; |
410 size_t len; | 409 size_t len; |
411 while ((len = fread(buf, 1, sizeof(buf), stdin)) > 0) { | 410 while ((len = fread(buf, 1, sizeof(buf), stdin)) > 0) { |
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1354 return exit_code; | 1353 return exit_code; |
1355 } | 1354 } |
1356 | 1355 |
1357 } // namespace remoting | 1356 } // namespace remoting |
1358 | 1357 |
1359 #if !defined(OS_WIN) | 1358 #if !defined(OS_WIN) |
1360 int main(int argc, char** argv) { | 1359 int main(int argc, char** argv) { |
1361 return remoting::HostMain(argc, argv); | 1360 return remoting::HostMain(argc, argv); |
1362 } | 1361 } |
1363 #endif // !defined(OS_WIN) | 1362 #endif // !defined(OS_WIN) |
OLD | NEW |