diff --git a/webrtc/p2p/base/faketransportcontroller.h b/webrtc/p2p/base/faketransportcontroller.h index 1ed3fd85e6..321537dd59 100644 --- a/webrtc/p2p/base/faketransportcontroller.h +++ b/webrtc/p2p/base/faketransportcontroller.h @@ -511,22 +511,22 @@ class FakeTransportController : public TransportController { SetIceRole(role); } - FakeTransport* GetTransport_w(const std::string& transport_name) { + FakeTransport* GetTransport_n(const std::string& transport_name) { return static_cast( - TransportController::GetTransport_w(transport_name)); + TransportController::GetTransport_n(transport_name)); } void Connect(FakeTransportController* dest) { - worker_thread()->Invoke( - rtc::Bind(&FakeTransportController::Connect_w, this, dest)); + network_thread()->Invoke( + rtc::Bind(&FakeTransportController::Connect_n, this, dest)); } - TransportChannel* CreateTransportChannel_w(const std::string& transport_name, + TransportChannel* CreateTransportChannel_n(const std::string& transport_name, int component) override { if (fail_create_channel_) { return nullptr; } - return TransportController::CreateTransportChannel_w(transport_name, + return TransportController::CreateTransportChannel_n(transport_name, component); } @@ -547,21 +547,21 @@ class FakeTransportController : public TransportController { } protected: - Transport* CreateTransport_w(const std::string& transport_name) override { + Transport* CreateTransport_n(const std::string& transport_name) override { return new FakeTransport(transport_name); } - void Connect_w(FakeTransportController* dest) { + void Connect_n(FakeTransportController* dest) { // Simulate the exchange of candidates. - ConnectChannels_w(); - dest->ConnectChannels_w(); + ConnectChannels_n(); + dest->ConnectChannels_n(); for (auto& kv : transports()) { FakeTransport* transport = static_cast(kv.second); - transport->SetDestination(dest->GetTransport_w(kv.first)); + transport->SetDestination(dest->GetTransport_n(kv.first)); } } - void ConnectChannels_w() { + void ConnectChannels_n() { TransportDescription faketransport_desc( std::vector(), rtc::CreateRandomString(cricket::ICE_UFRAG_LENGTH), diff --git a/webrtc/p2p/base/transportcontroller.cc b/webrtc/p2p/base/transportcontroller.cc index 2eb198ed9a..a961541dc3 100644 --- a/webrtc/p2p/base/transportcontroller.cc +++ b/webrtc/p2p/base/transportcontroller.cc @@ -43,59 +43,60 @@ struct CandidatesData : public rtc::MessageData { }; TransportController::TransportController(rtc::Thread* signaling_thread, - rtc::Thread* worker_thread, + rtc::Thread* network_thread, PortAllocator* port_allocator) : signaling_thread_(signaling_thread), - worker_thread_(worker_thread), + network_thread_(network_thread), port_allocator_(port_allocator) {} TransportController::~TransportController() { - worker_thread_->Invoke( - rtc::Bind(&TransportController::DestroyAllTransports_w, this)); + network_thread_->Invoke( + rtc::Bind(&TransportController::DestroyAllTransports_n, this)); signaling_thread_->Clear(this); } bool TransportController::SetSslMaxProtocolVersion( rtc::SSLProtocolVersion version) { - return worker_thread_->Invoke(rtc::Bind( - &TransportController::SetSslMaxProtocolVersion_w, this, version)); + return network_thread_->Invoke(rtc::Bind( + &TransportController::SetSslMaxProtocolVersion_n, this, version)); } void TransportController::SetIceConfig(const IceConfig& config) { - worker_thread_->Invoke( - rtc::Bind(&TransportController::SetIceConfig_w, this, config)); + network_thread_->Invoke( + rtc::Bind(&TransportController::SetIceConfig_n, this, config)); } void TransportController::SetIceRole(IceRole ice_role) { - worker_thread_->Invoke( - rtc::Bind(&TransportController::SetIceRole_w, this, ice_role)); + network_thread_->Invoke( + rtc::Bind(&TransportController::SetIceRole_n, this, ice_role)); } bool TransportController::GetSslRole(const std::string& transport_name, rtc::SSLRole* role) { - return worker_thread_->Invoke(rtc::Bind( - &TransportController::GetSslRole_w, this, transport_name, role)); + return network_thread_->Invoke(rtc::Bind( + &TransportController::GetSslRole_n, this, transport_name, role)); } bool TransportController::SetLocalCertificate( const rtc::scoped_refptr& certificate) { - return worker_thread_->Invoke(rtc::Bind( - &TransportController::SetLocalCertificate_w, this, certificate)); + return network_thread_->Invoke(rtc::Bind( + &TransportController::SetLocalCertificate_n, this, certificate)); } bool TransportController::GetLocalCertificate( const std::string& transport_name, rtc::scoped_refptr* certificate) { - return worker_thread_->Invoke( - rtc::Bind(&TransportController::GetLocalCertificate_w, this, + return network_thread_->Invoke( + rtc::Bind(&TransportController::GetLocalCertificate_n, this, transport_name, certificate)); } std::unique_ptr TransportController::GetRemoteSSLCertificate( const std::string& transport_name) { - return worker_thread_->Invoke>(rtc::Bind( - &TransportController::GetRemoteSSLCertificate_w, this, transport_name)); + return network_thread_->Invoke>( + rtc::Bind(&TransportController::GetRemoteSSLCertificate_n, this, + transport_name)); } bool TransportController::SetLocalTransportDescription( @@ -103,8 +104,8 @@ bool TransportController::SetLocalTransportDescription( const TransportDescription& tdesc, ContentAction action, std::string* err) { - return worker_thread_->Invoke( - rtc::Bind(&TransportController::SetLocalTransportDescription_w, this, + return network_thread_->Invoke( + rtc::Bind(&TransportController::SetLocalTransportDescription_n, this, transport_name, tdesc, action, err)); } @@ -113,48 +114,48 @@ bool TransportController::SetRemoteTransportDescription( const TransportDescription& tdesc, ContentAction action, std::string* err) { - return worker_thread_->Invoke( - rtc::Bind(&TransportController::SetRemoteTransportDescription_w, this, + return network_thread_->Invoke( + rtc::Bind(&TransportController::SetRemoteTransportDescription_n, this, transport_name, tdesc, action, err)); } void TransportController::MaybeStartGathering() { - worker_thread_->Invoke( - rtc::Bind(&TransportController::MaybeStartGathering_w, this)); + network_thread_->Invoke( + rtc::Bind(&TransportController::MaybeStartGathering_n, this)); } bool TransportController::AddRemoteCandidates(const std::string& transport_name, const Candidates& candidates, std::string* err) { - return worker_thread_->Invoke( - rtc::Bind(&TransportController::AddRemoteCandidates_w, this, + return network_thread_->Invoke( + rtc::Bind(&TransportController::AddRemoteCandidates_n, this, transport_name, candidates, err)); } bool TransportController::RemoveRemoteCandidates(const Candidates& candidates, std::string* err) { - return worker_thread_->Invoke(rtc::Bind( - &TransportController::RemoveRemoteCandidates_w, this, candidates, err)); + return network_thread_->Invoke(rtc::Bind( + &TransportController::RemoveRemoteCandidates_n, this, candidates, err)); } bool TransportController::ReadyForRemoteCandidates( const std::string& transport_name) { - return worker_thread_->Invoke(rtc::Bind( - &TransportController::ReadyForRemoteCandidates_w, this, transport_name)); + return network_thread_->Invoke(rtc::Bind( + &TransportController::ReadyForRemoteCandidates_n, this, transport_name)); } bool TransportController::GetStats(const std::string& transport_name, TransportStats* stats) { - return worker_thread_->Invoke( - rtc::Bind(&TransportController::GetStats_w, this, transport_name, stats)); + return network_thread_->Invoke( + rtc::Bind(&TransportController::GetStats_n, this, transport_name, stats)); } -TransportChannel* TransportController::CreateTransportChannel_w( +TransportChannel* TransportController::CreateTransportChannel_n( const std::string& transport_name, int component) { - RTC_DCHECK(worker_thread_->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); - auto it = FindChannel_w(transport_name, component); + auto it = FindChannel_n(transport_name, component); if (it != channels_.end()) { // Channel already exists; increment reference count and return. it->AddRef(); @@ -162,34 +163,34 @@ TransportChannel* TransportController::CreateTransportChannel_w( } // Need to create a new channel. - Transport* transport = GetOrCreateTransport_w(transport_name); + Transport* transport = GetOrCreateTransport_n(transport_name); TransportChannelImpl* channel = transport->CreateChannel(component); channel->SignalWritableState.connect( - this, &TransportController::OnChannelWritableState_w); + this, &TransportController::OnChannelWritableState_n); channel->SignalReceivingState.connect( - this, &TransportController::OnChannelReceivingState_w); + this, &TransportController::OnChannelReceivingState_n); channel->SignalGatheringState.connect( - this, &TransportController::OnChannelGatheringState_w); + this, &TransportController::OnChannelGatheringState_n); channel->SignalCandidateGathered.connect( - this, &TransportController::OnChannelCandidateGathered_w); + this, &TransportController::OnChannelCandidateGathered_n); channel->SignalCandidatesRemoved.connect( - this, &TransportController::OnChannelCandidatesRemoved_w); + this, &TransportController::OnChannelCandidatesRemoved_n); channel->SignalRoleConflict.connect( - this, &TransportController::OnChannelRoleConflict_w); + this, &TransportController::OnChannelRoleConflict_n); channel->SignalConnectionRemoved.connect( - this, &TransportController::OnChannelConnectionRemoved_w); + this, &TransportController::OnChannelConnectionRemoved_n); channels_.insert(channels_.end(), RefCountedChannel(channel))->AddRef(); // Adding a channel could cause aggregate state to change. - UpdateAggregateStates_w(); + UpdateAggregateStates_n(); return channel; } -void TransportController::DestroyTransportChannel_w( +void TransportController::DestroyTransportChannel_n( const std::string& transport_name, int component) { - RTC_DCHECK(worker_thread_->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); - auto it = FindChannel_w(transport_name, component); + auto it = FindChannel_n(transport_name, component); if (it == channels_.end()) { LOG(LS_WARNING) << "Attempting to delete " << transport_name << " TransportChannel " << component @@ -203,15 +204,15 @@ void TransportController::DestroyTransportChannel_w( } channels_.erase(it); - Transport* transport = GetTransport_w(transport_name); + Transport* transport = GetTransport_n(transport_name); transport->DestroyChannel(component); // Just as we create a Transport when its first channel is created, // we delete it when its last channel is deleted. if (!transport->HasChannels()) { - DestroyTransport_w(transport_name); + DestroyTransport_n(transport_name); } // Removing a channel could cause aggregate state to change. - UpdateAggregateStates_w(); + UpdateAggregateStates_n(); } const rtc::scoped_refptr& @@ -219,9 +220,9 @@ TransportController::certificate_for_testing() { return certificate_; } -Transport* TransportController::CreateTransport_w( +Transport* TransportController::CreateTransport_n( const std::string& transport_name) { - RTC_DCHECK(worker_thread_->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); #ifdef HAVE_QUIC if (quic_) { @@ -233,9 +234,9 @@ Transport* TransportController::CreateTransport_w( return transport; } -Transport* TransportController::GetTransport_w( +Transport* TransportController::GetTransport_n( const std::string& transport_name) { - RTC_DCHECK(worker_thread_->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); auto iter = transports_.find(transport_name); return (iter != transports_.end()) ? iter->second : nullptr; @@ -278,7 +279,7 @@ void TransportController::OnMessage(rtc::Message* pmsg) { } std::vector::iterator -TransportController::FindChannel_w(const std::string& transport_name, +TransportController::FindChannel_n(const std::string& transport_name, int component) { return std::find_if( channels_.begin(), channels_.end(), @@ -288,16 +289,16 @@ TransportController::FindChannel_w(const std::string& transport_name, }); } -Transport* TransportController::GetOrCreateTransport_w( +Transport* TransportController::GetOrCreateTransport_n( const std::string& transport_name) { - RTC_DCHECK(worker_thread_->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); - Transport* transport = GetTransport_w(transport_name); + Transport* transport = GetTransport_n(transport_name); if (transport) { return transport; } - transport = CreateTransport_w(transport_name); + transport = CreateTransport_n(transport_name); // The stuff below happens outside of CreateTransport_w so that unit tests // can override CreateTransport_w to return a different type of transport. transport->SetSslMaxProtocolVersion(ssl_max_version_); @@ -312,9 +313,9 @@ Transport* TransportController::GetOrCreateTransport_w( return transport; } -void TransportController::DestroyTransport_w( +void TransportController::DestroyTransport_n( const std::string& transport_name) { - RTC_DCHECK(worker_thread_->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); auto iter = transports_.find(transport_name); if (iter != transports_.end()) { @@ -323,8 +324,8 @@ void TransportController::DestroyTransport_w( } } -void TransportController::DestroyAllTransports_w() { - RTC_DCHECK(worker_thread_->IsCurrent()); +void TransportController::DestroyAllTransports_n() { + RTC_DCHECK(network_thread_->IsCurrent()); for (const auto& kv : transports_) { delete kv.second; @@ -332,9 +333,9 @@ void TransportController::DestroyAllTransports_w() { transports_.clear(); } -bool TransportController::SetSslMaxProtocolVersion_w( +bool TransportController::SetSslMaxProtocolVersion_n( rtc::SSLProtocolVersion version) { - RTC_DCHECK(worker_thread_->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); // Max SSL version can only be set before transports are created. if (!transports_.empty()) { @@ -345,27 +346,27 @@ bool TransportController::SetSslMaxProtocolVersion_w( return true; } -void TransportController::SetIceConfig_w(const IceConfig& config) { - RTC_DCHECK(worker_thread_->IsCurrent()); +void TransportController::SetIceConfig_n(const IceConfig& config) { + RTC_DCHECK(network_thread_->IsCurrent()); ice_config_ = config; for (const auto& kv : transports_) { kv.second->SetIceConfig(ice_config_); } } -void TransportController::SetIceRole_w(IceRole ice_role) { - RTC_DCHECK(worker_thread_->IsCurrent()); +void TransportController::SetIceRole_n(IceRole ice_role) { + RTC_DCHECK(network_thread_->IsCurrent()); ice_role_ = ice_role; for (const auto& kv : transports_) { kv.second->SetIceRole(ice_role_); } } -bool TransportController::GetSslRole_w(const std::string& transport_name, +bool TransportController::GetSslRole_n(const std::string& transport_name, rtc::SSLRole* role) { - RTC_DCHECK(worker_thread()->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); - Transport* t = GetTransport_w(transport_name); + Transport* t = GetTransport_n(transport_name); if (!t) { return false; } @@ -373,9 +374,9 @@ bool TransportController::GetSslRole_w(const std::string& transport_name, return t->GetSslRole(role); } -bool TransportController::SetLocalCertificate_w( +bool TransportController::SetLocalCertificate_n( const rtc::scoped_refptr& certificate) { - RTC_DCHECK(worker_thread_->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); if (certificate_) { return false; @@ -391,12 +392,12 @@ bool TransportController::SetLocalCertificate_w( return true; } -bool TransportController::GetLocalCertificate_w( +bool TransportController::GetLocalCertificate_n( const std::string& transport_name, rtc::scoped_refptr* certificate) { - RTC_DCHECK(worker_thread_->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); - Transport* t = GetTransport_w(transport_name); + Transport* t = GetTransport_n(transport_name); if (!t) { return false; } @@ -405,11 +406,11 @@ bool TransportController::GetLocalCertificate_w( } std::unique_ptr -TransportController::GetRemoteSSLCertificate_w( +TransportController::GetRemoteSSLCertificate_n( const std::string& transport_name) { - RTC_DCHECK(worker_thread_->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); - Transport* t = GetTransport_w(transport_name); + Transport* t = GetTransport_n(transport_name); if (!t) { return nullptr; } @@ -417,14 +418,14 @@ TransportController::GetRemoteSSLCertificate_w( return t->GetRemoteSSLCertificate(); } -bool TransportController::SetLocalTransportDescription_w( +bool TransportController::SetLocalTransportDescription_n( const std::string& transport_name, const TransportDescription& tdesc, ContentAction action, std::string* err) { - RTC_DCHECK(worker_thread()->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); - Transport* transport = GetTransport_w(transport_name); + Transport* transport = GetTransport_n(transport_name); if (!transport) { // If we didn't find a transport, that's not an error; // it could have been deleted as a result of bundling. @@ -436,14 +437,14 @@ bool TransportController::SetLocalTransportDescription_w( return transport->SetLocalTransportDescription(tdesc, action, err); } -bool TransportController::SetRemoteTransportDescription_w( +bool TransportController::SetRemoteTransportDescription_n( const std::string& transport_name, const TransportDescription& tdesc, ContentAction action, std::string* err) { - RTC_DCHECK(worker_thread()->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); - Transport* transport = GetTransport_w(transport_name); + Transport* transport = GetTransport_n(transport_name); if (!transport) { // If we didn't find a transport, that's not an error; // it could have been deleted as a result of bundling. @@ -455,19 +456,19 @@ bool TransportController::SetRemoteTransportDescription_w( return transport->SetRemoteTransportDescription(tdesc, action, err); } -void TransportController::MaybeStartGathering_w() { +void TransportController::MaybeStartGathering_n() { for (const auto& kv : transports_) { kv.second->MaybeStartGathering(); } } -bool TransportController::AddRemoteCandidates_w( +bool TransportController::AddRemoteCandidates_n( const std::string& transport_name, const Candidates& candidates, std::string* err) { - RTC_DCHECK(worker_thread()->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); - Transport* transport = GetTransport_w(transport_name); + Transport* transport = GetTransport_n(transport_name); if (!transport) { // If we didn't find a transport, that's not an error; // it could have been deleted as a result of bundling. @@ -477,9 +478,9 @@ bool TransportController::AddRemoteCandidates_w( return transport->AddRemoteCandidates(candidates, err); } -bool TransportController::RemoveRemoteCandidates_w(const Candidates& candidates, +bool TransportController::RemoveRemoteCandidates_n(const Candidates& candidates, std::string* err) { - RTC_DCHECK(worker_thread()->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); std::map candidates_by_transport_name; for (const Candidate& cand : candidates) { RTC_DCHECK(!cand.transport_name().empty()); @@ -488,7 +489,7 @@ bool TransportController::RemoveRemoteCandidates_w(const Candidates& candidates, bool result = true; for (auto kv : candidates_by_transport_name) { - Transport* transport = GetTransport_w(kv.first); + Transport* transport = GetTransport_n(kv.first); if (!transport) { // If we didn't find a transport, that's not an error; // it could have been deleted as a result of bundling. @@ -499,51 +500,51 @@ bool TransportController::RemoveRemoteCandidates_w(const Candidates& candidates, return result; } -bool TransportController::ReadyForRemoteCandidates_w( +bool TransportController::ReadyForRemoteCandidates_n( const std::string& transport_name) { - RTC_DCHECK(worker_thread()->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); - Transport* transport = GetTransport_w(transport_name); + Transport* transport = GetTransport_n(transport_name); if (!transport) { return false; } return transport->ready_for_remote_candidates(); } -bool TransportController::GetStats_w(const std::string& transport_name, +bool TransportController::GetStats_n(const std::string& transport_name, TransportStats* stats) { - RTC_DCHECK(worker_thread()->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); - Transport* transport = GetTransport_w(transport_name); + Transport* transport = GetTransport_n(transport_name); if (!transport) { return false; } return transport->GetStats(stats); } -void TransportController::OnChannelWritableState_w(TransportChannel* channel) { - RTC_DCHECK(worker_thread_->IsCurrent()); +void TransportController::OnChannelWritableState_n(TransportChannel* channel) { + RTC_DCHECK(network_thread_->IsCurrent()); LOG(LS_INFO) << channel->transport_name() << " TransportChannel " << channel->component() << " writability changed to " << channel->writable() << "."; - UpdateAggregateStates_w(); + UpdateAggregateStates_n(); } -void TransportController::OnChannelReceivingState_w(TransportChannel* channel) { - RTC_DCHECK(worker_thread_->IsCurrent()); - UpdateAggregateStates_w(); +void TransportController::OnChannelReceivingState_n(TransportChannel* channel) { + RTC_DCHECK(network_thread_->IsCurrent()); + UpdateAggregateStates_n(); } -void TransportController::OnChannelGatheringState_w( +void TransportController::OnChannelGatheringState_n( TransportChannelImpl* channel) { - RTC_DCHECK(worker_thread_->IsCurrent()); - UpdateAggregateStates_w(); + RTC_DCHECK(network_thread_->IsCurrent()); + UpdateAggregateStates_n(); } -void TransportController::OnChannelCandidateGathered_w( +void TransportController::OnChannelCandidateGathered_n( TransportChannelImpl* channel, const Candidate& candidate) { - RTC_DCHECK(worker_thread_->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); // We should never signal peer-reflexive candidates. if (candidate.type() == PRFLX_PORT_TYPE) { @@ -557,7 +558,7 @@ void TransportController::OnChannelCandidateGathered_w( signaling_thread_->Post(this, MSG_CANDIDATESGATHERED, data); } -void TransportController::OnChannelCandidatesRemoved_w( +void TransportController::OnChannelCandidatesRemoved_n( TransportChannelImpl* channel, const Candidates& candidates) { invoker_.AsyncInvoke( @@ -572,9 +573,9 @@ void TransportController::OnChannelCandidatesRemoved( SignalCandidatesRemoved(candidates); } -void TransportController::OnChannelRoleConflict_w( +void TransportController::OnChannelRoleConflict_n( TransportChannelImpl* channel) { - RTC_DCHECK(worker_thread_->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); if (ice_role_switch_) { LOG(LS_WARNING) @@ -591,17 +592,17 @@ void TransportController::OnChannelRoleConflict_w( } } -void TransportController::OnChannelConnectionRemoved_w( +void TransportController::OnChannelConnectionRemoved_n( TransportChannelImpl* channel) { - RTC_DCHECK(worker_thread_->IsCurrent()); + RTC_DCHECK(network_thread_->IsCurrent()); LOG(LS_INFO) << channel->transport_name() << " TransportChannel " << channel->component() << " connection removed. Check if state is complete."; - UpdateAggregateStates_w(); + UpdateAggregateStates_n(); } -void TransportController::UpdateAggregateStates_w() { - RTC_DCHECK(worker_thread_->IsCurrent()); +void TransportController::UpdateAggregateStates_n() { + RTC_DCHECK(network_thread_->IsCurrent()); IceConnectionState new_connection_state = kIceConnectionConnecting; IceGatheringState new_gathering_state = kIceGatheringNew; diff --git a/webrtc/p2p/base/transportcontroller.h b/webrtc/p2p/base/transportcontroller.h index f84c55179c..cc16a768ab 100644 --- a/webrtc/p2p/base/transportcontroller.h +++ b/webrtc/p2p/base/transportcontroller.h @@ -32,13 +32,13 @@ class TransportController : public sigslot::has_slots<>, public rtc::MessageHandler { public: TransportController(rtc::Thread* signaling_thread, - rtc::Thread* worker_thread, + rtc::Thread* network_thread, PortAllocator* port_allocator); virtual ~TransportController(); rtc::Thread* signaling_thread() const { return signaling_thread_; } - rtc::Thread* worker_thread() const { return worker_thread_; } + rtc::Thread* network_thread() const { return network_thread_; } PortAllocator* port_allocator() const { return port_allocator_; } @@ -82,13 +82,13 @@ class TransportController : public sigslot::has_slots<>, // Creates a channel if it doesn't exist. Otherwise, increments a reference // count and returns an existing channel. - virtual TransportChannel* CreateTransportChannel_w( + virtual TransportChannel* CreateTransportChannel_n( const std::string& transport_name, int component); // Decrements a channel's reference count, and destroys the channel if // nothing is referencing it. - virtual void DestroyTransportChannel_w(const std::string& transport_name, + virtual void DestroyTransportChannel_n(const std::string& transport_name, int component); void use_quic() { quic_ = true; } @@ -121,11 +121,11 @@ class TransportController : public sigslot::has_slots<>, protected: // Protected and virtual so we can override it in unit tests. - virtual Transport* CreateTransport_w(const std::string& transport_name); + virtual Transport* CreateTransport_n(const std::string& transport_name); // For unit tests const std::map& transports() { return transports_; } - Transport* GetTransport_w(const std::string& transport_name); + Transport* GetTransport_n(const std::string& transport_name); private: void OnMessage(rtc::Message* pmsg) override; @@ -153,57 +153,57 @@ class TransportController : public sigslot::has_slots<>, int ref_; }; - std::vector::iterator FindChannel_w( + std::vector::iterator FindChannel_n( const std::string& transport_name, int component); - Transport* GetOrCreateTransport_w(const std::string& transport_name); - void DestroyTransport_w(const std::string& transport_name); - void DestroyAllTransports_w(); + Transport* GetOrCreateTransport_n(const std::string& transport_name); + void DestroyTransport_n(const std::string& transport_name); + void DestroyAllTransports_n(); - bool SetSslMaxProtocolVersion_w(rtc::SSLProtocolVersion version); - void SetIceConfig_w(const IceConfig& config); - void SetIceRole_w(IceRole ice_role); - bool GetSslRole_w(const std::string& transport_name, rtc::SSLRole* role); - bool SetLocalCertificate_w( + bool SetSslMaxProtocolVersion_n(rtc::SSLProtocolVersion version); + void SetIceConfig_n(const IceConfig& config); + void SetIceRole_n(IceRole ice_role); + bool GetSslRole_n(const std::string& transport_name, rtc::SSLRole* role); + bool SetLocalCertificate_n( const rtc::scoped_refptr& certificate); - bool GetLocalCertificate_w( + bool GetLocalCertificate_n( const std::string& transport_name, rtc::scoped_refptr* certificate); - std::unique_ptr GetRemoteSSLCertificate_w( + std::unique_ptr GetRemoteSSLCertificate_n( const std::string& transport_name); - bool SetLocalTransportDescription_w(const std::string& transport_name, + bool SetLocalTransportDescription_n(const std::string& transport_name, const TransportDescription& tdesc, ContentAction action, std::string* err); - bool SetRemoteTransportDescription_w(const std::string& transport_name, + bool SetRemoteTransportDescription_n(const std::string& transport_name, const TransportDescription& tdesc, ContentAction action, std::string* err); - void MaybeStartGathering_w(); - bool AddRemoteCandidates_w(const std::string& transport_name, + void MaybeStartGathering_n(); + bool AddRemoteCandidates_n(const std::string& transport_name, const Candidates& candidates, std::string* err); - bool RemoveRemoteCandidates_w(const Candidates& candidates, std::string* err); - bool ReadyForRemoteCandidates_w(const std::string& transport_name); - bool GetStats_w(const std::string& transport_name, TransportStats* stats); + bool RemoveRemoteCandidates_n(const Candidates& candidates, std::string* err); + bool ReadyForRemoteCandidates_n(const std::string& transport_name); + bool GetStats_n(const std::string& transport_name, TransportStats* stats); // Handlers for signals from Transport. - void OnChannelWritableState_w(TransportChannel* channel); - void OnChannelReceivingState_w(TransportChannel* channel); - void OnChannelGatheringState_w(TransportChannelImpl* channel); - void OnChannelCandidateGathered_w(TransportChannelImpl* channel, + void OnChannelWritableState_n(TransportChannel* channel); + void OnChannelReceivingState_n(TransportChannel* channel); + void OnChannelGatheringState_n(TransportChannelImpl* channel); + void OnChannelCandidateGathered_n(TransportChannelImpl* channel, const Candidate& candidate); void OnChannelCandidatesRemoved(const Candidates& candidates); - void OnChannelCandidatesRemoved_w(TransportChannelImpl* channel, + void OnChannelCandidatesRemoved_n(TransportChannelImpl* channel, const Candidates& candidates); - void OnChannelRoleConflict_w(TransportChannelImpl* channel); - void OnChannelConnectionRemoved_w(TransportChannelImpl* channel); + void OnChannelRoleConflict_n(TransportChannelImpl* channel); + void OnChannelConnectionRemoved_n(TransportChannelImpl* channel); - void UpdateAggregateStates_w(); + void UpdateAggregateStates_n(); rtc::Thread* const signaling_thread_ = nullptr; - rtc::Thread* const worker_thread_ = nullptr; + rtc::Thread* const network_thread_ = nullptr; typedef std::map TransportMap; TransportMap transports_; diff --git a/webrtc/p2p/base/transportcontroller_unittest.cc b/webrtc/p2p/base/transportcontroller_unittest.cc index e8e6f5f9fd..6b64912136 100644 --- a/webrtc/p2p/base/transportcontroller_unittest.cc +++ b/webrtc/p2p/base/transportcontroller_unittest.cc @@ -81,12 +81,12 @@ class TransportControllerTest : public testing::Test, FakeTransportChannel* CreateChannel(const std::string& content, int component) { TransportChannel* channel = - transport_controller_->CreateTransportChannel_w(content, component); + transport_controller_->CreateTransportChannel_n(content, component); return static_cast(channel); } void DestroyChannel(const std::string& content, int component) { - transport_controller_->DestroyTransportChannel_w(content, component); + transport_controller_->DestroyTransportChannel_n(content, component); } Candidate CreateCandidate(int component) { diff --git a/webrtc/pc/channel.cc b/webrtc/pc/channel.cc index 4e58c8fecc..7e4d5d2dac 100644 --- a/webrtc/pc/channel.cc +++ b/webrtc/pc/channel.cc @@ -173,7 +173,7 @@ BaseChannel::BaseChannel(rtc::Thread* worker_thread, remote_content_direction_(MD_INACTIVE) { ASSERT(worker_thread_ == rtc::Thread::Current()); if (transport_controller) { - RTC_DCHECK_EQ(network_thread, transport_controller->worker_thread()); + RTC_DCHECK_EQ(network_thread, transport_controller->network_thread()); } LOG(LS_INFO) << "Created channel for " << content_name; } @@ -201,12 +201,12 @@ BaseChannel::~BaseChannel() { void BaseChannel::DeinitNetwork_n() { if (transport_channel_) { DisconnectFromTransportChannel(transport_channel_); - transport_controller_->DestroyTransportChannel_w( + transport_controller_->DestroyTransportChannel_n( transport_name_, cricket::ICE_CANDIDATE_COMPONENT_RTP); } if (rtcp_transport_channel_) { DisconnectFromTransportChannel(rtcp_transport_channel_); - transport_controller_->DestroyTransportChannel_w( + transport_controller_->DestroyTransportChannel_n( transport_name_, cricket::ICE_CANDIDATE_COMPONENT_RTCP); } network_thread_->Clear(this); @@ -273,7 +273,7 @@ bool BaseChannel::SetTransport_n(const std::string& transport_name) { LOG(LS_INFO) << "Create RTCP TransportChannel for " << content_name() << " on " << transport_name << " transport "; SetRtcpTransportChannel_n( - transport_controller_->CreateTransportChannel_w( + transport_controller_->CreateTransportChannel_n( transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP), false /* update_writablity */); if (!rtcp_transport_channel_) { @@ -282,7 +282,7 @@ bool BaseChannel::SetTransport_n(const std::string& transport_name) { } // We're not updating the writablity during the transition state. - SetTransportChannel_n(transport_controller_->CreateTransportChannel_w( + SetTransportChannel_n(transport_controller_->CreateTransportChannel_n( transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP)); if (!transport_channel_) { return false; @@ -311,7 +311,7 @@ void BaseChannel::SetTransportChannel_n(TransportChannel* new_tc) { if (old_tc) { DisconnectFromTransportChannel(old_tc); - transport_controller_->DestroyTransportChannel_w( + transport_controller_->DestroyTransportChannel_n( transport_name_, cricket::ICE_CANDIDATE_COMPONENT_RTP); } @@ -343,7 +343,7 @@ void BaseChannel::SetRtcpTransportChannel_n(TransportChannel* new_tc, if (old_tc) { DisconnectFromTransportChannel(old_tc); - transport_controller_->DestroyTransportChannel_w( + transport_controller_->DestroyTransportChannel_n( transport_name_, cricket::ICE_CANDIDATE_COMPONENT_RTCP); } diff --git a/webrtc/pc/channel_unittest.cc b/webrtc/pc/channel_unittest.cc index 8369c7a711..d15748ffbb 100644 --- a/webrtc/pc/channel_unittest.cc +++ b/webrtc/pc/channel_unittest.cc @@ -268,12 +268,12 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> { cricket::FakeTransport* GetTransport1() { std::string name = channel1_->content_name(); return network_thread_->Invoke( - [this, name] { return transport_controller1_->GetTransport_w(name); }); + [this, name] { return transport_controller1_->GetTransport_n(name); }); } cricket::FakeTransport* GetTransport2() { std::string name = channel2_->content_name(); return network_thread_->Invoke( - [this, name] { return transport_controller2_->GetTransport_w(name); }); + [this, name] { return transport_controller2_->GetTransport_n(name); }); } void SendRtp1() { diff --git a/webrtc/pc/channelmanager_unittest.cc b/webrtc/pc/channelmanager_unittest.cc index 0cedd8b4bc..a642af5a26 100644 --- a/webrtc/pc/channelmanager_unittest.cc +++ b/webrtc/pc/channelmanager_unittest.cc @@ -149,7 +149,7 @@ TEST_F(ChannelManagerTest, NoTransportChannelTest) { transport_controller_->set_fail_channel_creation(true); // The test is useless unless the session does not fail creating // cricket::TransportChannel. - ASSERT_TRUE(transport_controller_->CreateTransportChannel_w( + ASSERT_TRUE(transport_controller_->CreateTransportChannel_n( "audio", cricket::ICE_CANDIDATE_COMPONENT_RTP) == nullptr); cricket::VoiceChannel* voice_channel =