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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 451 | 451 |
| 452 scoped_ptr<ChromotingHost> host_; | 452 scoped_ptr<ChromotingHost> host_; |
| 453 | 453 |
| 454 // Used to keep this HostProcess alive until it is shutdown. | 454 // Used to keep this HostProcess alive until it is shutdown. |
| 455 scoped_refptr<HostProcess> self_; | 455 scoped_refptr<HostProcess> self_; |
| 456 | 456 |
| 457 #if defined(REMOTING_MULTI_PROCESS) | 457 #if defined(REMOTING_MULTI_PROCESS) |
| 458 // Accessed on the UI thread. | 458 // Accessed on the UI thread. |
| 459 scoped_ptr<IPC::ChannelProxy> daemon_channel_; | 459 scoped_ptr<IPC::ChannelProxy> daemon_channel_; |
| 460 | 460 |
| 461 // AttachmentBroker for |daemon_channel_|. | |
| 462 scoped_ptr<IPC::AttachmentBrokerUnprivileged> attachment_broker_; | |
| 463 | |
| 464 // Owned as |desktop_environment_factory_|. | 461 // Owned as |desktop_environment_factory_|. |
| 465 DesktopSessionConnector* desktop_session_connector_ = nullptr; | 462 DesktopSessionConnector* desktop_session_connector_ = nullptr; |
| 466 #endif // defined(REMOTING_MULTI_PROCESS) | 463 #endif // defined(REMOTING_MULTI_PROCESS) |
| 467 | 464 |
| 468 int* exit_code_out_; | 465 int* exit_code_out_; |
| 469 bool signal_parent_; | 466 bool signal_parent_; |
| 470 | 467 |
| 471 scoped_refptr<PairingRegistry> pairing_registry_; | 468 scoped_refptr<PairingRegistry> pairing_registry_; |
| 472 | 469 |
| 473 ShutdownWatchdog* shutdown_watchdog_; | 470 ShutdownWatchdog* shutdown_watchdog_; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 535 base::FileDescriptor pipe(pipe_handle, true); | 532 base::FileDescriptor pipe(pipe_handle, true); |
| 536 IPC::ChannelHandle channel_handle(channel_name, pipe); | 533 IPC::ChannelHandle channel_handle(channel_name, pipe); |
| 537 #endif // defined(OS_POSIX) | 534 #endif // defined(OS_POSIX) |
| 538 | 535 |
| 539 // Connect to the daemon process. | 536 // Connect to the daemon process. |
| 540 daemon_channel_ = IPC::ChannelProxy::Create(channel_handle, | 537 daemon_channel_ = IPC::ChannelProxy::Create(channel_handle, |
| 541 IPC::Channel::MODE_CLIENT, | 538 IPC::Channel::MODE_CLIENT, |
| 542 this, | 539 this, |
| 543 context_->network_task_runner()); | 540 context_->network_task_runner()); |
| 544 | 541 |
| 545 attachment_broker_ = IPC::AttachmentBrokerUnprivileged::CreateBroker(); | 542 IPC::AttachmentBrokerUnprivileged::CreateBrokerIfNeeded(); |
| 546 if (attachment_broker_) { | 543 IPC::AttachmentBroker* global = IPC::AttachmentBroker::GetGlobal(); |
|
Sergey Ulanov
2016/02/10 19:36:35
nit: broker
erikchen
2016/02/10 21:04:46
Done.
| |
| 547 attachment_broker_->DesignateBrokerCommunicationChannel( | 544 if (global && !global->IsPrivilegedBroker()) |
| 548 daemon_channel_.get()); | 545 global->DesignateBrokerCommunicationChannel(daemon_channel_.get()); |
| 549 } | |
| 550 | 546 |
| 551 #else // !defined(REMOTING_MULTI_PROCESS) | 547 #else // !defined(REMOTING_MULTI_PROCESS) |
| 552 if (cmd_line->HasSwitch(kHostConfigSwitchName)) { | 548 if (cmd_line->HasSwitch(kHostConfigSwitchName)) { |
| 553 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName); | 549 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName); |
| 554 | 550 |
| 555 // Read config from stdin if necessary. | 551 // Read config from stdin if necessary. |
| 556 if (host_config_path_ == base::FilePath(kStdinConfigPath)) { | 552 if (host_config_path_ == base::FilePath(kStdinConfigPath)) { |
| 557 const size_t kBufferSize = 4096; | 553 const size_t kBufferSize = 4096; |
| 558 scoped_ptr<char[]> buf(new char[kBufferSize]); | 554 scoped_ptr<char[]> buf(new char[kBufferSize]); |
| 559 size_t len; | 555 size_t len; |
| (...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1739 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1735 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
| 1740 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); | 1736 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); |
| 1741 | 1737 |
| 1742 // Run the main (also UI) message loop until the host no longer needs it. | 1738 // Run the main (also UI) message loop until the host no longer needs it. |
| 1743 message_loop.Run(); | 1739 message_loop.Run(); |
| 1744 | 1740 |
| 1745 return exit_code; | 1741 return exit_code; |
| 1746 } | 1742 } |
| 1747 | 1743 |
| 1748 } // namespace remoting | 1744 } // namespace remoting |
| OLD | NEW |