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/desktop_session_proxy.cc | |
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/desktop_session_proxy.cc')
-rw-r--r-- | remoting/host/desktop_session_proxy.cc | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/remoting/host/desktop_session_proxy.cc b/remoting/host/desktop_session_proxy.cc index 65dac1a..05a8188 100644 --- a/remoting/host/desktop_session_proxy.cc +++ b/remoting/host/desktop_session_proxy.cc @@ -14,12 +14,12 @@ #include "media/video/capture/screen/screen_capture_data.h" #include "remoting/host/chromoting_messages.h" #include "remoting/host/client_session.h" +#include "remoting/host/client_session_control.h" #include "remoting/host/desktop_session_connector.h" #include "remoting/host/ipc_audio_capturer.h" #include "remoting/host/ipc_input_injector.h" -#include "remoting/host/ipc_session_controller.h" +#include "remoting/host/ipc_screen_controls.h" #include "remoting/host/ipc_video_frame_capturer.h" -#include "remoting/host/session_controller.h" #include "remoting/proto/audio.pb.h" #include "remoting/proto/control.pb.h" #include "remoting/proto/event.pb.h" @@ -31,49 +31,42 @@ namespace remoting { DesktopSessionProxy::DesktopSessionProxy( + scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner, scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, - const std::string& client_jid, - const base::Closure& disconnect_callback) - : caller_task_runner_(caller_task_runner), + scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, + base::WeakPtr<ClientSessionControl> client_session_control) + : audio_capture_task_runner_(audio_capture_task_runner), + caller_task_runner_(caller_task_runner), io_task_runner_(io_task_runner), - disconnect_callback_(disconnect_callback), - client_jid_(client_jid), + video_capture_task_runner_(video_capture_task_runner), + client_session_control_(client_session_control), desktop_process_(base::kNullProcessHandle), pending_capture_frame_requests_(0) { DCHECK(caller_task_runner_->BelongsToCurrentThread()); - DCHECK(!client_jid_.empty()); - DCHECK(!disconnect_callback_.is_null()); } -scoped_ptr<AudioCapturer> DesktopSessionProxy::CreateAudioCapturer( - scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner) { +scoped_ptr<AudioCapturer> DesktopSessionProxy::CreateAudioCapturer() { DCHECK(caller_task_runner_->BelongsToCurrentThread()); - DCHECK(!audio_capture_task_runner_); - audio_capture_task_runner_ = audio_task_runner; return scoped_ptr<AudioCapturer>(new IpcAudioCapturer(this)); } -scoped_ptr<InputInjector> DesktopSessionProxy::CreateInputInjector( - scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, - scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { +scoped_ptr<InputInjector> DesktopSessionProxy::CreateInputInjector() { DCHECK(caller_task_runner_->BelongsToCurrentThread()); return scoped_ptr<InputInjector>(new IpcInputInjector(this)); } -scoped_ptr<SessionController> DesktopSessionProxy::CreateSessionController() { - return scoped_ptr<SessionController>(new IpcSessionController(this)); +scoped_ptr<ScreenControls> DesktopSessionProxy::CreateScreenControls() { + DCHECK(caller_task_runner_->BelongsToCurrentThread()); + + return scoped_ptr<ScreenControls>(new IpcScreenControls(this)); } -scoped_ptr<media::ScreenCapturer> DesktopSessionProxy::CreateVideoCapturer( - scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, - scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner) { +scoped_ptr<media::ScreenCapturer> DesktopSessionProxy::CreateVideoCapturer() { DCHECK(caller_task_runner_->BelongsToCurrentThread()); - DCHECK(!video_capture_task_runner_.get()); - video_capture_task_runner_ = capture_task_runner; return scoped_ptr<media::ScreenCapturer>(new IpcVideoFrameCapturer(this)); } @@ -118,10 +111,16 @@ bool DesktopSessionProxy::AttachToDesktop( base::ProcessHandle desktop_process, IPC::PlatformFileForTransit desktop_pipe) { DCHECK(caller_task_runner_->BelongsToCurrentThread()); - DCHECK(!client_jid_.empty()); DCHECK(!desktop_channel_); DCHECK_EQ(desktop_process_, base::kNullProcessHandle); + // Ignore the attach notification if the client session has been disconnected + // already. + if (!client_session_control_) { + base::CloseProcessHandle(desktop_process); + return false; + } + desktop_process_ = desktop_process; #if defined(OS_WIN) @@ -132,6 +131,9 @@ bool DesktopSessionProxy::AttachToDesktop( pipe.Receive(), 0, FALSE, DUPLICATE_SAME_ACCESS)) { LOG_GETLASTERROR(ERROR) << "Failed to duplicate the desktop-to-network" " pipe handle"; + + desktop_process_ = base::kNullProcessHandle; + base::CloseProcessHandle(desktop_process); return false; } @@ -156,7 +158,7 @@ bool DesktopSessionProxy::AttachToDesktop( // Pass ID of the client (which is authenticated at this point) to the desktop // session agent and start the agent. SendToDesktop(new ChromotingNetworkDesktopMsg_StartSessionAgent( - client_jid_, screen_resolution_)); + client_session_control_->client_jid(), screen_resolution_)); return true; } @@ -231,7 +233,8 @@ void DesktopSessionProxy::DisconnectSession() { DCHECK(caller_task_runner_->BelongsToCurrentThread()); // Disconnect the client session if it hasn't been disconnected yet. - disconnect_callback_.Run(); + if (client_session_control_) + client_session_control_->DisconnectSession(); } void DesktopSessionProxy::InjectClipboardEvent( |