| 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 #include "remoting/host/chromoting_host.h" | 5 #include "remoting/host/chromoting_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 *response = protocol::SessionManager::ACCEPT; | 260 *response = protocol::SessionManager::ACCEPT; |
| 261 | 261 |
| 262 HOST_LOG << "Client connected: " << session->jid(); | 262 HOST_LOG << "Client connected: " << session->jid(); |
| 263 | 263 |
| 264 // Create either IceConnectionToClient or WebrtcConnectionToClient. | 264 // Create either IceConnectionToClient or WebrtcConnectionToClient. |
| 265 // TODO(sergeyu): Move this logic to the protocol layer. | 265 // TODO(sergeyu): Move this logic to the protocol layer. |
| 266 scoped_ptr<protocol::ConnectionToClient> connection; | 266 scoped_ptr<protocol::ConnectionToClient> connection; |
| 267 if (session->config().protocol() == | 267 if (session->config().protocol() == |
| 268 protocol::SessionConfig::Protocol::WEBRTC) { | 268 protocol::SessionConfig::Protocol::WEBRTC) { |
| 269 connection.reset(new protocol::WebrtcConnectionToClient( | 269 connection.reset(new protocol::WebrtcConnectionToClient( |
| 270 make_scoped_ptr(session), transport_context_)); | 270 make_scoped_ptr(session), transport_context_, |
| 271 video_encode_task_runner_)); |
| 271 } else { | 272 } else { |
| 272 connection.reset(new protocol::IceConnectionToClient( | 273 connection.reset(new protocol::IceConnectionToClient( |
| 273 make_scoped_ptr(session), transport_context_, | 274 make_scoped_ptr(session), transport_context_, |
| 274 video_encode_task_runner_)); | 275 video_encode_task_runner_)); |
| 275 } | 276 } |
| 276 | 277 |
| 277 // Create a ClientSession object. | 278 // Create a ClientSession object. |
| 278 ClientSession* client = | 279 ClientSession* client = |
| 279 new ClientSession(this, audio_task_runner_, std::move(connection), | 280 new ClientSession(this, audio_task_runner_, std::move(connection), |
| 280 desktop_environment_factory_, max_session_duration_, | 281 desktop_environment_factory_, max_session_duration_, |
| 281 pairing_registry_, extensions_.get()); | 282 pairing_registry_, extensions_.get()); |
| 282 | 283 |
| 283 clients_.push_back(client); | 284 clients_.push_back(client); |
| 284 } | 285 } |
| 285 | 286 |
| 286 void ChromotingHost::DisconnectAllClients() { | 287 void ChromotingHost::DisconnectAllClients() { |
| 287 DCHECK(CalledOnValidThread()); | 288 DCHECK(CalledOnValidThread()); |
| 288 | 289 |
| 289 while (!clients_.empty()) { | 290 while (!clients_.empty()) { |
| 290 size_t size = clients_.size(); | 291 size_t size = clients_.size(); |
| 291 clients_.front()->DisconnectSession(protocol::OK); | 292 clients_.front()->DisconnectSession(protocol::OK); |
| 292 CHECK_EQ(clients_.size(), size - 1); | 293 CHECK_EQ(clients_.size(), size - 1); |
| 293 } | 294 } |
| 294 } | 295 } |
| 295 | 296 |
| 296 } // namespace remoting | 297 } // namespace remoting |
| OLD | NEW |