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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 namespace { | 98 namespace { |
99 | 99 |
100 // This is used for tagging system event logs. | 100 // This is used for tagging system event logs. |
101 const char kApplicationName[] = "chromoting"; | 101 const char kApplicationName[] = "chromoting"; |
102 | 102 |
103 // The command line switch used to pass name of the pipe to capture audio on | 103 // The command line switch used to pass name of the pipe to capture audio on |
104 // linux. | 104 // linux. |
105 const char kAudioPipeSwitchName[] = "audio-pipe-name"; | 105 const char kAudioPipeSwitchName[] = "audio-pipe-name"; |
106 | 106 |
107 void QuitMessageLoop(MessageLoop* message_loop) { | 107 void QuitMessageLoop(base::MessageLoop* message_loop) { |
108 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 108 message_loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); |
109 } | 109 } |
110 | 110 |
111 } // namespace | 111 } // namespace |
112 | 112 |
113 namespace remoting { | 113 namespace remoting { |
114 | 114 |
115 class HostProcess | 115 class HostProcess |
116 : public ConfigFileWatcher::Delegate, | 116 : public ConfigFileWatcher::Delegate, |
117 public HeartbeatSender::Listener, | 117 public HeartbeatSender::Listener, |
118 public HostChangeNotificationListener::Listener, | 118 public HostChangeNotificationListener::Listener, |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 // Continue windows, though these should not be used for the Me2Me case | 1128 // Continue windows, though these should not be used for the Me2Me case |
1129 // (crbug.com/104377). | 1129 // (crbug.com/104377). |
1130 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); | 1130 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); |
1131 #endif // TOOLKIT_GTK | 1131 #endif // TOOLKIT_GTK |
1132 | 1132 |
1133 // Enable support for SSL server sockets, which must be done while still | 1133 // Enable support for SSL server sockets, which must be done while still |
1134 // single-threaded. | 1134 // single-threaded. |
1135 net::EnableSSLServerSockets(); | 1135 net::EnableSSLServerSockets(); |
1136 | 1136 |
1137 // Create the main message loop and start helper threads. | 1137 // Create the main message loop and start helper threads. |
1138 MessageLoop message_loop(MessageLoop::TYPE_UI); | 1138 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); |
1139 scoped_ptr<ChromotingHostContext> context = | 1139 scoped_ptr<ChromotingHostContext> context = |
1140 ChromotingHostContext::Create( | 1140 ChromotingHostContext::Create(new AutoThreadTaskRunner( |
1141 new AutoThreadTaskRunner(message_loop.message_loop_proxy(), | 1141 message_loop.message_loop_proxy(), base::MessageLoop::QuitClosure())); |
1142 MessageLoop::QuitClosure())); | |
1143 if (!context) | 1142 if (!context) |
1144 return kInitializationFailed; | 1143 return kInitializationFailed; |
1145 | 1144 |
1146 // Create & start the HostProcess using these threads. | 1145 // Create & start the HostProcess using these threads. |
1147 // TODO(wez): The HostProcess holds a reference to itself until Shutdown(). | 1146 // TODO(wez): The HostProcess holds a reference to itself until Shutdown(). |
1148 // Remove this hack as part of the multi-process refactoring. | 1147 // Remove this hack as part of the multi-process refactoring. |
1149 int exit_code = kSuccessExitCode; | 1148 int exit_code = kSuccessExitCode; |
1150 new HostProcess(context.Pass(), &exit_code); | 1149 new HostProcess(context.Pass(), &exit_code); |
1151 | 1150 |
1152 // Run the main (also UI) message loop until the host no longer needs it. | 1151 // Run the main (also UI) message loop until the host no longer needs it. |
1153 message_loop.Run(); | 1152 message_loop.Run(); |
1154 | 1153 |
1155 return exit_code; | 1154 return exit_code; |
1156 } | 1155 } |
1157 | 1156 |
1158 } // namespace remoting | 1157 } // namespace remoting |
1159 | 1158 |
1160 #if !defined(OS_WIN) | 1159 #if !defined(OS_WIN) |
1161 int main(int argc, char** argv) { | 1160 int main(int argc, char** argv) { |
1162 return remoting::HostMain(argc, argv); | 1161 return remoting::HostMain(argc, argv); |
1163 } | 1162 } |
1164 #endif // !defined(OS_WIN) | 1163 #endif // !defined(OS_WIN) |
OLD | NEW |