| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "remoting/host/local_desktop_environment.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "base/single_thread_task_runner.h" |
| 9 #include "remoting/capturer/video_frame_capturer.h" |
| 10 #include "remoting/host/audio_capturer.h" |
| 11 #include "remoting/host/event_executor.h" |
| 12 |
| 13 namespace remoting { |
| 14 |
| 15 LocalDesktopEnvironment::LocalDesktopEnvironment( |
| 16 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 17 const CreateEventExecutorCallback& create_event_executor_callback) |
| 18 : caller_task_runner_(caller_task_runner), |
| 19 create_event_executor_callback_(create_event_executor_callback), |
| 20 audio_capturer_created_(false), |
| 21 video_capturer_created_(false) { |
| 22 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 23 } |
| 24 |
| 25 LocalDesktopEnvironment::~LocalDesktopEnvironment() { |
| 26 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 27 } |
| 28 |
| 29 scoped_ptr<AudioCapturer> LocalDesktopEnvironment::CreateAudioCapturer( |
| 30 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner) { |
| 31 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 32 |
| 33 scoped_ptr<AudioCapturer> audio_capturer; |
| 34 if (!audio_capturer_created_) { |
| 35 audio_capturer = AudioCapturer::Create(); |
| 36 audio_capturer_created_ = true; |
| 37 } |
| 38 |
| 39 return audio_capturer.Pass(); |
| 40 } |
| 41 |
| 42 scoped_ptr<EventExecutor> LocalDesktopEnvironment::CreateEventExecutor( |
| 43 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 44 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
| 45 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 46 |
| 47 scoped_ptr<EventExecutor> event_executor = |
| 48 create_event_executor_callback_.Run(input_task_runner, ui_task_runner); |
| 49 create_event_executor_callback_.Reset(); |
| 50 return event_executor.Pass(); |
| 51 } |
| 52 |
| 53 scoped_ptr<VideoFrameCapturer> LocalDesktopEnvironment::CreateVideoCapturer( |
| 54 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, |
| 55 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner) { |
| 56 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 57 |
| 58 scoped_ptr<VideoFrameCapturer> video_capturer; |
| 59 if (!video_capturer_created_) { |
| 60 video_capturer = VideoFrameCapturer::Create(); |
| 61 video_capturer_created_ = true; |
| 62 } |
| 63 |
| 64 return video_capturer.Pass(); |
| 65 } |
| 66 |
| 67 } // namespace remoting |
| OLD | NEW |