Index: remoting/host/client_session.h |
diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h |
index 0dd65d4855ae57279622ea5d3f62011b8dab504b..0ec990d1dea70efc5d47f3400a381a5234754ee0 100644 |
--- a/remoting/host/client_session.h |
+++ b/remoting/host/client_session.h |
@@ -22,8 +22,17 @@ |
#include "remoting/protocol/mouse_input_filter.h" |
#include "third_party/skia/include/core/SkPoint.h" |
+namespace base { |
+class SingleThreadTaskRunner; |
+} // namespace base |
+ |
namespace remoting { |
+class AudioEncoder; |
+class AudioScheduler; |
+class DesktopEnvironment; |
+class Encoder; |
+class ScreenRecorder; |
class VideoFrameCapturer; |
// A ClientSession keeps a reference to a connection to a client, and maintains |
@@ -67,12 +76,12 @@ class ClientSession : public protocol::HostStub, |
}; |
ClientSession(EventHandler* event_handler, |
+ scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, |
+ scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner, |
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
scoped_ptr<protocol::ConnectionToClient> connection, |
- protocol::ClipboardStub* host_clipboard_stub, |
- protocol::InputStub* host_input_stub, |
- VideoFrameCapturer* capturer, |
+ scoped_ptr<DesktopEnvironment> desktop_environment, |
const base::TimeDelta& max_duration); |
- virtual ~ClientSession(); |
// protocol::InputStub interface. |
virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; |
@@ -104,10 +113,18 @@ class ClientSession : public protocol::HostStub, |
// this method returns. |
void Disconnect(); |
+ // Stop all recorders asynchronously and deletes |this| once they are stopped. |
+ // StopAndDelete() is the only way to destoy a |ClientSession| instance. |
+ void StopAndDelete(); |
+ |
protocol::ConnectionToClient* connection() const { |
return connection_.get(); |
} |
+ DesktopEnvironment* desktop_environment() const { |
+ return desktop_environment_.get(); |
+ } |
+ |
const std::string& client_jid() { return client_jid_; } |
bool is_authenticated() { return is_authenticated_; } |
@@ -121,15 +138,29 @@ class ClientSession : public protocol::HostStub, |
// keys or mouse buttons pressed then these will be released. |
void SetDisableInputs(bool disable_inputs); |
+ private: |
+ virtual ~ClientSession(); |
+ |
// Creates a proxy for sending clipboard events to the client. |
scoped_ptr<protocol::ClipboardStub> CreateClipboardProxy(); |
- private: |
+ void OnRecorderStopped(); |
+ |
+ // Creates encoder for the specified configuration. |
+ static Encoder* CreateEncoder(const protocol::SessionConfig& config); |
+ |
+ // Creates an audio encoder for the specified configuration. |
+ static scoped_ptr<AudioEncoder> CreateAudioEncoder( |
+ const protocol::SessionConfig& config); |
+ |
EventHandler* event_handler_; |
// The connection to the client. |
scoped_ptr<protocol::ConnectionToClient> connection_; |
+ // The desktop environment used by this session. |
+ scoped_ptr<DesktopEnvironment> desktop_environment_; |
+ |
std::string client_jid_; |
bool is_authenticated_; |
@@ -179,6 +210,19 @@ class ClientSession : public protocol::HostStub, |
// is reached. |
base::OneShotTimer<ClientSession> max_duration_timer_; |
+ scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_; |
+ scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_; |
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
+ |
+ // Schedulers for audio and video capture. |
+ scoped_refptr<AudioScheduler> audio_scheduler_; |
+ scoped_refptr<ScreenRecorder> video_recorder_; |
+ |
+ // Number of screen recorders and audio schedulers that are currently being |
+ // used or shutdown. Used to delay shutdown if one or more |
+ // recorders/schedulers are asynchronously shutting down. |
+ int active_recorders_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ClientSession); |
}; |