OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 } | 110 } |
111 | 111 |
112 rtc::scoped_refptr<DataChannel> DataChannel::Create( | 112 rtc::scoped_refptr<DataChannel> DataChannel::Create( |
113 DataChannelProviderInterface* provider, | 113 DataChannelProviderInterface* provider, |
114 cricket::DataChannelType dct, | 114 cricket::DataChannelType dct, |
115 const std::string& label, | 115 const std::string& label, |
116 const InternalDataChannelInit& config) { | 116 const InternalDataChannelInit& config) { |
117 rtc::scoped_refptr<DataChannel> channel( | 117 rtc::scoped_refptr<DataChannel> channel( |
118 new rtc::RefCountedObject<DataChannel>(provider, dct, label)); | 118 new rtc::RefCountedObject<DataChannel>(provider, dct, label)); |
119 if (!channel->Init(config)) { | 119 if (!channel->Init(config)) { |
120 return NULL; | 120 return nullptr; |
121 } | 121 } |
122 return channel; | 122 return channel; |
123 } | 123 } |
124 | 124 |
125 DataChannel::DataChannel( | 125 DataChannel::DataChannel( |
126 DataChannelProviderInterface* provider, | 126 DataChannelProviderInterface* provider, |
127 cricket::DataChannelType dct, | 127 cricket::DataChannelType dct, |
128 const std::string& label) | 128 const std::string& label) |
129 : label_(label), | 129 : label_(label), |
130 observer_(nullptr), | 130 observer_(nullptr), |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // Try to connect to the transport in case the transport channel already | 185 // Try to connect to the transport in case the transport channel already |
186 // exists. | 186 // exists. |
187 OnTransportChannelCreated(); | 187 OnTransportChannelCreated(); |
188 | 188 |
189 // Checks if the transport is ready to send because the initial channel | 189 // Checks if the transport is ready to send because the initial channel |
190 // ready signal may have been sent before the DataChannel creation. | 190 // ready signal may have been sent before the DataChannel creation. |
191 // This has to be done async because the upper layer objects (e.g. | 191 // This has to be done async because the upper layer objects (e.g. |
192 // Chrome glue and WebKit) are not wired up properly until after this | 192 // Chrome glue and WebKit) are not wired up properly until after this |
193 // function returns. | 193 // function returns. |
194 if (provider_->ReadyToSendData()) { | 194 if (provider_->ReadyToSendData()) { |
195 rtc::Thread::Current()->Post(RTC_FROM_HERE, this, MSG_CHANNELREADY, NULL); | 195 rtc::Thread::Current()->Post(RTC_FROM_HERE, this, MSG_CHANNELREADY, |
| 196 nullptr); |
196 } | 197 } |
197 } | 198 } |
198 | 199 |
199 return true; | 200 return true; |
200 } | 201 } |
201 | 202 |
202 DataChannel::~DataChannel() {} | 203 DataChannel::~DataChannel() {} |
203 | 204 |
204 void DataChannel::RegisterObserver(DataChannelObserver* observer) { | 205 void DataChannel::RegisterObserver(DataChannelObserver* observer) { |
205 observer_ = observer; | 206 observer_ = observer; |
206 DeliverQueuedReceivedData(); | 207 DeliverQueuedReceivedData(); |
207 } | 208 } |
208 | 209 |
209 void DataChannel::UnregisterObserver() { | 210 void DataChannel::UnregisterObserver() { |
210 observer_ = NULL; | 211 observer_ = nullptr; |
211 } | 212 } |
212 | 213 |
213 bool DataChannel::reliable() const { | 214 bool DataChannel::reliable() const { |
214 if (data_channel_type_ == cricket::DCT_RTP) { | 215 if (data_channel_type_ == cricket::DCT_RTP) { |
215 return false; | 216 return false; |
216 } else { | 217 } else { |
217 return config_.maxRetransmits == -1 && | 218 return config_.maxRetransmits == -1 && |
218 config_.maxRetransmitTime == -1; | 219 config_.maxRetransmitTime == -1; |
219 } | 220 } |
220 } | 221 } |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 QueueControlMessage(buffer); | 644 QueueControlMessage(buffer); |
644 } else { | 645 } else { |
645 LOG(LS_ERROR) << "Closing the DataChannel due to a failure to send" | 646 LOG(LS_ERROR) << "Closing the DataChannel due to a failure to send" |
646 << " the CONTROL message, send_result = " << send_result; | 647 << " the CONTROL message, send_result = " << send_result; |
647 Close(); | 648 Close(); |
648 } | 649 } |
649 return retval; | 650 return retval; |
650 } | 651 } |
651 | 652 |
652 } // namespace webrtc | 653 } // namespace webrtc |
OLD | NEW |