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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 if (!config->Read()) { | 126 if (!config->Read()) { |
127 LOG(ERROR) << "Failed to read configuration file " << config_path.value(); | 127 LOG(ERROR) << "Failed to read configuration file " << config_path.value(); |
128 return 1; | 128 return 1; |
129 } | 129 } |
130 | 130 |
131 // Allocate a chromoting context and starts it. | 131 // Allocate a chromoting context and starts it. |
132 remoting::ChromotingHostContext context; | 132 remoting::ChromotingHostContext context; |
133 context.Start(); | 133 context.Start(); |
134 | 134 |
135 // Construct a chromoting host. | 135 // Construct a chromoting host. |
136 scoped_refptr<remoting::ChromotingHost> host = | 136 scoped_refptr<remoting::ChromotingHost> host( |
137 new remoting::ChromotingHost(&context, | 137 new remoting::ChromotingHost(&context, |
138 config, | 138 config, |
139 capturer.release(), | 139 capturer.release(), |
140 encoder.release(), | 140 encoder.release(), |
141 event_handler.release()); | 141 event_handler.release())); |
142 | 142 |
143 // Let the chromoting host run until the shutdown task is executed. | 143 // Let the chromoting host run until the shutdown task is executed. |
144 MessageLoop message_loop(MessageLoop::TYPE_UI); | 144 MessageLoop message_loop(MessageLoop::TYPE_UI); |
145 host->Start(NewRunnableFunction(&ShutdownTask, &message_loop)); | 145 host->Start(NewRunnableFunction(&ShutdownTask, &message_loop)); |
146 message_loop.Run(); | 146 message_loop.Run(); |
147 | 147 |
148 // And then stop the chromoting context. | 148 // And then stop the chromoting context. |
149 context.Stop(); | 149 context.Stop(); |
150 file_io_thread.Stop(); | 150 file_io_thread.Stop(); |
151 return 0; | 151 return 0; |
152 } | 152 } |
OLD | NEW |