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

Side by Side Diff: remoting/client/chromoting_client.cc

Issue 1545743002: Move ownership of Transport out of Session. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass_client
Patch Set: Created 4 years, 11 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 | « remoting/client/chromoting_client.h ('k') | remoting/host/chromoting_host.h » ('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 #include "remoting/client/chromoting_client.h" 5 #include "remoting/client/chromoting_client.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "remoting/base/capabilities.h" 9 #include "remoting/base/capabilities.h"
10 #include "remoting/client/audio_decode_scheduler.h" 10 #include "remoting/client/audio_decode_scheduler.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 DCHECK(!session_manager_); // Start must be called more than once. 63 DCHECK(!session_manager_); // Start must be called more than once.
64 64
65 host_jid_ = host_jid; 65 host_jid_ = host_jid;
66 local_capabilities_ = capabilities; 66 local_capabilities_ = capabilities;
67 67
68 connection_->set_client_stub(this); 68 connection_->set_client_stub(this);
69 connection_->set_clipboard_stub(this); 69 connection_->set_clipboard_stub(this);
70 connection_->set_video_stub(video_renderer_->GetVideoStub()); 70 connection_->set_video_stub(video_renderer_->GetVideoStub());
71 connection_->set_audio_stub(audio_decode_scheduler_.get()); 71 connection_->set_audio_stub(audio_decode_scheduler_.get());
72 72
73 session_manager_.reset(new protocol::JingleSessionManager( 73 session_manager_.reset(new protocol::JingleSessionManager(signal_strategy));
74 make_scoped_ptr(new protocol::IceTransportFactory(transport_context)),
75 signal_strategy));
76 74
77 if (!protocol_config_) 75 if (!protocol_config_)
78 protocol_config_ = protocol::CandidateSessionConfig::CreateDefault(); 76 protocol_config_ = protocol::CandidateSessionConfig::CreateDefault();
79 if (!audio_decode_scheduler_) 77 if (!audio_decode_scheduler_)
80 protocol_config_->DisableAudioChannel(); 78 protocol_config_->DisableAudioChannel();
81 session_manager_->set_protocol_config(std::move(protocol_config_)); 79 session_manager_->set_protocol_config(std::move(protocol_config_));
82 80
83 authenticator_ = std::move(authenticator); 81 authenticator_ = std::move(authenticator);
82 transport_context_ = transport_context;
84 83
85 signal_strategy_ = signal_strategy; 84 signal_strategy_ = signal_strategy;
86 signal_strategy_->AddListener(this); 85 signal_strategy_->AddListener(this);
87 86
88 switch (signal_strategy_->GetState()) { 87 switch (signal_strategy_->GetState()) {
89 case SignalStrategy::CONNECTING: 88 case SignalStrategy::CONNECTING:
90 // Nothing to do here. Just need to wait until |signal_strategy_| becomes 89 // Nothing to do here. Just need to wait until |signal_strategy_| becomes
91 // connected. 90 // connected.
92 break; 91 break;
93 case SignalStrategy::CONNECTED: 92 case SignalStrategy::CONNECTED:
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 194 }
196 195
197 bool ChromotingClient::OnSignalStrategyIncomingStanza( 196 bool ChromotingClient::OnSignalStrategyIncomingStanza(
198 const buzz::XmlElement* stanza) { 197 const buzz::XmlElement* stanza) {
199 return false; 198 return false;
200 } 199 }
201 200
202 void ChromotingClient::StartConnection() { 201 void ChromotingClient::StartConnection() {
203 DCHECK(thread_checker_.CalledOnValidThread()); 202 DCHECK(thread_checker_.CalledOnValidThread());
204 connection_->Connect( 203 connection_->Connect(
205 session_manager_->Connect(host_jid_, std::move(authenticator_)), this); 204 session_manager_->Connect(host_jid_, std::move(authenticator_)),
205 transport_context_, this);
206 } 206 }
207 207
208 void ChromotingClient::OnAuthenticated() { 208 void ChromotingClient::OnAuthenticated() {
209 DCHECK(thread_checker_.CalledOnValidThread()); 209 DCHECK(thread_checker_.CalledOnValidThread());
210 210
211 // Initialize the decoder. 211 // Initialize the decoder.
212 video_renderer_->OnSessionConfig(connection_->config()); 212 video_renderer_->OnSessionConfig(connection_->config());
213 if (connection_->config().is_audio_enabled()) 213 if (connection_->config().is_audio_enabled())
214 audio_decode_scheduler_->Initialize(connection_->config()); 214 audio_decode_scheduler_->Initialize(connection_->config());
215 } 215 }
216 216
217 void ChromotingClient::OnChannelsConnected() { 217 void ChromotingClient::OnChannelsConnected() {
218 DCHECK(thread_checker_.CalledOnValidThread()); 218 DCHECK(thread_checker_.CalledOnValidThread());
219 219
220 // Negotiate capabilities with the host. 220 // Negotiate capabilities with the host.
221 VLOG(1) << "Client capabilities: " << local_capabilities_; 221 VLOG(1) << "Client capabilities: " << local_capabilities_;
222 222
223 protocol::Capabilities capabilities; 223 protocol::Capabilities capabilities;
224 capabilities.set_capabilities(local_capabilities_); 224 capabilities.set_capabilities(local_capabilities_);
225 connection_->host_stub()->SetCapabilities(capabilities); 225 connection_->host_stub()->SetCapabilities(capabilities);
226 } 226 }
227 227
228 } // namespace remoting 228 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/chromoting_client.h ('k') | remoting/host/chromoting_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698