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. |
11 // 2. Accepts connection through libjingle. | 11 // 2. Accepts connection through libjingle. |
12 // 3. Receive mouse / keyboard events through libjingle. | 12 // 3. Receive mouse / keyboard events through libjingle. |
13 // 4. Sends screen capture through libjingle. | 13 // 4. Sends screen capture through libjingle. |
14 | 14 |
15 #include <iostream> | 15 #include <iostream> |
16 #include <string> | 16 #include <string> |
17 #include <stdlib.h> | 17 #include <stdlib.h> |
18 | 18 |
19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
20 | 20 |
21 #include "base/at_exit.h" | 21 #include "base/at_exit.h" |
22 #include "base/command_line.h" | 22 #include "base/command_line.h" |
23 #include "base/environment.h" | 23 #include "base/environment.h" |
24 #include "base/file_path.h" | 24 #include "base/file_path.h" |
25 #include "base/logging.h" | 25 #include "base/logging.h" |
| 26 #include "base/mac/scoped_nsautorelease_pool.h" |
26 #include "base/nss_util.h" | 27 #include "base/nss_util.h" |
27 #include "base/scoped_nsautorelease_pool.h" | |
28 #include "base/thread.h" | 28 #include "base/thread.h" |
29 #include "remoting/base/encoder_verbatim.h" | 29 #include "remoting/base/encoder_verbatim.h" |
30 #include "remoting/base/encoder_zlib.h" | 30 #include "remoting/base/encoder_zlib.h" |
31 #include "remoting/host/capturer_fake.h" | 31 #include "remoting/host/capturer_fake.h" |
32 #include "remoting/host/chromoting_host.h" | 32 #include "remoting/host/chromoting_host.h" |
33 #include "remoting/host/chromoting_host_context.h" | 33 #include "remoting/host/chromoting_host_context.h" |
34 #include "remoting/host/json_host_config.h" | 34 #include "remoting/host/json_host_config.h" |
35 #include "remoting/base/tracer.h" | 35 #include "remoting/base/tracer.h" |
36 | 36 |
37 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
(...skipping 20 matching lines...) Expand all Loading... |
58 void ShutdownTask(MessageLoop* message_loop) { | 58 void ShutdownTask(MessageLoop* message_loop) { |
59 message_loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 59 message_loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); |
60 } | 60 } |
61 | 61 |
62 const std::string kFakeSwitchName = "fake"; | 62 const std::string kFakeSwitchName = "fake"; |
63 const std::string kConfigSwitchName = "config"; | 63 const std::string kConfigSwitchName = "config"; |
64 const std::string kVerbatimSwitchName = "verbatim"; | 64 const std::string kVerbatimSwitchName = "verbatim"; |
65 | 65 |
66 int main(int argc, char** argv) { | 66 int main(int argc, char** argv) { |
67 // Needed for the Mac, so we don't leak objects when threads are created. | 67 // Needed for the Mac, so we don't leak objects when threads are created. |
68 base::ScopedNSAutoreleasePool pool; | 68 base::mac::ScopedNSAutoreleasePool pool; |
69 | 69 |
70 CommandLine::Init(argc, argv); | 70 CommandLine::Init(argc, argv); |
71 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 71 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
72 | 72 |
73 base::AtExitManager exit_manager; | 73 base::AtExitManager exit_manager; |
74 | 74 |
75 base::EnsureNSPRInit(); | 75 base::EnsureNSPRInit(); |
76 | 76 |
77 scoped_ptr<remoting::Capturer> capturer; | 77 scoped_ptr<remoting::Capturer> capturer; |
78 scoped_ptr<remoting::Encoder> encoder; | 78 scoped_ptr<remoting::Encoder> encoder; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |