| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "remoting/host/chromoting_host_context.h" | 5 #include "remoting/host/chromoting_host_context.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "remoting/base/auto_thread.h" | 10 #include "remoting/base/auto_thread.h" |
| 11 #include "remoting/host/url_request_context.h" | 11 #include "remoting/host/url_request_context.h" |
| 12 | 12 |
| 13 namespace remoting { | 13 namespace remoting { |
| 14 | 14 |
| 15 ChromotingHostContext::ChromotingHostContext( | 15 ChromotingHostContext::ChromotingHostContext( |
| 16 AutoThreadTaskRunner* ui_task_runner) | 16 AutoThreadTaskRunner* ui_task_runner) |
| 17 : ui_task_runner_(ui_task_runner) { | 17 : ui_task_runner_(ui_task_runner) { |
| 18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| 19 // On Windows the AudioCapturer requires COM, so we run a single-threaded | 19 // On Windows the AudioCapturer requires COM, so we run a single-threaded |
| 20 // apartment, which requires a UI thread. | 20 // apartment, which requires a UI thread. |
| 21 audio_task_runner_ = AutoThread::CreateWithLoopAndComInitTypes( | 21 audio_task_runner_ = |
| 22 "ChromotingAudioThread", ui_task_runner_, MessageLoop::TYPE_UI, | 22 AutoThread::CreateWithLoopAndComInitTypes("ChromotingAudioThread", |
| 23 AutoThread::COM_INIT_STA); | 23 ui_task_runner_, |
| 24 base::MessageLoop::TYPE_UI, |
| 25 AutoThread::COM_INIT_STA); |
| 24 #else // !defined(OS_WIN) | 26 #else // !defined(OS_WIN) |
| 25 audio_task_runner_ = AutoThread::CreateWithType( | 27 audio_task_runner_ = AutoThread::CreateWithType( |
| 26 "ChromotingAudioThread", ui_task_runner_, MessageLoop::TYPE_IO); | 28 "ChromotingAudioThread", ui_task_runner_, base::MessageLoop::TYPE_IO); |
| 27 #endif // !defined(OS_WIN) | 29 #endif // !defined(OS_WIN) |
| 28 | 30 |
| 29 file_task_runner_ = AutoThread::CreateWithType( | 31 file_task_runner_ = AutoThread::CreateWithType( |
| 30 "ChromotingFileThread", ui_task_runner_, MessageLoop::TYPE_IO); | 32 "ChromotingFileThread", ui_task_runner_, base::MessageLoop::TYPE_IO); |
| 31 input_task_runner_ = AutoThread::CreateWithType( | 33 input_task_runner_ = AutoThread::CreateWithType( |
| 32 "ChromotingInputThread", ui_task_runner_, MessageLoop::TYPE_IO); | 34 "ChromotingInputThread", ui_task_runner_, base::MessageLoop::TYPE_IO); |
| 33 network_task_runner_ = AutoThread::CreateWithType( | 35 network_task_runner_ = AutoThread::CreateWithType( |
| 34 "ChromotingNetworkThread", ui_task_runner_, MessageLoop::TYPE_IO); | 36 "ChromotingNetworkThread", ui_task_runner_, base::MessageLoop::TYPE_IO); |
| 35 video_capture_task_runner_ = AutoThread::Create( | 37 video_capture_task_runner_ = |
| 36 "ChromotingCaptureThread", ui_task_runner_); | 38 AutoThread::Create("ChromotingCaptureThread", ui_task_runner_); |
| 37 video_encode_task_runner_ = AutoThread::Create( | 39 video_encode_task_runner_ = AutoThread::Create( |
| 38 "ChromotingEncodeThread", ui_task_runner_); | 40 "ChromotingEncodeThread", ui_task_runner_); |
| 39 | 41 |
| 40 url_request_context_getter_ = new URLRequestContextGetter( | 42 url_request_context_getter_ = new URLRequestContextGetter( |
| 41 ui_task_runner_, network_task_runner_); | 43 ui_task_runner_, network_task_runner_); |
| 42 } | 44 } |
| 43 | 45 |
| 44 ChromotingHostContext::~ChromotingHostContext() { | 46 ChromotingHostContext::~ChromotingHostContext() { |
| 45 } | 47 } |
| 46 | 48 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 ChromotingHostContext::video_encode_task_runner() { | 99 ChromotingHostContext::video_encode_task_runner() { |
| 98 return video_encode_task_runner_; | 100 return video_encode_task_runner_; |
| 99 } | 101 } |
| 100 | 102 |
| 101 scoped_refptr<net::URLRequestContextGetter> | 103 scoped_refptr<net::URLRequestContextGetter> |
| 102 ChromotingHostContext::url_request_context_getter() { | 104 ChromotingHostContext::url_request_context_getter() { |
| 103 return url_request_context_getter_; | 105 return url_request_context_getter_; |
| 104 } | 106 } |
| 105 | 107 |
| 106 } // namespace remoting | 108 } // namespace remoting |
| OLD | NEW |