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