| Index: remoting/host/local_desktop_environment.cc
|
| diff --git a/remoting/host/local_desktop_environment.cc b/remoting/host/local_desktop_environment.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..be58d138501322ef5c3d4e819ffb0203fbf92fa0
|
| --- /dev/null
|
| +++ b/remoting/host/local_desktop_environment.cc
|
| @@ -0,0 +1,67 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "remoting/host/local_desktop_environment.h"
|
| +
|
| +#include "base/logging.h"
|
| +#include "base/single_thread_task_runner.h"
|
| +#include "remoting/capturer/video_frame_capturer.h"
|
| +#include "remoting/host/audio_capturer.h"
|
| +#include "remoting/host/event_executor.h"
|
| +
|
| +namespace remoting {
|
| +
|
| +LocalDesktopEnvironment::LocalDesktopEnvironment(
|
| + scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
|
| + const CreateEventExecutorCallback& create_event_executor_callback)
|
| + : caller_task_runner_(caller_task_runner),
|
| + create_event_executor_callback_(create_event_executor_callback),
|
| + audio_capturer_created_(false),
|
| + video_capturer_created_(false) {
|
| + DCHECK(caller_task_runner_->BelongsToCurrentThread());
|
| +}
|
| +
|
| +LocalDesktopEnvironment::~LocalDesktopEnvironment() {
|
| + DCHECK(caller_task_runner_->BelongsToCurrentThread());
|
| +}
|
| +
|
| +scoped_ptr<AudioCapturer> LocalDesktopEnvironment::CreateAudioCapturer(
|
| + scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner) {
|
| + DCHECK(caller_task_runner_->BelongsToCurrentThread());
|
| +
|
| + scoped_ptr<AudioCapturer> audio_capturer;
|
| + if (!audio_capturer_created_) {
|
| + audio_capturer = AudioCapturer::Create();
|
| + audio_capturer_created_ = true;
|
| + }
|
| +
|
| + return audio_capturer.Pass();
|
| +}
|
| +
|
| +scoped_ptr<EventExecutor> LocalDesktopEnvironment::CreateEventExecutor(
|
| + scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
|
| + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
|
| + DCHECK(caller_task_runner_->BelongsToCurrentThread());
|
| +
|
| + scoped_ptr<EventExecutor> event_executor =
|
| + create_event_executor_callback_.Run(input_task_runner, ui_task_runner);
|
| + create_event_executor_callback_.Reset();
|
| + return event_executor.Pass();
|
| +}
|
| +
|
| +scoped_ptr<VideoFrameCapturer> LocalDesktopEnvironment::CreateVideoCapturer(
|
| + scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
|
| + scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner) {
|
| + DCHECK(caller_task_runner_->BelongsToCurrentThread());
|
| +
|
| + scoped_ptr<VideoFrameCapturer> video_capturer;
|
| + if (!video_capturer_created_) {
|
| + video_capturer = VideoFrameCapturer::Create();
|
| + video_capturer_created_ = true;
|
| + }
|
| +
|
| + return video_capturer.Pass();
|
| +}
|
| +
|
| +} // namespace remoting
|
|
|