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 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 1080 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
1081 gfx::GtkInitFromCommandLine(*cmd_line); | 1081 gfx::GtkInitFromCommandLine(*cmd_line); |
1082 #endif // TOOLKIT_GTK | 1082 #endif // TOOLKIT_GTK |
1083 | 1083 |
1084 // Enable support for SSL server sockets, which must be done while still | 1084 // Enable support for SSL server sockets, which must be done while still |
1085 // single-threaded. | 1085 // single-threaded. |
1086 net::EnableSSLServerSockets(); | 1086 net::EnableSSLServerSockets(); |
1087 | 1087 |
1088 // Create the main message loop and start helper threads. | 1088 // Create the main message loop and start helper threads. |
1089 MessageLoop message_loop(MessageLoop::TYPE_UI); | 1089 MessageLoop message_loop(MessageLoop::TYPE_UI); |
1090 base::Closure quit_message_loop = base::Bind(&QuitMessageLoop, &message_loop); | 1090 scoped_ptr<remoting::ChromotingHostContext> context = |
1091 scoped_ptr<remoting::ChromotingHostContext> context( | 1091 remoting::ChromotingHostContext::Create( |
1092 new remoting::ChromotingHostContext( | |
1093 new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(), | 1092 new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(), |
1094 quit_message_loop))); | 1093 MessageLoop::QuitClosure())); |
1095 | 1094 if (!context) |
1096 if (!context->Start()) | |
1097 return remoting::kInitializationFailed; | 1095 return remoting::kInitializationFailed; |
1098 | 1096 |
1099 // Create & start the HostProcess using these threads. | 1097 // Create & start the HostProcess using these threads. |
1100 // TODO(wez): The HostProcess holds a reference to itself until Shutdown(). | 1098 // TODO(wez): The HostProcess holds a reference to itself until Shutdown(). |
1101 // Remove this hack as part of the multi-process refactoring. | 1099 // Remove this hack as part of the multi-process refactoring. |
1102 int exit_code = remoting::kSuccessExitCode; | 1100 int exit_code = remoting::kSuccessExitCode; |
1103 new remoting::HostProcess(context.Pass(), &exit_code); | 1101 new remoting::HostProcess(context.Pass(), &exit_code); |
1104 | 1102 |
1105 // Run the main (also UI) message loop until the host no longer needs it. | 1103 // Run the main (also UI) message loop until the host no longer needs it. |
1106 message_loop.Run(); | 1104 message_loop.Run(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 user32.GetFunctionPointer("SetProcessDPIAware")); | 1140 user32.GetFunctionPointer("SetProcessDPIAware")); |
1143 set_process_dpi_aware(); | 1141 set_process_dpi_aware(); |
1144 } | 1142 } |
1145 | 1143 |
1146 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 1144 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
1147 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 1145 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
1148 return main(0, NULL); | 1146 return main(0, NULL); |
1149 } | 1147 } |
1150 | 1148 |
1151 #endif // defined(OS_WIN) | 1149 #endif // defined(OS_WIN) |
OLD | NEW |