diff options
author | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-25 06:01:12 +0000 |
---|---|---|
committer | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-25 06:01:12 +0000 |
commit | 231316ac73519128e33c4cf0dcf3777cc362755a (patch) | |
tree | 52aac28e7dc43325efc860a8f8cdf64503b79c50 /remoting/host/basic_desktop_environment.h | |
parent | cf32b6c125778c8c116a51bc4035e39a85627aa0 (diff) | |
download | chromium_src-231316ac73519128e33c4cf0dcf3777cc362755a.zip chromium_src-231316ac73519128e33c4cf0dcf3777cc362755a.tar.gz chromium_src-231316ac73519128e33c4cf0dcf3777cc362755a.tar.bz2 |
Removed task runners from the DesktopEnviroment interface and introduced ScreenControls/ClientSessionControl interfaces.
This CL removes all task runners that used to be passed to methods of DesktopEnviroment and DesktopEnviromentFactory interfaces. Instead each object implementing these interfaces receives the set of task runners it needs in the constructor. This change makes DesktopEnviroment and DesktopEnviromentFactory interfaces cleaner and easier to implement.
Added the ScreenControls interface used by the client session to change the screen resolution. Objects implementing ScreenControls are created by DesktopEnvironment::CreateScreenControls() method.
DesktopEnviromentFactory::Create() now receives a pointer to the ClientSessionControl interface providing a way to pause, resume, and disconnect the client session. It also receives notifications about the local mouse movements to temporarily block the remote input. The ClientSessionControl interface will be hooked up to the local impit monitor and the host UI once they will be moved to DesktopEnvironment.
BUG=104544
Review URL: https://chromiumcodereview.appspot.com/12879006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190345 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/basic_desktop_environment.h')
-rw-r--r-- | remoting/host/basic_desktop_environment.h | 78 |
1 files changed, 60 insertions, 18 deletions
diff --git a/remoting/host/basic_desktop_environment.h b/remoting/host/basic_desktop_environment.h index a7f12cf..21e7be9 100644 --- a/remoting/host/basic_desktop_environment.h +++ b/remoting/host/basic_desktop_environment.h @@ -8,52 +8,94 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" -#include "base/single_thread_task_runner.h" -#include "base/threading/non_thread_safe.h" #include "remoting/host/desktop_environment.h" namespace remoting { // Used to create audio/video capturers and event executor that work with // the local console. -class BasicDesktopEnvironment - : public base::NonThreadSafe, - public DesktopEnvironment { +class BasicDesktopEnvironment : public DesktopEnvironment { public: virtual ~BasicDesktopEnvironment(); // DesktopEnvironment implementation. - virtual scoped_ptr<AudioCapturer> CreateAudioCapturer( - scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner) OVERRIDE; - virtual scoped_ptr<InputInjector> CreateInputInjector( - scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, - scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) OVERRIDE; - virtual scoped_ptr<SessionController> CreateSessionController() OVERRIDE; - virtual scoped_ptr<media::ScreenCapturer> CreateVideoCapturer( - scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, - scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner) OVERRIDE; + virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE; + virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE; + virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE; + virtual scoped_ptr<media::ScreenCapturer> CreateVideoCapturer() OVERRIDE; protected: friend class BasicDesktopEnvironmentFactory; - BasicDesktopEnvironment(); + BasicDesktopEnvironment( + scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, + scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, + base::WeakPtr<ClientSessionControl> client_session_control); + + scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const { + return caller_task_runner_; + } + + scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const { + return input_task_runner_; + } + + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const { + return ui_task_runner_; + } private: + // Task runner on which methods of DesktopEnvironment interface should be + // called. + scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; + + // Used to run input-related tasks. + scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; + + // Used to run UI code. + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; + DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironment); }; // Used to create |BasicDesktopEnvironment| instances. class BasicDesktopEnvironmentFactory : public DesktopEnvironmentFactory { public: - BasicDesktopEnvironmentFactory(); + BasicDesktopEnvironmentFactory( + scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, + scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); virtual ~BasicDesktopEnvironmentFactory(); // DesktopEnvironmentFactory implementation. virtual scoped_ptr<DesktopEnvironment> Create( - const std::string& client_jid, - const base::Closure& disconnect_callback) OVERRIDE; + base::WeakPtr<ClientSessionControl> client_session_control) OVERRIDE; virtual bool SupportsAudioCapture() const OVERRIDE; + protected: + scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const { + return caller_task_runner_; + } + + scoped_refptr<base::SingleThreadTaskRunner> input_task_runner() const { + return input_task_runner_; + } + + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner() const { + return ui_task_runner_; + } + private: + // Task runner on which methods of DesktopEnvironmentFactory interface should + // be called. + scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; + + // Used to run input-related tasks. + scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; + + // Used to run UI code. + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; + DISALLOW_COPY_AND_ASSIGN(BasicDesktopEnvironmentFactory); }; |