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

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

Issue 2431513003: Revert of Don't use barcodes in ProtocolPerfTests (Closed)
Patch Set: Created 4 years, 2 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
« 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 <list>
8 #include <memory> 9 #include <memory>
9 #include <string> 10 #include <string>
10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "base/threading/non_thread_safe.h" 17 #include "base/threading/non_thread_safe.h"
18 #include "base/threading/thread.h" 18 #include "base/threading/thread.h"
19 #include "net/base/backoff_entry.h" 19 #include "net/base/backoff_entry.h"
20 #include "remoting/host/client_session.h" 20 #include "remoting/host/client_session.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // 59 //
60 // 3. When the user is disconnected, we will pause the ScreenRecorder 60 // 3. When the user is disconnected, we will pause the ScreenRecorder
61 // and try to terminate the threads we have created. This will allow 61 // and try to terminate the threads we have created. This will allow
62 // all pending tasks to complete. After all of that completed we 62 // all pending tasks to complete. After all of that completed we
63 // 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
64 // incoming connection. 64 // incoming connection.
65 class ChromotingHost : public base::NonThreadSafe, 65 class ChromotingHost : public base::NonThreadSafe,
66 public ClientSession::EventHandler, 66 public ClientSession::EventHandler,
67 public HostStatusMonitor { 67 public HostStatusMonitor {
68 public: 68 public:
69 typedef std::vector<std::unique_ptr<ClientSession>> ClientSessions;
70
71 // |desktop_environment_factory| must outlive this object. 69 // |desktop_environment_factory| must outlive this object.
72 ChromotingHost( 70 ChromotingHost(
73 DesktopEnvironmentFactory* desktop_environment_factory, 71 DesktopEnvironmentFactory* desktop_environment_factory,
74 std::unique_ptr<protocol::SessionManager> session_manager, 72 std::unique_ptr<protocol::SessionManager> session_manager,
75 scoped_refptr<protocol::TransportContext> transport_context, 73 scoped_refptr<protocol::TransportContext> transport_context,
76 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, 74 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
77 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner); 75 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner);
78 ~ChromotingHost() override; 76 ~ChromotingHost() override;
79 77
80 // Asynchronously starts the host. 78 // Asynchronously starts the host.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // The host uses a pairing registry to generate and store pairing information 126 // The host uses a pairing registry to generate and store pairing information
129 // for clients for PIN-less authentication. 127 // for clients for PIN-less authentication.
130 scoped_refptr<protocol::PairingRegistry> pairing_registry() const { 128 scoped_refptr<protocol::PairingRegistry> pairing_registry() const {
131 return pairing_registry_; 129 return pairing_registry_;
132 } 130 }
133 void set_pairing_registry( 131 void set_pairing_registry(
134 scoped_refptr<protocol::PairingRegistry> pairing_registry) { 132 scoped_refptr<protocol::PairingRegistry> pairing_registry) {
135 pairing_registry_ = pairing_registry; 133 pairing_registry_ = pairing_registry;
136 } 134 }
137 135
138 const ClientSessions& client_sessions_for_tests() { return clients_; }
139
140 base::WeakPtr<ChromotingHost> AsWeakPtr() { 136 base::WeakPtr<ChromotingHost> AsWeakPtr() {
141 return weak_factory_.GetWeakPtr(); 137 return weak_factory_.GetWeakPtr();
142 } 138 }
143 139
144 private: 140 private:
145 friend class ChromotingHostTest; 141 friend class ChromotingHostTest;
146 142
143 typedef std::list<ClientSession*> ClientList;
147 typedef ScopedVector<HostExtension> HostExtensionList; 144 typedef ScopedVector<HostExtension> HostExtensionList;
148 145
149 // Immediately disconnects all active clients. Host-internal components may 146 // Immediately disconnects all active clients. Host-internal components may
150 // shutdown asynchronously, but the caller is guaranteed not to receive 147 // shutdown asynchronously, but the caller is guaranteed not to receive
151 // callbacks for disconnected clients after this call returns. 148 // callbacks for disconnected clients after this call returns.
152 void DisconnectAllClients(); 149 void DisconnectAllClients();
153 150
154 // Unless specified otherwise all members of this class must be 151 // Unless specified otherwise all members of this class must be
155 // used on the network thread only. 152 // used on the network thread only.
156 153
157 // Parameters specified when the host was created. 154 // Parameters specified when the host was created.
158 DesktopEnvironmentFactory* desktop_environment_factory_; 155 DesktopEnvironmentFactory* desktop_environment_factory_;
159 std::unique_ptr<protocol::SessionManager> session_manager_; 156 std::unique_ptr<protocol::SessionManager> session_manager_;
160 scoped_refptr<protocol::TransportContext> transport_context_; 157 scoped_refptr<protocol::TransportContext> transport_context_;
161 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; 158 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_;
162 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_; 159 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_;
163 160
164 // Must be used on the network thread only. 161 // Must be used on the network thread only.
165 base::ObserverList<HostStatusObserver> status_observers_; 162 base::ObserverList<HostStatusObserver> status_observers_;
166 163
167 // The connections to remote clients. 164 // The connections to remote clients.
168 ClientSessions clients_; 165 ClientList clients_;
169 166
170 // True if the host has been started. 167 // True if the host has been started.
171 bool started_; 168 bool started_;
172 169
173 // Login backoff state. 170 // Login backoff state.
174 net::BackoffEntry login_backoff_; 171 net::BackoffEntry login_backoff_;
175 172
176 // True if the curtain mode is enabled. 173 // True if the curtain mode is enabled.
177 bool enable_curtaining_; 174 bool enable_curtaining_;
178 175
179 // The maximum duration of any session. 176 // The maximum duration of any session.
180 base::TimeDelta max_session_duration_; 177 base::TimeDelta max_session_duration_;
181 178
182 // The pairing registry for PIN-less authentication. 179 // The pairing registry for PIN-less authentication.
183 scoped_refptr<protocol::PairingRegistry> pairing_registry_; 180 scoped_refptr<protocol::PairingRegistry> pairing_registry_;
184 181
185 // List of host extensions. 182 // List of host extensions.
186 HostExtensionList extensions_; 183 HostExtensionList extensions_;
187 184
188 base::WeakPtrFactory<ChromotingHost> weak_factory_; 185 base::WeakPtrFactory<ChromotingHost> weak_factory_;
189 186
190 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); 187 DISALLOW_COPY_AND_ASSIGN(ChromotingHost);
191 }; 188 };
192 189
193 } // namespace remoting 190 } // namespace remoting
194 191
195 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ 192 #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