Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: remoting/host/chromoting_host.h

Issue 10916161: Revert 155219 - [Chromoting] Refactoring DesktopEnvironment and moving screen/audio recorders to Cl… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | remoting/host/chromoting_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_CHROMOTING_HOST_H_ 5 #ifndef REMOTING_HOST_CHROMOTING_HOST_H_
6 #define REMOTING_HOST_CHROMOTING_HOST_H_ 6 #define REMOTING_HOST_CHROMOTING_HOST_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/observer_list.h" 12 #include "base/observer_list.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "net/base/backoff_entry.h" 14 #include "net/base/backoff_entry.h"
15 #include "remoting/codec/video_encoder.h"
15 #include "remoting/host/client_session.h" 16 #include "remoting/host/client_session.h"
17 #include "remoting/host/desktop_environment.h"
16 #include "remoting/host/host_key_pair.h" 18 #include "remoting/host/host_key_pair.h"
17 #include "remoting/host/host_status_observer.h" 19 #include "remoting/host/host_status_observer.h"
18 #include "remoting/host/mouse_move_observer.h" 20 #include "remoting/host/mouse_move_observer.h"
19 #include "remoting/host/ui_strings.h" 21 #include "remoting/host/ui_strings.h"
20 #include "remoting/protocol/authenticator.h" 22 #include "remoting/protocol/authenticator.h"
21 #include "remoting/protocol/session_manager.h" 23 #include "remoting/protocol/session_manager.h"
22 #include "remoting/protocol/connection_to_client.h" 24 #include "remoting/protocol/connection_to_client.h"
23 25
24 namespace remoting { 26 namespace remoting {
25 27
26 namespace protocol { 28 namespace protocol {
27 class InputStub; 29 class InputStub;
28 class SessionConfig; 30 class SessionConfig;
29 class CandidateSessionConfig; 31 class CandidateSessionConfig;
30 } // namespace protocol 32 } // namespace protocol
31 33
34 class AudioEncoder;
35 class AudioScheduler;
32 class ChromotingHostContext; 36 class ChromotingHostContext;
33 class DesktopEnvironmentFactory; 37 class DesktopEnvironment;
38 class Encoder;
39 class ScreenRecorder;
40 class VideoFrameCapturer;
34 41
35 // A class to implement the functionality of a host process. 42 // A class to implement the functionality of a host process.
36 // 43 //
37 // Here's the work flow of this class: 44 // Here's the work flow of this class:
38 // 1. We should load the saved GAIA ID token or if this is the first 45 // 1. We should load the saved GAIA ID token or if this is the first
39 // time the host process runs we should prompt user for the 46 // time the host process runs we should prompt user for the
40 // credential. We will use this token or credentials to authenicate 47 // credential. We will use this token or credentials to authenicate
41 // and register the host. 48 // and register the host.
42 // 49 //
43 // 2. We listen for incoming connection using libjingle. We will create 50 // 2. We listen for incoming connection using libjingle. We will create
(...skipping 11 matching lines...) Expand all
55 // all pending tasks to complete. After all of that completed we 62 // all pending tasks to complete. After all of that completed we
56 // return to the idle state. We then go to step (2) if there a new 63 // return to the idle state. We then go to step (2) if there a new
57 // incoming connection. 64 // incoming connection.
58 class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, 65 class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>,
59 public ClientSession::EventHandler, 66 public ClientSession::EventHandler,
60 public protocol::SessionManager::Listener, 67 public protocol::SessionManager::Listener,
61 public MouseMoveObserver { 68 public MouseMoveObserver {
62 public: 69 public:
63 // The caller must ensure that |context|, |signal_strategy| and 70 // The caller must ensure that |context|, |signal_strategy| and
64 // |environment| out-live the host. 71 // |environment| out-live the host.
65 ChromotingHost( 72 ChromotingHost(ChromotingHostContext* context,
66 ChromotingHostContext* context, 73 SignalStrategy* signal_strategy,
67 SignalStrategy* signal_strategy, 74 DesktopEnvironment* environment,
68 DesktopEnvironmentFactory* desktop_environment_factory, 75 scoped_ptr<protocol::SessionManager> session_manager);
69 scoped_ptr<protocol::SessionManager> session_manager);
70 76
71 // Asynchronously start the host process. 77 // Asynchronously start the host process.
72 // 78 //
73 // After this is invoked, the host process will connect to the talk 79 // After this is invoked, the host process will connect to the talk
74 // network and start listening for incoming connections. 80 // network and start listening for incoming connections.
75 // 81 //
76 // This method can only be called once during the lifetime of this object. 82 // This method can only be called once during the lifetime of this object.
77 void Start(const std::string& xmpp_login); 83 void Start(const std::string& xmpp_login);
78 84
79 // Asynchronously shutdown the host process. |shutdown_task| is 85 // Asynchronously shutdown the host process. |shutdown_task| is
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 156
151 typedef std::vector<ClientSession*> ClientList; 157 typedef std::vector<ClientSession*> ClientList;
152 158
153 enum State { 159 enum State {
154 kInitial, 160 kInitial,
155 kStarted, 161 kStarted,
156 kStopping, 162 kStopping,
157 kStopped, 163 kStopped,
158 }; 164 };
159 165
166 // Creates encoder for the specified configuration.
167 static VideoEncoder* CreateVideoEncoder(
168 const protocol::SessionConfig& config);
169
170 // Creates an audio encoder for the specified configuration.
171 static scoped_ptr<AudioEncoder> CreateAudioEncoder(
172 const protocol::SessionConfig& config);
173
160 virtual ~ChromotingHost(); 174 virtual ~ChromotingHost();
161 175
162 // Called from Shutdown() to finish shutdown. 176 void StopScreenRecorder();
177 void StopAudioScheduler();
178 void OnRecorderStopped();
179
180 // Called from Shutdown() or OnScreenRecorderStopped() to finish shutdown.
163 void ShutdownFinish(); 181 void ShutdownFinish();
164 182
165 // Unless specified otherwise all members of this class must be 183 // Unless specified otherwise all members of this class must be
166 // used on the network thread only. 184 // used on the network thread only.
167 185
168 // Parameters specified when the host was created. 186 // Parameters specified when the host was created.
169 ChromotingHostContext* context_; 187 ChromotingHostContext* context_;
170 DesktopEnvironmentFactory* desktop_environment_factory_; 188 DesktopEnvironment* desktop_environment_;
171 scoped_ptr<protocol::SessionManager> session_manager_; 189 scoped_ptr<protocol::SessionManager> session_manager_;
172 190
173 // Connection objects. 191 // Connection objects.
174 SignalStrategy* signal_strategy_; 192 SignalStrategy* signal_strategy_;
175 193
176 // Must be used on the network thread only. 194 // Must be used on the network thread only.
177 ObserverList<HostStatusObserver> status_observers_; 195 ObserverList<HostStatusObserver> status_observers_;
178 196
179 // The connections to remote clients. 197 // The connections to remote clients.
180 ClientList clients_; 198 ClientList clients_;
181 199
200 // Schedulers for audio and video capture.
201 // TODO(sergeyu): Do we need to have one set of schedulers per client?
202 scoped_refptr<ScreenRecorder> recorder_;
203 scoped_refptr<AudioScheduler> audio_scheduler_;
204
205 // Number of screen recorders and audio schedulers that are currently being
206 // stopped. Used to delay shutdown if one or more recorders/schedulers are
207 // asynchronously shutting down.
208 int stopping_recorders_;
209
182 // Tracks the internal state of the host. 210 // Tracks the internal state of the host.
183 State state_; 211 State state_;
184 212
185 // Configuration of the protocol. 213 // Configuration of the protocol.
186 scoped_ptr<protocol::CandidateSessionConfig> protocol_config_; 214 scoped_ptr<protocol::CandidateSessionConfig> protocol_config_;
187 215
188 // Login backoff state. 216 // Login backoff state.
189 net::BackoffEntry login_backoff_; 217 net::BackoffEntry login_backoff_;
190 218
191 // Flags used for RejectAuthenticatingClient(). 219 // Flags used for RejectAuthenticatingClient().
(...skipping 10 matching lines...) Expand all
202 230
203 // The maximum duration of any session. 231 // The maximum duration of any session.
204 base::TimeDelta max_session_duration_; 232 base::TimeDelta max_session_duration_;
205 233
206 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); 234 DISALLOW_COPY_AND_ASSIGN(ChromotingHost);
207 }; 235 };
208 236
209 } // namespace remoting 237 } // namespace remoting
210 238
211 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ 239 #endif // REMOTING_HOST_CHROMOTING_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/host/chromoting_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698