| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_HOST_CLIENT_SESSION_H_ | 5 #ifndef REMOTING_HOST_CLIENT_SESSION_H_ |
| 6 #define REMOTING_HOST_CLIENT_SESSION_H_ | 6 #define REMOTING_HOST_CLIENT_SESSION_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 virtual void OnClientDimensionsChanged(ClientSession* client, | 82 virtual void OnClientDimensionsChanged(ClientSession* client, |
| 83 const SkISize& size) = 0; | 83 const SkISize& size) = 0; |
| 84 | 84 |
| 85 protected: | 85 protected: |
| 86 virtual ~EventHandler() {} | 86 virtual ~EventHandler() {} |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 // |event_handler| must outlive |this|. |desktop_environment_factory| is only | 89 // |event_handler| must outlive |this|. |desktop_environment_factory| is only |
| 90 // used by the constructor to create an instance of DesktopEnvironment. | 90 // used by the constructor to create an instance of DesktopEnvironment. |
| 91 ClientSession(EventHandler* event_handler, | 91 ClientSession(EventHandler* event_handler, |
| 92 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, |
| 92 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, | 93 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, |
| 93 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner, | 94 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner, |
| 94 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, | 95 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
| 95 scoped_ptr<protocol::ConnectionToClient> connection, | 96 scoped_ptr<protocol::ConnectionToClient> connection, |
| 96 DesktopEnvironmentFactory* desktop_environment_factory, | 97 DesktopEnvironmentFactory* desktop_environment_factory, |
| 97 const base::TimeDelta& max_duration); | 98 const base::TimeDelta& max_duration); |
| 98 | 99 |
| 99 // protocol::HostStub interface. | 100 // protocol::HostStub interface. |
| 100 virtual void NotifyClientDimensions( | 101 virtual void NotifyClientDimensions( |
| 101 const protocol::ClientDimensions& dimensions) OVERRIDE; | 102 const protocol::ClientDimensions& dimensions) OVERRIDE; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 base::WeakPtrFactory<protocol::ClipboardStub> client_clipboard_factory_; | 210 base::WeakPtrFactory<protocol::ClipboardStub> client_clipboard_factory_; |
| 210 | 211 |
| 211 // The maximum duration of this session. | 212 // The maximum duration of this session. |
| 212 // There is no maximum if this value is <= 0. | 213 // There is no maximum if this value is <= 0. |
| 213 base::TimeDelta max_duration_; | 214 base::TimeDelta max_duration_; |
| 214 | 215 |
| 215 // A timer that triggers a disconnect when the maximum session duration | 216 // A timer that triggers a disconnect when the maximum session duration |
| 216 // is reached. | 217 // is reached. |
| 217 base::OneShotTimer<ClientSession> max_duration_timer_; | 218 base::OneShotTimer<ClientSession> max_duration_timer_; |
| 218 | 219 |
| 220 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; |
| 219 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_; | 221 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_; |
| 220 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_; | 222 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_; |
| 221 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 223 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
| 222 | 224 |
| 223 // Schedulers for audio and video capture. | 225 // Schedulers for audio and video capture. |
| 224 scoped_refptr<AudioScheduler> audio_scheduler_; | 226 scoped_refptr<AudioScheduler> audio_scheduler_; |
| 225 scoped_refptr<VideoScheduler> video_scheduler_; | 227 scoped_refptr<VideoScheduler> video_scheduler_; |
| 226 | 228 |
| 227 // Number of screen recorders and audio schedulers that are currently being | 229 // Number of screen recorders and audio schedulers that are currently being |
| 228 // used or shutdown. Used to delay shutdown if one or more | 230 // used or shutdown. Used to delay shutdown if one or more |
| 229 // recorders/schedulers are asynchronously shutting down. | 231 // recorders/schedulers are asynchronously shutting down. |
| 230 int active_recorders_; | 232 int active_recorders_; |
| 231 | 233 |
| 232 // The task to be executed when the session is completely stopped. | 234 // The task to be executed when the session is completely stopped. |
| 233 base::Closure done_task_; | 235 base::Closure done_task_; |
| 234 | 236 |
| 235 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 237 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
| 236 }; | 238 }; |
| 237 | 239 |
| 238 // Destroys |ClienSession| instances on the network thread. | 240 // Destroys |ClienSession| instances on the network thread. |
| 239 struct ClientSessionTraits { | 241 struct ClientSessionTraits { |
| 240 static void Destruct(const ClientSession* client); | 242 static void Destruct(const ClientSession* client); |
| 241 }; | 243 }; |
| 242 | 244 |
| 243 } // namespace remoting | 245 } // namespace remoting |
| 244 | 246 |
| 245 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 247 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
| OLD | NEW |