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

Unified Diff: webrtc/p2p/base/transportcontroller.cc

Issue 2639203004: Revert of make the DtlsTransportWrapper inherit form DtlsTransportInternal (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/p2p/base/transportcontroller.h ('k') | webrtc/p2p/base/transportcontroller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/transportcontroller.cc
diff --git a/webrtc/p2p/base/transportcontroller.cc b/webrtc/p2p/base/transportcontroller.cc
index 820645b42b7dc7589cb35423a1d0d363d0fbe10d..5dc4b97a0e67ad964a2ec385d561a07255a5efbd 100644
--- a/webrtc/p2p/base/transportcontroller.cc
+++ b/webrtc/p2p/base/transportcontroller.cc
@@ -45,22 +45,22 @@
class TransportController::ChannelPair {
public:
// TODO(deadbeef): Change the types of |dtls| and |ice| to
- // DtlsTransport and P2PTransportChannelWrapper, once TransportChannelImpl is
- // removed.
- ChannelPair(DtlsTransportInternal* dtls, IceTransportInternal* ice)
+ // DtlsTransportChannelWrapper and P2PTransportChannelWrapper,
+ // once TransportChannelImpl is removed.
+ ChannelPair(TransportChannelImpl* dtls, IceTransportInternal* ice)
: ice_(ice), dtls_(dtls) {}
// Currently, all ICE-related calls still go through this DTLS channel. But
// that will change once we get rid of TransportChannelImpl, and the DTLS
// channel interface no longer includes ICE-specific methods.
- const DtlsTransportInternal* dtls() const { return dtls_.get(); }
- DtlsTransportInternal* dtls() { return dtls_.get(); }
+ const TransportChannelImpl* dtls() const { return dtls_.get(); }
+ TransportChannelImpl* dtls() { return dtls_.get(); }
const IceTransportInternal* ice() const { return ice_.get(); }
IceTransportInternal* ice() { return ice_.get(); }
private:
std::unique_ptr<IceTransportInternal> ice_;
- std::unique_ptr<DtlsTransportInternal> dtls_;
+ std::unique_ptr<TransportChannelImpl> dtls_;
RTC_DISALLOW_COPY_AND_ASSIGN(ChannelPair);
};
@@ -227,15 +227,15 @@
metrics_observer));
}
-DtlsTransportInternal* TransportController::CreateDtlsTransport(
+TransportChannel* TransportController::CreateTransportChannel(
const std::string& transport_name,
int component) {
- return network_thread_->Invoke<DtlsTransportInternal*>(
- RTC_FROM_HERE, rtc::Bind(&TransportController::CreateDtlsTransport_n,
+ return network_thread_->Invoke<TransportChannel*>(
+ RTC_FROM_HERE, rtc::Bind(&TransportController::CreateTransportChannel_n,
this, transport_name, component));
}
-DtlsTransportInternal* TransportController::CreateDtlsTransport_n(
+TransportChannel* TransportController::CreateTransportChannel_n(
const std::string& transport_name,
int component) {
RTC_DCHECK(network_thread_->IsCurrent());
@@ -256,12 +256,12 @@
// TODO(deadbeef): To support QUIC, would need to create a
// QuicTransportChannel here. What is "dtls" in this file would then become
// "dtls or quic".
- DtlsTransportInternal* dtls =
+ TransportChannelImpl* dtls =
CreateDtlsTransportChannel_n(transport_name, component, ice);
- dtls->ice_transport()->SetMetricsObserver(metrics_observer_);
- dtls->ice_transport()->SetIceRole(ice_role_);
- dtls->ice_transport()->SetIceTiebreaker(ice_tiebreaker_);
- dtls->ice_transport()->SetIceConfig(ice_config_);
+ dtls->SetMetricsObserver(metrics_observer_);
+ dtls->SetIceRole(ice_role_);
+ dtls->SetIceTiebreaker(ice_tiebreaker_);
+ dtls->SetIceConfig(ice_config_);
if (certificate_) {
bool set_cert_success = dtls->SetLocalCertificate(certificate_);
RTC_DCHECK(set_cert_success);
@@ -274,18 +274,18 @@
this, &TransportController::OnChannelWritableState_n);
dtls->SignalReceivingState.connect(
this, &TransportController::OnChannelReceivingState_n);
+ dtls->SignalGatheringState.connect(
+ this, &TransportController::OnChannelGatheringState_n);
+ dtls->SignalCandidateGathered.connect(
+ this, &TransportController::OnChannelCandidateGathered_n);
+ dtls->SignalCandidatesRemoved.connect(
+ this, &TransportController::OnChannelCandidatesRemoved_n);
+ dtls->SignalRoleConflict.connect(
+ this, &TransportController::OnChannelRoleConflict_n);
+ dtls->SignalStateChanged.connect(
+ this, &TransportController::OnChannelStateChanged_n);
dtls->SignalDtlsHandshakeError.connect(
this, &TransportController::OnDtlsHandshakeError);
- dtls->ice_transport()->SignalGatheringState.connect(
- this, &TransportController::OnChannelGatheringState_n);
- dtls->ice_transport()->SignalCandidateGathered.connect(
- this, &TransportController::OnChannelCandidateGathered_n);
- dtls->ice_transport()->SignalCandidatesRemoved.connect(
- this, &TransportController::OnChannelCandidatesRemoved_n);
- dtls->ice_transport()->SignalRoleConflict.connect(
- this, &TransportController::OnChannelRoleConflict_n);
- dtls->ice_transport()->SignalStateChanged.connect(
- this, &TransportController::OnChannelStateChanged_n);
RefCountedChannel* new_pair = new RefCountedChannel(dtls, ice);
new_pair->AddRef();
channels_.insert(channels_.end(), new_pair);
@@ -296,15 +296,15 @@
return dtls;
}
-void TransportController::DestroyDtlsTransport(
+void TransportController::DestroyTransportChannel(
const std::string& transport_name,
int component) {
network_thread_->Invoke<void>(
- RTC_FROM_HERE, rtc::Bind(&TransportController::DestroyDtlsTransport_n,
+ RTC_FROM_HERE, rtc::Bind(&TransportController::DestroyTransportChannel_n,
this, transport_name, component));
}
-void TransportController::DestroyDtlsTransport_n(
+void TransportController::DestroyTransportChannel_n(
const std::string& transport_name,
int component) {
RTC_DCHECK(network_thread_->IsCurrent());
@@ -340,16 +340,15 @@
return ret;
}
-std::vector<DtlsTransportInternal*>
-TransportController::channels_for_testing() {
- std::vector<DtlsTransportInternal*> ret;
+std::vector<TransportChannelImpl*> TransportController::channels_for_testing() {
+ std::vector<TransportChannelImpl*> ret;
for (RefCountedChannel* channel : channels_) {
ret.push_back(channel->dtls());
}
return ret;
}
-DtlsTransportInternal* TransportController::get_channel_for_testing(
+TransportChannelImpl* TransportController::get_channel_for_testing(
const std::string& transport_name,
int component) {
RefCountedChannel* ch = GetChannel_n(transport_name, component);
@@ -362,11 +361,11 @@
return new P2PTransportChannel(transport_name, component, port_allocator_);
}
-DtlsTransportInternal* TransportController::CreateDtlsTransportChannel_n(
+TransportChannelImpl* TransportController::CreateDtlsTransportChannel_n(
const std::string&,
int,
IceTransportInternal* ice) {
- DtlsTransport* dtls = new DtlsTransport(ice);
+ DtlsTransportChannelWrapper* dtls = new DtlsTransportChannelWrapper(ice);
dtls->SetSslMaxProtocolVersion(ssl_max_version_);
return dtls;
}
@@ -504,7 +503,7 @@
ice_config_ = config;
for (auto& channel : channels_) {
- channel->dtls()->ice_transport()->SetIceConfig(ice_config_);
+ channel->dtls()->SetIceConfig(ice_config_);
}
}
@@ -513,7 +512,7 @@
ice_role_ = ice_role;
for (auto& channel : channels_) {
- channel->dtls()->ice_transport()->SetIceRole(ice_role_);
+ channel->dtls()->SetIceRole(ice_role_);
}
}
@@ -645,7 +644,7 @@
void TransportController::MaybeStartGathering_n() {
for (auto& channel : channels_) {
- channel->dtls()->ice_transport()->MaybeStartGathering();
+ channel->dtls()->MaybeStartGathering();
}
}
@@ -675,7 +674,7 @@
" for content: " + transport_name;
return false;
}
- channel->dtls()->ice_transport()->AddRemoteCandidate(candidate);
+ channel->dtls()->AddRemoteCandidate(candidate);
}
return true;
}
@@ -709,7 +708,7 @@
RefCountedChannel* channel =
GetChannel_n(transport_name, candidate.component());
if (channel) {
- channel->dtls()->ice_transport()->RemoveRemoteCandidate(candidate);
+ channel->dtls()->RemoveRemoteCandidate(candidate);
}
}
}
@@ -743,7 +742,7 @@
RTC_DCHECK(network_thread_->IsCurrent());
metrics_observer_ = metrics_observer;
for (auto& channel : channels_) {
- channel->dtls()->ice_transport()->SetMetricsObserver(metrics_observer);
+ channel->dtls()->SetMetricsObserver(metrics_observer);
}
}
@@ -762,13 +761,13 @@
}
void TransportController::OnChannelGatheringState_n(
- IceTransportInternal* channel) {
+ TransportChannelImpl* channel) {
RTC_DCHECK(network_thread_->IsCurrent());
UpdateAggregateStates_n();
}
void TransportController::OnChannelCandidateGathered_n(
- IceTransportInternal* channel,
+ TransportChannelImpl* channel,
const Candidate& candidate) {
RTC_DCHECK(network_thread_->IsCurrent());
@@ -785,7 +784,7 @@
}
void TransportController::OnChannelCandidatesRemoved_n(
- IceTransportInternal* channel,
+ TransportChannelImpl* channel,
const Candidates& candidates) {
invoker_.AsyncInvoke<void>(
RTC_FROM_HERE, signaling_thread_,
@@ -800,7 +799,7 @@
}
void TransportController::OnChannelRoleConflict_n(
- IceTransportInternal* channel) {
+ TransportChannelImpl* channel) {
RTC_DCHECK(network_thread_->IsCurrent());
// Note: since the role conflict is handled entirely on the network thread,
// we don't need to worry about role conflicts occurring on two ports at once.
@@ -816,7 +815,7 @@
}
void TransportController::OnChannelStateChanged_n(
- IceTransportInternal* channel) {
+ TransportChannelImpl* channel) {
RTC_DCHECK(network_thread_->IsCurrent());
LOG(LS_INFO) << channel->transport_name() << " TransportChannel "
<< channel->component()
@@ -838,23 +837,20 @@
for (const auto& channel : channels_) {
any_receiving = any_receiving || channel->dtls()->receiving();
any_failed = any_failed ||
- channel->dtls()->ice_transport()->GetState() ==
- IceTransportState::STATE_FAILED;
+ channel->dtls()->GetState() == IceTransportState::STATE_FAILED;
all_connected = all_connected && channel->dtls()->writable();
all_completed =
all_completed && channel->dtls()->writable() &&
- channel->dtls()->ice_transport()->GetState() ==
- IceTransportState::STATE_COMPLETED &&
- channel->dtls()->ice_transport()->GetIceRole() == ICEROLE_CONTROLLING &&
- channel->dtls()->ice_transport()->gathering_state() ==
- kIceGatheringComplete;
+ channel->dtls()->GetState() == IceTransportState::STATE_COMPLETED &&
+ channel->dtls()->GetIceRole() == ICEROLE_CONTROLLING &&
+ channel->dtls()->gathering_state() == kIceGatheringComplete;
any_gathering =
- any_gathering ||
- channel->dtls()->ice_transport()->gathering_state() != kIceGatheringNew;
- all_done_gathering = all_done_gathering &&
- channel->dtls()->ice_transport()->gathering_state() ==
- kIceGatheringComplete;
- }
+ any_gathering || channel->dtls()->gathering_state() != kIceGatheringNew;
+ all_done_gathering =
+ all_done_gathering &&
+ channel->dtls()->gathering_state() == kIceGatheringComplete;
+ }
+
if (any_failed) {
new_connection_state = kIceConnectionFailed;
} else if (all_completed) {
« no previous file with comments | « webrtc/p2p/base/transportcontroller.h ('k') | webrtc/p2p/base/transportcontroller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698