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

Side by Side Diff: remoting/protocol/ice_connection_to_client.cc

Issue 1662673002: Add MessageChanneFactory interface and use it in ChannelDispatcherBase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@framing
Patch Set: Created 4 years, 10 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/protocol/ice_connection_to_client.h" 5 #include "remoting/protocol/ice_connection_to_client.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 case Session::AUTHENTICATED: 146 case Session::AUTHENTICATED:
147 // Initialize channels. 147 // Initialize channels.
148 control_dispatcher_->Init(transport_.GetMultiplexedChannelFactory(), 148 control_dispatcher_->Init(transport_.GetMultiplexedChannelFactory(),
149 this); 149 this);
150 150
151 event_dispatcher_->Init(transport_.GetMultiplexedChannelFactory(), this); 151 event_dispatcher_->Init(transport_.GetMultiplexedChannelFactory(), this);
152 event_dispatcher_->set_on_input_event_callback( 152 event_dispatcher_->set_on_input_event_callback(
153 base::Bind(&IceConnectionToClient::OnInputEventReceived, 153 base::Bind(&IceConnectionToClient::OnInputEventReceived,
154 base::Unretained(this))); 154 base::Unretained(this)));
155 155
156 video_dispatcher_->Init(transport_.GetStreamChannelFactory(), this); 156 video_dispatcher_->Init(transport_.GetChannelFactory(), this);
157 157
158 audio_writer_ = AudioWriter::Create(session_->config()); 158 audio_writer_ = AudioWriter::Create(session_->config());
159 if (audio_writer_) 159 if (audio_writer_)
160 audio_writer_->Init(transport_.GetMultiplexedChannelFactory(), this); 160 audio_writer_->Init(transport_.GetMultiplexedChannelFactory(), this);
161 161
162 // Notify the handler after initializing the channels, so that 162 // Notify the handler after initializing the channels, so that
163 // ClientSession can get a client clipboard stub. 163 // ClientSession can get a client clipboard stub.
164 event_handler_->OnConnectionAuthenticated(this); 164 event_handler_->OnConnectionAuthenticated(this);
165 break; 165 break;
166 166
(...skipping 19 matching lines...) Expand all
186 Disconnect(error); 186 Disconnect(error);
187 } 187 }
188 188
189 void IceConnectionToClient::OnChannelInitialized( 189 void IceConnectionToClient::OnChannelInitialized(
190 ChannelDispatcherBase* channel_dispatcher) { 190 ChannelDispatcherBase* channel_dispatcher) {
191 DCHECK(thread_checker_.CalledOnValidThread()); 191 DCHECK(thread_checker_.CalledOnValidThread());
192 192
193 NotifyIfChannelsReady(); 193 NotifyIfChannelsReady();
194 } 194 }
195 195
196 void IceConnectionToClient::OnChannelError(
197 ChannelDispatcherBase* channel_dispatcher,
198 ErrorCode error) {
199 DCHECK(thread_checker_.CalledOnValidThread());
200
201 LOG(ERROR) << "Failed to connect channel "
202 << channel_dispatcher->channel_name();
203 Disconnect(error);
204 }
205
206 void IceConnectionToClient::NotifyIfChannelsReady() { 196 void IceConnectionToClient::NotifyIfChannelsReady() {
207 DCHECK(thread_checker_.CalledOnValidThread()); 197 DCHECK(thread_checker_.CalledOnValidThread());
208 198
209 if (!control_dispatcher_ || !control_dispatcher_->is_connected()) 199 if (!control_dispatcher_ || !control_dispatcher_->is_connected())
210 return; 200 return;
211 if (!event_dispatcher_ || !event_dispatcher_->is_connected()) 201 if (!event_dispatcher_ || !event_dispatcher_->is_connected())
212 return; 202 return;
213 if (!video_dispatcher_ || !video_dispatcher_->is_connected()) 203 if (!video_dispatcher_ || !video_dispatcher_->is_connected())
214 return; 204 return;
215 if ((!audio_writer_ || !audio_writer_->is_connected()) && 205 if ((!audio_writer_ || !audio_writer_->is_connected()) &&
216 session_->config().is_audio_enabled()) { 206 session_->config().is_audio_enabled()) {
217 return; 207 return;
218 } 208 }
219 event_handler_->OnConnectionChannelsConnected(this); 209 event_handler_->OnConnectionChannelsConnected(this);
220 } 210 }
221 211
222 void IceConnectionToClient::CloseChannels() { 212 void IceConnectionToClient::CloseChannels() {
223 control_dispatcher_.reset(); 213 control_dispatcher_.reset();
224 event_dispatcher_.reset(); 214 event_dispatcher_.reset();
225 video_dispatcher_.reset(); 215 video_dispatcher_.reset();
226 audio_writer_.reset(); 216 audio_writer_.reset();
227 } 217 }
228 218
229 } // namespace protocol 219 } // namespace protocol
230 } // namespace remoting 220 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/ice_connection_to_client.h ('k') | remoting/protocol/ice_connection_to_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698