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" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/debug/alias.h" |
13 #include "base/file_util.h" | 14 #include "base/file_util.h" |
14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
15 #include "base/logging.h" | 16 #include "base/logging.h" |
16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
17 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
18 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
19 #include "base/string_number_conversions.h" | 20 #include "base/string_number_conversions.h" |
20 #include "base/string_util.h" | 21 #include "base/string_util.h" |
| 22 #include "base/string_util.h" |
21 #include "base/synchronization/waitable_event.h" | 23 #include "base/synchronization/waitable_event.h" |
22 #include "base/threading/thread.h" | 24 #include "base/threading/thread.h" |
23 #include "base/utf_string_conversions.h" | 25 #include "base/utf_string_conversions.h" |
24 #include "build/build_config.h" | 26 #include "build/build_config.h" |
25 #include "crypto/nss_util.h" | 27 #include "crypto/nss_util.h" |
26 #include "ipc/ipc_channel.h" | 28 #include "ipc/ipc_channel.h" |
27 #include "ipc/ipc_channel_proxy.h" | 29 #include "ipc/ipc_channel_proxy.h" |
28 #include "ipc/ipc_listener.h" | 30 #include "ipc/ipc_listener.h" |
29 #include "net/base/network_change_notifier.h" | 31 #include "net/base/network_change_notifier.h" |
30 #include "net/socket/ssl_server_socket.h" | 32 #include "net/socket/ssl_server_socket.h" |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 host_->SetAuthenticatorFactory(factory.Pass()); | 530 host_->SetAuthenticatorFactory(factory.Pass()); |
529 } | 531 } |
530 | 532 |
531 // IPC::Listener implementation. | 533 // IPC::Listener implementation. |
532 bool HostProcess::OnMessageReceived(const IPC::Message& message) { | 534 bool HostProcess::OnMessageReceived(const IPC::Message& message) { |
533 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); | 535 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); |
534 | 536 |
535 #if defined(REMOTING_MULTI_PROCESS) | 537 #if defined(REMOTING_MULTI_PROCESS) |
536 bool handled = true; | 538 bool handled = true; |
537 IPC_BEGIN_MESSAGE_MAP(HostProcess, message) | 539 IPC_BEGIN_MESSAGE_MAP(HostProcess, message) |
538 IPC_MESSAGE_HANDLER(ChromotingDaemonNetworkMsg_Crash, | 540 IPC_MESSAGE_HANDLER(ChromotingDaemonMsg_Crash, OnCrash) |
539 OnCrash) | |
540 IPC_MESSAGE_HANDLER(ChromotingDaemonNetworkMsg_Configuration, | 541 IPC_MESSAGE_HANDLER(ChromotingDaemonNetworkMsg_Configuration, |
541 OnConfigUpdated) | 542 OnConfigUpdated) |
542 IPC_MESSAGE_FORWARD( | 543 IPC_MESSAGE_FORWARD( |
543 ChromotingDaemonNetworkMsg_DesktopAttached, | 544 ChromotingDaemonNetworkMsg_DesktopAttached, |
544 desktop_session_connector_, | 545 desktop_session_connector_, |
545 DesktopSessionConnector::OnDesktopSessionAgentAttached) | 546 DesktopSessionConnector::OnDesktopSessionAgentAttached) |
546 IPC_MESSAGE_FORWARD(ChromotingDaemonNetworkMsg_TerminalDisconnected, | 547 IPC_MESSAGE_FORWARD(ChromotingDaemonNetworkMsg_TerminalDisconnected, |
547 desktop_session_connector_, | 548 desktop_session_connector_, |
548 DesktopSessionConnector::OnTerminalDisconnected) | 549 DesktopSessionConnector::OnTerminalDisconnected) |
549 IPC_MESSAGE_UNHANDLED(handled = false) | 550 IPC_MESSAGE_UNHANDLED(handled = false) |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 } else { | 1096 } else { |
1096 // This method is used as a callback for ChromotingHost::Shutdown() which is | 1097 // This method is used as a callback for ChromotingHost::Shutdown() which is |
1097 // called only in STOPPING_TO_RESTART and STOPPING states. | 1098 // called only in STOPPING_TO_RESTART and STOPPING states. |
1098 NOTREACHED(); | 1099 NOTREACHED(); |
1099 } | 1100 } |
1100 } | 1101 } |
1101 | 1102 |
1102 void HostProcess::OnCrash(const std::string& function_name, | 1103 void HostProcess::OnCrash(const std::string& function_name, |
1103 const std::string& file_name, | 1104 const std::string& file_name, |
1104 const int& line_number) { | 1105 const int& line_number) { |
1105 CHECK(false); | 1106 char message[1024]; |
| 1107 base::snprintf(message, sizeof(message), |
| 1108 "Requested by %s at %s, line %d.", |
| 1109 function_name.c_str(), file_name.c_str(), line_number); |
| 1110 base::debug::Alias(message); |
| 1111 |
| 1112 // The daemon requested us to crash the process. |
| 1113 CHECK(false) << message; |
1106 } | 1114 } |
1107 | 1115 |
1108 int HostProcessMain() { | 1116 int HostProcessMain() { |
1109 #if defined(TOOLKIT_GTK) | 1117 #if defined(TOOLKIT_GTK) |
1110 // Required for any calls into GTK functions, such as the Disconnect and | 1118 // Required for any calls into GTK functions, such as the Disconnect and |
1111 // Continue windows, though these should not be used for the Me2Me case | 1119 // Continue windows, though these should not be used for the Me2Me case |
1112 // (crbug.com/104377). | 1120 // (crbug.com/104377). |
1113 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); | 1121 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); |
1114 #endif // TOOLKIT_GTK | 1122 #endif // TOOLKIT_GTK |
1115 | 1123 |
(...skipping 22 matching lines...) Expand all Loading... |
1138 return exit_code; | 1146 return exit_code; |
1139 } | 1147 } |
1140 | 1148 |
1141 } // namespace remoting | 1149 } // namespace remoting |
1142 | 1150 |
1143 #if !defined(OS_WIN) | 1151 #if !defined(OS_WIN) |
1144 int main(int argc, char** argv) { | 1152 int main(int argc, char** argv) { |
1145 return remoting::HostMain(argc, argv); | 1153 return remoting::HostMain(argc, argv); |
1146 } | 1154 } |
1147 #endif // !defined(OS_WIN) | 1155 #endif // !defined(OS_WIN) |
OLD | NEW |