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

Side by Side Diff: webrtc/p2p/base/transportcontroller.cc

Issue 2614263002: Remove BaseChannel's dependency on TransportController. (Closed)
Patch Set: Fix the channel_unittests Created 3 years, 11 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 /* 1 /*
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2015 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 rtc::Bind(&TransportController::GetStats_n, this, transport_name, stats)); 220 rtc::Bind(&TransportController::GetStats_n, this, transport_name, stats));
221 } 221 }
222 222
223 void TransportController::SetMetricsObserver( 223 void TransportController::SetMetricsObserver(
224 webrtc::MetricsObserverInterface* metrics_observer) { 224 webrtc::MetricsObserverInterface* metrics_observer) {
225 return network_thread_->Invoke<void>( 225 return network_thread_->Invoke<void>(
226 RTC_FROM_HERE, rtc::Bind(&TransportController::SetMetricsObserver_n, this, 226 RTC_FROM_HERE, rtc::Bind(&TransportController::SetMetricsObserver_n, this,
227 metrics_observer)); 227 metrics_observer));
228 } 228 }
229 229
230 TransportChannel* TransportController::CreateTransportChannel(
231 const std::string& transport_name,
232 int component) {
233 return network_thread_->Invoke<TransportChannel*>(
234 RTC_FROM_HERE, rtc::Bind(&TransportController::CreateTransportChannel_n,
235 this, transport_name, component));
236 }
237
230 TransportChannel* TransportController::CreateTransportChannel_n( 238 TransportChannel* TransportController::CreateTransportChannel_n(
231 const std::string& transport_name, 239 const std::string& transport_name,
232 int component) { 240 int component) {
233 RTC_DCHECK(network_thread_->IsCurrent()); 241 RTC_DCHECK(network_thread_->IsCurrent());
234 242
235 RefCountedChannel* existing_channel = GetChannel_n(transport_name, component); 243 RefCountedChannel* existing_channel = GetChannel_n(transport_name, component);
236 if (existing_channel) { 244 if (existing_channel) {
237 // Channel already exists; increment reference count and return. 245 // Channel already exists; increment reference count and return.
238 existing_channel->AddRef(); 246 existing_channel->AddRef();
239 return existing_channel->dtls(); 247 return existing_channel->dtls();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 RefCountedChannel* new_pair = new RefCountedChannel(dtls, ice); 289 RefCountedChannel* new_pair = new RefCountedChannel(dtls, ice);
282 new_pair->AddRef(); 290 new_pair->AddRef();
283 channels_.insert(channels_.end(), new_pair); 291 channels_.insert(channels_.end(), new_pair);
284 bool channel_added = transport->AddChannel(dtls, component); 292 bool channel_added = transport->AddChannel(dtls, component);
285 RTC_DCHECK(channel_added); 293 RTC_DCHECK(channel_added);
286 // Adding a channel could cause aggregate state to change. 294 // Adding a channel could cause aggregate state to change.
287 UpdateAggregateStates_n(); 295 UpdateAggregateStates_n();
288 return dtls; 296 return dtls;
289 } 297 }
290 298
299 void TransportController::DestroyTransportChannel(
300 const std::string& transport_name,
301 int component) {
302 network_thread_->Invoke<void>(
303 RTC_FROM_HERE, rtc::Bind(&TransportController::DestroyTransportChannel_n,
304 this, transport_name, component));
305 }
306
291 void TransportController::DestroyTransportChannel_n( 307 void TransportController::DestroyTransportChannel_n(
292 const std::string& transport_name, 308 const std::string& transport_name,
293 int component) { 309 int component) {
294 RTC_DCHECK(network_thread_->IsCurrent()); 310 RTC_DCHECK(network_thread_->IsCurrent());
295 311
296 auto it = GetChannelIterator_n(transport_name, component); 312 auto it = GetChannelIterator_n(transport_name, component);
297 if (it == channels_.end()) { 313 if (it == channels_.end()) {
298 LOG(LS_WARNING) << "Attempting to delete " << transport_name 314 LOG(LS_WARNING) << "Attempting to delete " << transport_name
299 << " TransportChannel " << component 315 << " TransportChannel " << component
300 << ", which doesn't exist."; 316 << ", which doesn't exist.";
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 RTC_FROM_HERE, this, MSG_ICEGATHERINGSTATE, 885 RTC_FROM_HERE, this, MSG_ICEGATHERINGSTATE,
870 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); 886 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state));
871 } 887 }
872 } 888 }
873 889
874 void TransportController::OnDtlsHandshakeError(rtc::SSLHandshakeError error) { 890 void TransportController::OnDtlsHandshakeError(rtc::SSLHandshakeError error) {
875 SignalDtlsHandshakeError(error); 891 SignalDtlsHandshakeError(error);
876 } 892 }
877 893
878 } // namespace cricket 894 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698