| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 is an application of a minimal host process in a Chromoting | 5 // This is an application of a minimal host process in a Chromoting |
| 6 // system. It serves the purpose of gluing different pieces together | 6 // system. It serves the purpose of gluing different pieces together |
| 7 // to make a functional host process for testing. | 7 // to make a functional host process for testing. |
| 8 // | 8 // |
| 9 // It peforms the following functionality: | 9 // It peforms the following functionality: |
| 10 // 1. Connect to the GTalk network and register the machine as a host. | 10 // 1. Connect to the GTalk network and register the machine as a host. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // Needed for the Mac, so we don't leak objects when threads are created. | 71 // Needed for the Mac, so we don't leak objects when threads are created. |
| 72 base::mac::ScopedNSAutoreleasePool pool; | 72 base::mac::ScopedNSAutoreleasePool pool; |
| 73 | 73 |
| 74 CommandLine::Init(argc, argv); | 74 CommandLine::Init(argc, argv); |
| 75 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 75 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 76 | 76 |
| 77 base::AtExitManager exit_manager; | 77 base::AtExitManager exit_manager; |
| 78 base::EnsureNSPRInit(); | 78 base::EnsureNSPRInit(); |
| 79 | 79 |
| 80 // Allocate a chromoting context and starts it. | 80 // Allocate a chromoting context and starts it. |
| 81 remoting::ChromotingHostContext context; | 81 MessageLoop message_loop(MessageLoop::TYPE_UI); |
| 82 remoting::ChromotingHostContext context(&message_loop); |
| 82 context.Start(); | 83 context.Start(); |
| 83 | 84 |
| 84 | 85 |
| 85 #if defined(OS_WIN) | 86 #if defined(OS_WIN) |
| 86 wstring home_path = GetEnvironmentVar(kHomeDrive); | 87 wstring home_path = GetEnvironmentVar(kHomeDrive); |
| 87 home_path += GetEnvironmentVar(kHomePath); | 88 home_path += GetEnvironmentVar(kHomePath); |
| 88 #else | 89 #else |
| 89 string home_path = GetEnvironmentVar(base::env_vars::kHome); | 90 string home_path = GetEnvironmentVar(base::env_vars::kHome); |
| 90 #endif | 91 #endif |
| 91 FilePath config_path(home_path); | 92 FilePath config_path(home_path); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 LOG(ERROR) << "Unknown video codec: " << video_codec; | 149 LOG(ERROR) << "Unknown video codec: " << video_codec; |
| 149 context.Stop(); | 150 context.Stop(); |
| 150 return 1; | 151 return 1; |
| 151 } | 152 } |
| 152 config->mutable_video_configs()->push_back(ChannelConfig( | 153 config->mutable_video_configs()->push_back(ChannelConfig( |
| 153 transport, remoting::protocol::kDefaultStreamVersion, codec)); | 154 transport, remoting::protocol::kDefaultStreamVersion, codec)); |
| 154 host->set_protocol_config(config.release()); | 155 host->set_protocol_config(config.release()); |
| 155 } | 156 } |
| 156 | 157 |
| 157 // Let the chromoting host run until the shutdown task is executed. | 158 // Let the chromoting host run until the shutdown task is executed. |
| 158 MessageLoop message_loop(MessageLoop::TYPE_UI); | |
| 159 host->Start(NewRunnableFunction(&ShutdownTask, &message_loop)); | 159 host->Start(NewRunnableFunction(&ShutdownTask, &message_loop)); |
| 160 message_loop.Run(); | 160 message_loop.Run(); |
| 161 | 161 |
| 162 // And then stop the chromoting context. | 162 // And then stop the chromoting context. |
| 163 context.Stop(); | 163 context.Stop(); |
| 164 file_io_thread.Stop(); | 164 file_io_thread.Stop(); |
| 165 return 0; | 165 return 0; |
| 166 } | 166 } |
| OLD | NEW |