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

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

Issue 12545006: The worker process launcher can now ask the worker to crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
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 <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
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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 } else { 1087 } else {
1087 // This method is used as a callback for ChromotingHost::Shutdown() which is 1088 // This method is used as a callback for ChromotingHost::Shutdown() which is
1088 // called only in STOPPING_TO_RESTART and STOPPING states. 1089 // called only in STOPPING_TO_RESTART and STOPPING states.
1089 NOTREACHED(); 1090 NOTREACHED();
1090 } 1091 }
1091 } 1092 }
1092 1093
1093 void HostProcess::OnCrash(const std::string& function_name, 1094 void HostProcess::OnCrash(const std::string& function_name,
1094 const std::string& file_name, 1095 const std::string& file_name,
1095 const int& line_number) { 1096 const int& line_number) {
1096 CHECK(false); 1097 char message[1024];
1098 base::snprintf(message, sizeof(message),
1099 "Requested by %s at %s, line %d.",
1100 function_name.c_str(), file_name.c_str(), line_number);
1101 base::debug::Alias(message);
1102
1103 // The daemon requested us to crash the process.
1104 CHECK(false) << message;
1097 } 1105 }
1098 1106
1099 int HostProcessMain() { 1107 int HostProcessMain() {
1100 #if defined(TOOLKIT_GTK) 1108 #if defined(TOOLKIT_GTK)
1101 // Required for any calls into GTK functions, such as the Disconnect and 1109 // Required for any calls into GTK functions, such as the Disconnect and
1102 // Continue windows, though these should not be used for the Me2Me case 1110 // Continue windows, though these should not be used for the Me2Me case
1103 // (crbug.com/104377). 1111 // (crbug.com/104377).
1104 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); 1112 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess());
1105 #endif // TOOLKIT_GTK 1113 #endif // TOOLKIT_GTK
1106 1114
(...skipping 22 matching lines...) Expand all
1129 return exit_code; 1137 return exit_code;
1130 } 1138 }
1131 1139
1132 } // namespace remoting 1140 } // namespace remoting
1133 1141
1134 #if !defined(OS_WIN) 1142 #if !defined(OS_WIN)
1135 int main(int argc, char** argv) { 1143 int main(int argc, char** argv) {
1136 return remoting::HostMain(argc, argv); 1144 return remoting::HostMain(argc, argv);
1137 } 1145 }
1138 #endif // !defined(OS_WIN) 1146 #endif // !defined(OS_WIN)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698