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/ice_transport.h" | 5 #include "remoting/protocol/ice_transport.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "remoting/protocol/channel_authenticator.h" | 8 #include "remoting/protocol/channel_authenticator.h" |
9 #include "remoting/protocol/channel_multiplexer.h" | 9 #include "remoting/protocol/channel_multiplexer.h" |
10 #include "remoting/protocol/pseudotcp_channel_factory.h" | 10 #include "remoting/protocol/pseudotcp_channel_factory.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 channel_multiplexer_.get(), | 96 channel_multiplexer_.get(), |
97 base::Bind(&IceTransport::OnChannelError, weak_factory_.GetWeakPtr()))); | 97 base::Bind(&IceTransport::OnChannelError, weak_factory_.GetWeakPtr()))); |
98 } | 98 } |
99 return mux_channel_factory_.get(); | 99 return mux_channel_factory_.get(); |
100 } | 100 } |
101 | 101 |
102 void IceTransport::CreateChannel(const std::string& name, | 102 void IceTransport::CreateChannel(const std::string& name, |
103 const ChannelCreatedCallback& callback) { | 103 const ChannelCreatedCallback& callback) { |
104 DCHECK(!channels_[name]); | 104 DCHECK(!channels_[name]); |
105 | 105 |
106 scoped_ptr<IceTransportChannel> channel( | 106 std::unique_ptr<IceTransportChannel> channel( |
107 new IceTransportChannel(transport_context_)); | 107 new IceTransportChannel(transport_context_)); |
108 channel->Connect(name, this, callback); | 108 channel->Connect(name, this, callback); |
109 AddPendingRemoteTransportInfo(channel.get()); | 109 AddPendingRemoteTransportInfo(channel.get()); |
110 channels_[name] = channel.release(); | 110 channels_[name] = channel.release(); |
111 } | 111 } |
112 | 112 |
113 void IceTransport::CancelChannelCreation(const std::string& name) { | 113 void IceTransport::CancelChannelCreation(const std::string& name) { |
114 ChannelsMap::iterator it = channels_.find(name); | 114 ChannelsMap::iterator it = channels_.find(name); |
115 if (it != channels_.end()) { | 115 if (it != channels_.end()) { |
116 DCHECK(!it->second->is_connected()); | 116 DCHECK(!it->second->is_connected()); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 // that we can send in one message. | 186 // that we can send in one message. |
187 transport_info_timer_.Start( | 187 transport_info_timer_.Start( |
188 FROM_HERE, base::TimeDelta::FromMilliseconds(kTransportInfoSendDelayMs), | 188 FROM_HERE, base::TimeDelta::FromMilliseconds(kTransportInfoSendDelayMs), |
189 this, &IceTransport::SendTransportInfo); | 189 this, &IceTransport::SendTransportInfo); |
190 } | 190 } |
191 } | 191 } |
192 | 192 |
193 void IceTransport::SendTransportInfo() { | 193 void IceTransport::SendTransportInfo() { |
194 DCHECK(pending_transport_info_message_); | 194 DCHECK(pending_transport_info_message_); |
195 | 195 |
196 scoped_ptr<buzz::XmlElement> transport_info_xml = | 196 std::unique_ptr<buzz::XmlElement> transport_info_xml = |
197 pending_transport_info_message_->ToXml(); | 197 pending_transport_info_message_->ToXml(); |
198 pending_transport_info_message_.reset(); | 198 pending_transport_info_message_.reset(); |
199 send_transport_info_callback_.Run(std::move(transport_info_xml)); | 199 send_transport_info_callback_.Run(std::move(transport_info_xml)); |
200 } | 200 } |
201 | 201 |
202 void IceTransport::OnChannelError(int error) { | 202 void IceTransport::OnChannelError(int error) { |
203 LOG(ERROR) << "Data channel failed, error=" << error; | 203 LOG(ERROR) << "Data channel failed, error=" << error; |
204 event_handler_->OnIceTransportError(CHANNEL_CONNECTION_ERROR); | 204 event_handler_->OnIceTransportError(CHANNEL_CONNECTION_ERROR); |
205 } | 205 } |
206 | 206 |
207 } // namespace protocol | 207 } // namespace protocol |
208 } // namespace remoting | 208 } // namespace remoting |
OLD | NEW |