OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "remoting/host/chromoting_host_context_impl.h" |
| 6 |
| 7 #include "remoting/base/auto_thread.h" |
| 8 #include "remoting/base/url_request_context_getter.h" |
| 9 |
| 10 namespace remoting { |
| 11 |
| 12 ChromotingHostContextImpl::ChromotingHostContextImpl( |
| 13 AutoThreadTaskRunner* ui_task_runner) |
| 14 : ChromotingHostContext(ui_task_runner) { |
| 15 #if defined(OS_WIN) |
| 16 // On Windows the AudioCapturer requires COM, so we run a single-threaded |
| 17 // apartment, which requires a UI thread. |
| 18 audio_task_runner_ = |
| 19 AutoThread::CreateWithLoopAndComInitTypes("ChromotingAudioThread", |
| 20 ui_task_runner_, |
| 21 base::MessageLoop::TYPE_UI, |
| 22 AutoThread::COM_INIT_STA); |
| 23 #else // !defined(OS_WIN) |
| 24 audio_task_runner_ = AutoThread::CreateWithType( |
| 25 "ChromotingAudioThread", ui_task_runner_, base::MessageLoop::TYPE_IO); |
| 26 #endif // !defined(OS_WIN) |
| 27 |
| 28 file_task_runner_ = AutoThread::CreateWithType( |
| 29 "ChromotingFileThread", ui_task_runner_, base::MessageLoop::TYPE_IO); |
| 30 input_task_runner_ = AutoThread::CreateWithType( |
| 31 "ChromotingInputThread", ui_task_runner_, base::MessageLoop::TYPE_IO); |
| 32 network_task_runner_ = AutoThread::CreateWithType( |
| 33 "ChromotingNetworkThread", ui_task_runner_, base::MessageLoop::TYPE_IO); |
| 34 video_capture_task_runner_ = |
| 35 AutoThread::Create("ChromotingCaptureThread", ui_task_runner_); |
| 36 video_encode_task_runner_ = AutoThread::Create( |
| 37 "ChromotingEncodeThread", ui_task_runner_); |
| 38 url_request_context_getter_ = new URLRequestContextGetter( |
| 39 network_task_runner_, file_task_runner_); |
| 40 } |
| 41 |
| 42 ChromotingHostContextImpl::~ChromotingHostContextImpl() { |
| 43 } |
| 44 |
| 45 #if !defined(OS_CHROMEOS) |
| 46 // static |
| 47 scoped_refptr<ChromotingHostContext> ChromotingHostContext::Create( |
| 48 scoped_refptr<AutoThreadTaskRunner> ui_task_runner) { |
| 49 return new ChromotingHostContextImpl(ui_task_runner.get()); |
| 50 } |
| 51 #endif // !defined(OS_CHROMEOS) |
| 52 |
| 53 } // namespace remoting |
OLD | NEW |