| 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 base::MessageLoopProxy::current()); | 108 // static_cast needed to resolve overloaded PostTask member-function. |
| 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))); |
| 109 context.Start(); | 114 context.Start(); |
| 110 | 115 |
| 111 base::Thread file_io_thread("FileIO"); | 116 base::Thread file_io_thread("FileIO"); |
| 112 file_io_thread.Start(); | 117 file_io_thread.Start(); |
| 113 | 118 |
| 114 FilePath config_path = GetConfigPath(); | 119 FilePath config_path = GetConfigPath(); |
| 115 scoped_refptr<remoting::JsonHostConfig> config = | 120 scoped_refptr<remoting::JsonHostConfig> config = |
| 116 new remoting::JsonHostConfig( | 121 new remoting::JsonHostConfig( |
| 117 config_path, file_io_thread.message_loop_proxy()); | 122 config_path, file_io_thread.message_loop_proxy()); |
| 118 if (!config->Read()) { | 123 if (!config->Read()) { |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 LOG(ERROR) << "Unknown video codec: " << video_codec; | 320 LOG(ERROR) << "Unknown video codec: " << video_codec; |
| 316 return 1; | 321 return 1; |
| 317 } | 322 } |
| 318 config->mutable_video_configs()->push_back(ChannelConfig( | 323 config->mutable_video_configs()->push_back(ChannelConfig( |
| 319 transport, remoting::protocol::kDefaultStreamVersion, codec)); | 324 transport, remoting::protocol::kDefaultStreamVersion, codec)); |
| 320 simple_host.set_protocol_config(config.release()); | 325 simple_host.set_protocol_config(config.release()); |
| 321 } | 326 } |
| 322 | 327 |
| 323 return simple_host.Run(); | 328 return simple_host.Run(); |
| 324 } | 329 } |
| OLD | NEW |