| OLD | NEW |
| 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/webrtc_connection_to_client.h" | 5 #include "remoting/protocol/webrtc_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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 control_dispatcher_.reset(); | 148 control_dispatcher_.reset(); |
| 149 event_dispatcher_.reset(); | 149 event_dispatcher_.reset(); |
| 150 transport_->Close(state == Session::CLOSED ? OK : session_->error()); | 150 transport_->Close(state == Session::CLOSED ? OK : session_->error()); |
| 151 event_handler_->OnConnectionClosed( | 151 event_handler_->OnConnectionClosed( |
| 152 this, state == Session::CLOSED ? OK : session_->error()); | 152 this, state == Session::CLOSED ? OK : session_->error()); |
| 153 break; | 153 break; |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 | 156 |
| 157 void WebrtcConnectionToClient::OnWebrtcTransportConnecting() { | 157 void WebrtcConnectionToClient::OnWebrtcTransportConnecting() { |
| 158 // Create outgoing control channel by initializing |control_dispatcher_|. | 158 // Create outgoing control channel. |event_dispatcher_| is initialized later |
| 159 // |event_dispatcher_| is initialized later because event channel is expected | 159 // because event channel is expected to be created by the client. |
| 160 // to be created by the client. | 160 control_dispatcher_->Init( |
| 161 control_dispatcher_->Init(transport_->outgoing_channel_factory(), this); | 161 transport_->CreateOutgoingChannel(control_dispatcher_->channel_name()), |
| 162 this); |
| 162 } | 163 } |
| 163 | 164 |
| 164 void WebrtcConnectionToClient::OnWebrtcTransportConnected() { | 165 void WebrtcConnectionToClient::OnWebrtcTransportConnected() { |
| 165 DCHECK(thread_checker_.CalledOnValidThread()); | 166 DCHECK(thread_checker_.CalledOnValidThread()); |
| 166 } | 167 } |
| 167 | 168 |
| 168 void WebrtcConnectionToClient::OnWebrtcTransportError(ErrorCode error) { | 169 void WebrtcConnectionToClient::OnWebrtcTransportError(ErrorCode error) { |
| 169 DCHECK(thread_checker_.CalledOnValidThread()); | 170 DCHECK(thread_checker_.CalledOnValidThread()); |
| 170 Disconnect(error); | 171 Disconnect(error); |
| 171 } | 172 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 ChannelDispatcherBase* channel_dispatcher) { | 204 ChannelDispatcherBase* channel_dispatcher) { |
| 204 DCHECK(thread_checker_.CalledOnValidThread()); | 205 DCHECK(thread_checker_.CalledOnValidThread()); |
| 205 | 206 |
| 206 LOG(ERROR) << "Channel " << channel_dispatcher->channel_name() | 207 LOG(ERROR) << "Channel " << channel_dispatcher->channel_name() |
| 207 << " was closed unexpectedly."; | 208 << " was closed unexpectedly."; |
| 208 Disconnect(INCOMPATIBLE_PROTOCOL); | 209 Disconnect(INCOMPATIBLE_PROTOCOL); |
| 209 } | 210 } |
| 210 | 211 |
| 211 } // namespace protocol | 212 } // namespace protocol |
| 212 } // namespace remoting | 213 } // namespace remoting |
| OLD | NEW |