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

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

Issue 1545723002: Use std::move() instead of .Pass() in remoting/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass_host
Patch Set: Created 4 years, 12 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/client/jni/chromoting_jni_instance.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 #include "remoting/client/chromoting_client.h" 5 #include "remoting/client/chromoting_client.h"
6 6
7 #include <utility>
8
7 #include "remoting/base/capabilities.h" 9 #include "remoting/base/capabilities.h"
8 #include "remoting/client/audio_decode_scheduler.h" 10 #include "remoting/client/audio_decode_scheduler.h"
9 #include "remoting/client/audio_player.h" 11 #include "remoting/client/audio_player.h"
10 #include "remoting/client/client_context.h" 12 #include "remoting/client/client_context.h"
11 #include "remoting/client/client_user_interface.h" 13 #include "remoting/client/client_user_interface.h"
12 #include "remoting/client/video_renderer.h" 14 #include "remoting/client/video_renderer.h"
13 #include "remoting/protocol/authenticator.h" 15 #include "remoting/protocol/authenticator.h"
14 #include "remoting/protocol/connection_to_host.h" 16 #include "remoting/protocol/connection_to_host.h"
15 #include "remoting/protocol/host_stub.h" 17 #include "remoting/protocol/host_stub.h"
16 #include "remoting/protocol/ice_connection_to_host.h" 18 #include "remoting/protocol/ice_connection_to_host.h"
17 #include "remoting/protocol/ice_transport.h" 19 #include "remoting/protocol/ice_transport.h"
18 #include "remoting/protocol/jingle_session_manager.h" 20 #include "remoting/protocol/jingle_session_manager.h"
19 #include "remoting/protocol/session_config.h" 21 #include "remoting/protocol/session_config.h"
20 #include "remoting/protocol/transport_context.h" 22 #include "remoting/protocol/transport_context.h"
21 23
22 namespace remoting { 24 namespace remoting {
23 25
24 ChromotingClient::ChromotingClient(ClientContext* client_context, 26 ChromotingClient::ChromotingClient(ClientContext* client_context,
25 ClientUserInterface* user_interface, 27 ClientUserInterface* user_interface,
26 VideoRenderer* video_renderer, 28 VideoRenderer* video_renderer,
27 scoped_ptr<AudioPlayer> audio_player) 29 scoped_ptr<AudioPlayer> audio_player)
28 : user_interface_(user_interface), 30 : user_interface_(user_interface),
29 video_renderer_(video_renderer), 31 video_renderer_(video_renderer),
30 connection_(new protocol::IceConnectionToHost()) { 32 connection_(new protocol::IceConnectionToHost()) {
31 DCHECK(client_context->main_task_runner()->BelongsToCurrentThread()); 33 DCHECK(client_context->main_task_runner()->BelongsToCurrentThread());
32 if (audio_player) { 34 if (audio_player) {
33 audio_decode_scheduler_.reset(new AudioDecodeScheduler( 35 audio_decode_scheduler_.reset(new AudioDecodeScheduler(
34 client_context->main_task_runner(), 36 client_context->main_task_runner(),
35 client_context->audio_decode_task_runner(), audio_player.Pass())); 37 client_context->audio_decode_task_runner(), std::move(audio_player)));
36 } 38 }
37 } 39 }
38 40
39 ChromotingClient::~ChromotingClient() { 41 ChromotingClient::~ChromotingClient() {
40 if (signal_strategy_) 42 if (signal_strategy_)
41 signal_strategy_->RemoveListener(this); 43 signal_strategy_->RemoveListener(this);
42 } 44 }
43 45
46 void ChromotingClient::set_protocol_config(
47 scoped_ptr<protocol::CandidateSessionConfig> config) {
48 protocol_config_ = std::move(config);
49 }
50
44 void ChromotingClient::SetConnectionToHostForTests( 51 void ChromotingClient::SetConnectionToHostForTests(
45 scoped_ptr<protocol::ConnectionToHost> connection_to_host) { 52 scoped_ptr<protocol::ConnectionToHost> connection_to_host) {
46 connection_ = connection_to_host.Pass(); 53 connection_ = std::move(connection_to_host);
47 } 54 }
48 55
49 void ChromotingClient::Start( 56 void ChromotingClient::Start(
50 SignalStrategy* signal_strategy, 57 SignalStrategy* signal_strategy,
51 scoped_ptr<protocol::Authenticator> authenticator, 58 scoped_ptr<protocol::Authenticator> authenticator,
52 scoped_refptr<protocol::TransportContext> transport_context, 59 scoped_refptr<protocol::TransportContext> transport_context,
53 const std::string& host_jid, 60 const std::string& host_jid,
54 const std::string& capabilities) { 61 const std::string& capabilities) {
55 DCHECK(thread_checker_.CalledOnValidThread()); 62 DCHECK(thread_checker_.CalledOnValidThread());
56 DCHECK(!session_manager_); // Start must be called more than once. 63 DCHECK(!session_manager_); // Start must be called more than once.
57 64
58 host_jid_ = host_jid; 65 host_jid_ = host_jid;
59 local_capabilities_ = capabilities; 66 local_capabilities_ = capabilities;
60 67
61 connection_->set_client_stub(this); 68 connection_->set_client_stub(this);
62 connection_->set_clipboard_stub(this); 69 connection_->set_clipboard_stub(this);
63 connection_->set_video_stub(video_renderer_->GetVideoStub()); 70 connection_->set_video_stub(video_renderer_->GetVideoStub());
64 connection_->set_audio_stub(audio_decode_scheduler_.get()); 71 connection_->set_audio_stub(audio_decode_scheduler_.get());
65 72
66 session_manager_.reset(new protocol::JingleSessionManager( 73 session_manager_.reset(new protocol::JingleSessionManager(
67 make_scoped_ptr(new protocol::IceTransportFactory(transport_context)), 74 make_scoped_ptr(new protocol::IceTransportFactory(transport_context)),
68 signal_strategy)); 75 signal_strategy));
69 76
70 if (!protocol_config_) 77 if (!protocol_config_)
71 protocol_config_ = protocol::CandidateSessionConfig::CreateDefault(); 78 protocol_config_ = protocol::CandidateSessionConfig::CreateDefault();
72 if (!audio_decode_scheduler_) 79 if (!audio_decode_scheduler_)
73 protocol_config_->DisableAudioChannel(); 80 protocol_config_->DisableAudioChannel();
74 session_manager_->set_protocol_config(protocol_config_.Pass()); 81 session_manager_->set_protocol_config(std::move(protocol_config_));
75 82
76 authenticator_ = authenticator.Pass(); 83 authenticator_ = std::move(authenticator);
77 84
78 signal_strategy_ = signal_strategy; 85 signal_strategy_ = signal_strategy;
79 signal_strategy_->AddListener(this); 86 signal_strategy_->AddListener(this);
80 87
81 switch (signal_strategy_->GetState()) { 88 switch (signal_strategy_->GetState()) {
82 case SignalStrategy::CONNECTING: 89 case SignalStrategy::CONNECTING:
83 // Nothing to do here. Just need to wait until |signal_strategy_| becomes 90 // Nothing to do here. Just need to wait until |signal_strategy_| becomes
84 // connected. 91 // connected.
85 break; 92 break;
86 case SignalStrategy::CONNECTED: 93 case SignalStrategy::CONNECTED:
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 195 }
189 196
190 bool ChromotingClient::OnSignalStrategyIncomingStanza( 197 bool ChromotingClient::OnSignalStrategyIncomingStanza(
191 const buzz::XmlElement* stanza) { 198 const buzz::XmlElement* stanza) {
192 return false; 199 return false;
193 } 200 }
194 201
195 void ChromotingClient::StartConnection() { 202 void ChromotingClient::StartConnection() {
196 DCHECK(thread_checker_.CalledOnValidThread()); 203 DCHECK(thread_checker_.CalledOnValidThread());
197 connection_->Connect( 204 connection_->Connect(
198 session_manager_->Connect(host_jid_, authenticator_.Pass()), this); 205 session_manager_->Connect(host_jid_, std::move(authenticator_)), this);
199 } 206 }
200 207
201 void ChromotingClient::OnAuthenticated() { 208 void ChromotingClient::OnAuthenticated() {
202 DCHECK(thread_checker_.CalledOnValidThread()); 209 DCHECK(thread_checker_.CalledOnValidThread());
203 210
204 // Initialize the decoder. 211 // Initialize the decoder.
205 video_renderer_->OnSessionConfig(connection_->config()); 212 video_renderer_->OnSessionConfig(connection_->config());
206 if (connection_->config().is_audio_enabled()) 213 if (connection_->config().is_audio_enabled())
207 audio_decode_scheduler_->Initialize(connection_->config()); 214 audio_decode_scheduler_->Initialize(connection_->config());
208 } 215 }
209 216
210 void ChromotingClient::OnChannelsConnected() { 217 void ChromotingClient::OnChannelsConnected() {
211 DCHECK(thread_checker_.CalledOnValidThread()); 218 DCHECK(thread_checker_.CalledOnValidThread());
212 219
213 // Negotiate capabilities with the host. 220 // Negotiate capabilities with the host.
214 VLOG(1) << "Client capabilities: " << local_capabilities_; 221 VLOG(1) << "Client capabilities: " << local_capabilities_;
215 222
216 protocol::Capabilities capabilities; 223 protocol::Capabilities capabilities;
217 capabilities.set_capabilities(local_capabilities_); 224 capabilities.set_capabilities(local_capabilities_);
218 connection_->host_stub()->SetCapabilities(capabilities); 225 connection_->host_stub()->SetCapabilities(capabilities);
219 } 226 }
220 227
221 } // namespace remoting 228 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/chromoting_client.h ('k') | remoting/client/jni/chromoting_jni_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698