| 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 14 matching lines...) Expand all Loading... |
| 25 #include "base/logging.h" | 25 #include "base/logging.h" |
| 26 #include "base/mac/scoped_nsautorelease_pool.h" | 26 #include "base/mac/scoped_nsautorelease_pool.h" |
| 27 #include "base/nss_util.h" | 27 #include "base/nss_util.h" |
| 28 #include "base/path_service.h" | 28 #include "base/path_service.h" |
| 29 #include "base/threading/thread.h" | 29 #include "base/threading/thread.h" |
| 30 #include "media/base/media.h" | 30 #include "media/base/media.h" |
| 31 #include "remoting/base/tracer.h" | 31 #include "remoting/base/tracer.h" |
| 32 #include "remoting/host/capturer_fake.h" | 32 #include "remoting/host/capturer_fake.h" |
| 33 #include "remoting/host/chromoting_host.h" | 33 #include "remoting/host/chromoting_host.h" |
| 34 #include "remoting/host/chromoting_host_context.h" | 34 #include "remoting/host/chromoting_host_context.h" |
| 35 #include "remoting/host/event_executor.h" | |
| 36 #include "remoting/host/json_host_config.h" | 35 #include "remoting/host/json_host_config.h" |
| 37 #include "remoting/proto/video.pb.h" | 36 #include "remoting/proto/video.pb.h" |
| 38 | 37 |
| 39 using remoting::ChromotingHost; | 38 using remoting::ChromotingHost; |
| 40 using remoting::protocol::CandidateSessionConfig; | 39 using remoting::protocol::CandidateSessionConfig; |
| 41 using remoting::protocol::ChannelConfig; | 40 using remoting::protocol::ChannelConfig; |
| 42 using std::string; | 41 using std::string; |
| 43 using std::wstring; | 42 using std::wstring; |
| 44 | 43 |
| 45 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 FilePath module_path; | 109 FilePath module_path; |
| 111 PathService::Get(base::DIR_MODULE, &module_path); | 110 PathService::Get(base::DIR_MODULE, &module_path); |
| 112 CHECK(media::InitializeMediaLibrary(module_path)) | 111 CHECK(media::InitializeMediaLibrary(module_path)) |
| 113 << "Cannot load media library"; | 112 << "Cannot load media library"; |
| 114 | 113 |
| 115 // Construct a chromoting host. | 114 // Construct a chromoting host. |
| 116 scoped_refptr<ChromotingHost> host; | 115 scoped_refptr<ChromotingHost> host; |
| 117 | 116 |
| 118 bool fake = cmd_line->HasSwitch(kFakeSwitchName); | 117 bool fake = cmd_line->HasSwitch(kFakeSwitchName); |
| 119 if (fake) { | 118 if (fake) { |
| 120 remoting::Capturer* capturer = | |
| 121 new remoting::CapturerFake(context.main_message_loop()); | |
| 122 remoting::protocol::InputStub* input_stub = | |
| 123 CreateEventExecutor(context.main_message_loop(), capturer); | |
| 124 host = ChromotingHost::Create( | 119 host = ChromotingHost::Create( |
| 125 &context, config, capturer, input_stub); | 120 &context, config, |
| 121 new remoting::CapturerFake(context.main_message_loop())); |
| 126 } else { | 122 } else { |
| 127 host = ChromotingHost::Create(&context, config); | 123 host = ChromotingHost::Create(&context, config); |
| 128 } | 124 } |
| 129 | 125 |
| 130 if (cmd_line->HasSwitch(kVideoSwitchName)) { | 126 if (cmd_line->HasSwitch(kVideoSwitchName)) { |
| 131 string video_codec = cmd_line->GetSwitchValueASCII(kVideoSwitchName); | 127 string video_codec = cmd_line->GetSwitchValueASCII(kVideoSwitchName); |
| 132 scoped_ptr<CandidateSessionConfig> config( | 128 scoped_ptr<CandidateSessionConfig> config( |
| 133 CandidateSessionConfig::CreateDefault()); | 129 CandidateSessionConfig::CreateDefault()); |
| 134 config->mutable_video_configs()->clear(); | 130 config->mutable_video_configs()->clear(); |
| 135 | 131 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 157 // Let the chromoting host run until the shutdown task is executed. | 153 // Let the chromoting host run until the shutdown task is executed. |
| 158 MessageLoop message_loop(MessageLoop::TYPE_UI); | 154 MessageLoop message_loop(MessageLoop::TYPE_UI); |
| 159 host->Start(NewRunnableFunction(&ShutdownTask, &message_loop)); | 155 host->Start(NewRunnableFunction(&ShutdownTask, &message_loop)); |
| 160 message_loop.Run(); | 156 message_loop.Run(); |
| 161 | 157 |
| 162 // And then stop the chromoting context. | 158 // And then stop the chromoting context. |
| 163 context.Stop(); | 159 context.Stop(); |
| 164 file_io_thread.Stop(); | 160 file_io_thread.Stop(); |
| 165 return 0; | 161 return 0; |
| 166 } | 162 } |
| OLD | NEW |