| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 : fake_(false), | 97 : fake_(false), |
| 98 is_it2me_(false) { | 98 is_it2me_(false) { |
| 99 } | 99 } |
| 100 | 100 |
| 101 int Run() { | 101 int Run() { |
| 102 // |message_loop| is declared early so that any code we call into which | 102 // |message_loop| is declared early so that any code we call into which |
| 103 // requires a current message-loop won't complain. | 103 // requires a current message-loop won't complain. |
| 104 // It needs to be a UI message loop to keep runloops spinning on the Mac. | 104 // It needs to be a UI message loop to keep runloops spinning on the Mac. |
| 105 MessageLoop message_loop(MessageLoop::TYPE_UI); | 105 MessageLoop message_loop(MessageLoop::TYPE_UI); |
| 106 | 106 |
| 107 remoting::ChromotingHostContext context; | 107 remoting::ChromotingHostContext context( |
| 108 // static_cast needed to resolve overloaded PostTask member-function. | 108 base::MessageLoopProxy::CreateForCurrentThread()); |
| 109 context.SetUITaskPostFunction(base::Bind( | |
| 110 static_cast<void(MessageLoop::*)( | |
| 111 const tracked_objects::Location&, | |
| 112 const base::Closure&)>(&MessageLoop::PostTask), | |
| 113 base::Unretained(&message_loop))); | |
| 114 context.Start(); | 109 context.Start(); |
| 115 | 110 |
| 116 base::Thread file_io_thread("FileIO"); | 111 base::Thread file_io_thread("FileIO"); |
| 117 file_io_thread.Start(); | 112 file_io_thread.Start(); |
| 118 | 113 |
| 119 FilePath config_path = GetConfigPath(); | 114 FilePath config_path = GetConfigPath(); |
| 120 scoped_refptr<remoting::JsonHostConfig> config = | 115 scoped_refptr<remoting::JsonHostConfig> config = |
| 121 new remoting::JsonHostConfig( | 116 new remoting::JsonHostConfig( |
| 122 config_path, file_io_thread.message_loop_proxy()); | 117 config_path, file_io_thread.message_loop_proxy()); |
| 123 if (!config->Read()) { | 118 if (!config->Read()) { |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 LOG(ERROR) << "Unknown video codec: " << video_codec; | 315 LOG(ERROR) << "Unknown video codec: " << video_codec; |
| 321 return 1; | 316 return 1; |
| 322 } | 317 } |
| 323 config->mutable_video_configs()->push_back(ChannelConfig( | 318 config->mutable_video_configs()->push_back(ChannelConfig( |
| 324 transport, remoting::protocol::kDefaultStreamVersion, codec)); | 319 transport, remoting::protocol::kDefaultStreamVersion, codec)); |
| 325 simple_host.set_protocol_config(config.release()); | 320 simple_host.set_protocol_config(config.release()); |
| 326 } | 321 } |
| 327 | 322 |
| 328 return simple_host.Run(); | 323 return simple_host.Run(); |
| 329 } | 324 } |
| OLD | NEW |