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 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 1060 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
1061 gfx::GtkInitFromCommandLine(*cmd_line); | 1061 gfx::GtkInitFromCommandLine(*cmd_line); |
1062 #endif // TOOLKIT_GTK | 1062 #endif // TOOLKIT_GTK |
1063 | 1063 |
1064 // Enable support for SSL server sockets, which must be done while still | 1064 // Enable support for SSL server sockets, which must be done while still |
1065 // single-threaded. | 1065 // single-threaded. |
1066 net::EnableSSLServerSockets(); | 1066 net::EnableSSLServerSockets(); |
1067 | 1067 |
1068 // Create the main message loop and start helper threads. | 1068 // Create the main message loop and start helper threads. |
1069 MessageLoop message_loop(MessageLoop::TYPE_UI); | 1069 MessageLoop message_loop(MessageLoop::TYPE_UI); |
1070 base::Closure quit_message_loop = base::Bind(&QuitMessageLoop, &message_loop); | 1070 scoped_ptr<remoting::ChromotingHostContext> context = |
1071 scoped_ptr<remoting::ChromotingHostContext> context( | 1071 remoting::ChromotingHostContext::Create( |
1072 new remoting::ChromotingHostContext( | |
1073 new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(), | 1072 new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(), |
1074 quit_message_loop))); | 1073 MessageLoop::QuitClosure())); |
1075 | 1074 if (context) |
1076 if (!context->Start()) | |
1077 return remoting::kInitializationFailed; | 1075 return remoting::kInitializationFailed; |
1078 | 1076 |
1079 // Create & start the HostProcess using these threads. | 1077 // Create & start the HostProcess using these threads. |
1080 // TODO(wez): The HostProcess holds a reference to itself until Shutdown(). | 1078 // TODO(wez): The HostProcess holds a reference to itself until Shutdown(). |
1081 // Remove this hack as part of the multi-process refactoring. | 1079 // Remove this hack as part of the multi-process refactoring. |
1082 int exit_code = remoting::kSuccessExitCode; | 1080 int exit_code = remoting::kSuccessExitCode; |
1083 new remoting::HostProcess(context.Pass(), &exit_code); | 1081 new remoting::HostProcess(context.Pass(), &exit_code); |
1084 | 1082 |
1085 // Run the main (also UI) message loop until the host no longer needs it. | 1083 // Run the main (also UI) message loop until the host no longer needs it. |
1086 message_loop.Run(); | 1084 message_loop.Run(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 user32.GetFunctionPointer("SetProcessDPIAware")); | 1120 user32.GetFunctionPointer("SetProcessDPIAware")); |
1123 set_process_dpi_aware(); | 1121 set_process_dpi_aware(); |
1124 } | 1122 } |
1125 | 1123 |
1126 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 1124 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
1127 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 1125 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
1128 return main(0, NULL); | 1126 return main(0, NULL); |
1129 } | 1127 } |
1130 | 1128 |
1131 #endif // defined(OS_WIN) | 1129 #endif // defined(OS_WIN) |
OLD | NEW |