Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: remoting/host/remoting_me2me_host.cc

Issue 1509063003: Remoting: Remove references to POSIX shared memory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp57_base
Patch Set: Rebase. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/host/ipc_desktop_environment_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/debug/alias.h" 16 #include "base/debug/alias.h"
17 #include "base/files/file_path.h" 17 #include "base/files/file_path.h"
18 #include "base/files/file_util.h" 18 #include "base/files/file_util.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
21 #include "base/message_loop/message_loop.h" 21 #include "base/message_loop/message_loop.h"
22 #include "base/single_thread_task_runner.h" 22 #include "base/single_thread_task_runner.h"
23 #include "base/strings/string_number_conversions.h" 23 #include "base/strings/string_number_conversions.h"
24 #include "base/strings/string_util.h" 24 #include "base/strings/string_util.h"
25 #include "base/strings/stringize_macros.h" 25 #include "base/strings/stringize_macros.h"
26 #include "base/strings/utf_string_conversions.h" 26 #include "base/strings/utf_string_conversions.h"
27 #include "build/build_config.h" 27 #include "build/build_config.h"
28 #include "ipc/attachment_broker_unprivileged.h"
28 #include "ipc/ipc_channel.h" 29 #include "ipc/ipc_channel.h"
29 #include "ipc/ipc_channel_proxy.h" 30 #include "ipc/ipc_channel_proxy.h"
30 #include "ipc/ipc_listener.h" 31 #include "ipc/ipc_listener.h"
31 #include "jingle/glue/thread_wrapper.h" 32 #include "jingle/glue/thread_wrapper.h"
32 #include "net/base/net_util.h" 33 #include "net/base/net_util.h"
33 #include "net/base/network_change_notifier.h" 34 #include "net/base/network_change_notifier.h"
34 #include "net/socket/client_socket_factory.h" 35 #include "net/socket/client_socket_factory.h"
35 #include "net/socket/ssl_server_socket.h" 36 #include "net/socket/ssl_server_socket.h"
36 #include "net/url_request/url_fetcher.h" 37 #include "net/url_request/url_fetcher.h"
37 #include "policy/policy_constants.h" 38 #include "policy/policy_constants.h"
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 375
375 // Crashes the process in response to a daemon's request. The daemon passes 376 // Crashes the process in response to a daemon's request. The daemon passes
376 // the location of the code that detected the fatal error resulted in this 377 // the location of the code that detected the fatal error resulted in this
377 // request. 378 // request.
378 void OnCrash(const std::string& function_name, 379 void OnCrash(const std::string& function_name,
379 const std::string& file_name, 380 const std::string& file_name,
380 const int& line_number); 381 const int& line_number);
381 382
382 scoped_ptr<ChromotingHostContext> context_; 383 scoped_ptr<ChromotingHostContext> context_;
383 384
385 scoped_ptr<IPC::AttachmentBrokerUnprivileged> attachment_broker_;
386
384 // Accessed on the UI thread. 387 // Accessed on the UI thread.
385 scoped_ptr<IPC::ChannelProxy> daemon_channel_; 388 scoped_ptr<IPC::ChannelProxy> daemon_channel_;
386 389
387 // XMPP server/remoting bot configuration (initialized from the command line). 390 // XMPP server/remoting bot configuration (initialized from the command line).
388 XmppSignalStrategy::XmppServerConfig xmpp_server_config_; 391 XmppSignalStrategy::XmppServerConfig xmpp_server_config_;
389 std::string directory_bot_jid_; 392 std::string directory_bot_jid_;
390 393
391 // Created on the UI thread but used from the network thread. 394 // Created on the UI thread but used from the network thread.
392 base::FilePath host_config_path_; 395 base::FilePath host_config_path_;
393 std::string host_config_; 396 std::string host_config_;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 467
465 ShutdownWatchdog* shutdown_watchdog_; 468 ShutdownWatchdog* shutdown_watchdog_;
466 469
467 DISALLOW_COPY_AND_ASSIGN(HostProcess); 470 DISALLOW_COPY_AND_ASSIGN(HostProcess);
468 }; 471 };
469 472
470 HostProcess::HostProcess(scoped_ptr<ChromotingHostContext> context, 473 HostProcess::HostProcess(scoped_ptr<ChromotingHostContext> context,
471 int* exit_code_out, 474 int* exit_code_out,
472 ShutdownWatchdog* shutdown_watchdog) 475 ShutdownWatchdog* shutdown_watchdog)
473 : context_(std::move(context)), 476 : context_(std::move(context)),
477 attachment_broker_(IPC::AttachmentBrokerUnprivileged::CreateBroker()),
474 state_(HOST_STARTING), 478 state_(HOST_STARTING),
475 use_service_account_(false), 479 use_service_account_(false),
476 enable_vp9_(false), 480 enable_vp9_(false),
477 frame_recorder_buffer_size_(0), 481 frame_recorder_buffer_size_(0),
478 policy_state_(POLICY_INITIALIZING), 482 policy_state_(POLICY_INITIALIZING),
479 host_username_match_required_(false), 483 host_username_match_required_(false),
480 allow_nat_traversal_(true), 484 allow_nat_traversal_(true),
481 allow_relay_(true), 485 allow_relay_(true),
482 allow_pairing_(true), 486 allow_pairing_(true),
483 curtain_required_(false), 487 curtain_required_(false),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 #elif defined(OS_POSIX) 534 #elif defined(OS_POSIX)
531 base::FileDescriptor pipe(pipe_handle, true); 535 base::FileDescriptor pipe(pipe_handle, true);
532 IPC::ChannelHandle channel_handle(channel_name, pipe); 536 IPC::ChannelHandle channel_handle(channel_name, pipe);
533 #endif // defined(OS_POSIX) 537 #endif // defined(OS_POSIX)
534 538
535 // Connect to the daemon process. 539 // Connect to the daemon process.
536 daemon_channel_ = IPC::ChannelProxy::Create(channel_handle, 540 daemon_channel_ = IPC::ChannelProxy::Create(channel_handle,
537 IPC::Channel::MODE_CLIENT, 541 IPC::Channel::MODE_CLIENT,
538 this, 542 this,
539 context_->network_task_runner()); 543 context_->network_task_runner());
544 if (attachment_broker_) {
545 attachment_broker_->DesignateBrokerCommunicationChannel(
546 daemon_channel_.get());
547 }
548
540 #else // !defined(REMOTING_MULTI_PROCESS) 549 #else // !defined(REMOTING_MULTI_PROCESS)
541 // Connect to the daemon process. 550 // Connect to the daemon process.
542 std::string channel_name = 551 std::string channel_name =
543 cmd_line->GetSwitchValueASCII(kDaemonPipeSwitchName); 552 cmd_line->GetSwitchValueASCII(kDaemonPipeSwitchName);
544 if (!channel_name.empty()) { 553 if (!channel_name.empty()) {
545 daemon_channel_ = 554 daemon_channel_ =
546 IPC::ChannelProxy::Create(channel_name, IPC::Channel::MODE_CLIENT, this, 555 IPC::ChannelProxy::Create(channel_name, IPC::Channel::MODE_CLIENT, this,
547 context_->network_task_runner().get()); 556 context_->network_task_runner().get());
557 if (attachment_broker_) {
558 attachment_broker_->DesignateBrokerCommunicationChannel(
559 daemon_channel_.get());
560 }
548 } 561 }
549 562
550 if (cmd_line->HasSwitch(kHostConfigSwitchName)) { 563 if (cmd_line->HasSwitch(kHostConfigSwitchName)) {
551 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName); 564 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName);
552 565
553 // Read config from stdin if necessary. 566 // Read config from stdin if necessary.
554 if (host_config_path_ == base::FilePath(kStdinConfigPath)) { 567 if (host_config_path_ == base::FilePath(kStdinConfigPath)) {
555 const size_t kBufferSize = 4096; 568 const size_t kBufferSize = 4096;
556 scoped_ptr<char[]> buf(new char[kBufferSize]); 569 scoped_ptr<char[]> buf(new char[kBufferSize]);
557 size_t len; 570 size_t len;
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); 1751 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds));
1739 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); 1752 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog);
1740 1753
1741 // Run the main (also UI) message loop until the host no longer needs it. 1754 // Run the main (also UI) message loop until the host no longer needs it.
1742 message_loop.Run(); 1755 message_loop.Run();
1743 1756
1744 return exit_code; 1757 return exit_code;
1745 } 1758 }
1746 1759
1747 } // namespace remoting 1760 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/ipc_desktop_environment_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698