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

Unified Diff: webrtc/p2p/client/basicportallocator.cc

Issue 2620303003: Replace ASSERT by RTC_DCHECK in all non-test code. (Closed)
Patch Set: Address final nits. 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/client/basicportallocator.h ('k') | webrtc/p2p/client/socketmonitor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/client/basicportallocator.cc
diff --git a/webrtc/p2p/client/basicportallocator.cc b/webrtc/p2p/client/basicportallocator.cc
index 943a8467048ed1b6c1638b858611b8dbc43218ba..65fb30a7008a099ae0392e3ad69081fc8197cd68 100644
--- a/webrtc/p2p/client/basicportallocator.cc
+++ b/webrtc/p2p/client/basicportallocator.cc
@@ -100,14 +100,14 @@ const uint32_t DISABLE_ALL_PHASES =
BasicPortAllocator::BasicPortAllocator(rtc::NetworkManager* network_manager,
rtc::PacketSocketFactory* socket_factory)
: network_manager_(network_manager), socket_factory_(socket_factory) {
- ASSERT(network_manager_ != nullptr);
- ASSERT(socket_factory_ != nullptr);
+ RTC_DCHECK(network_manager_ != nullptr);
+ RTC_DCHECK(socket_factory_ != nullptr);
Construct();
}
BasicPortAllocator::BasicPortAllocator(rtc::NetworkManager* network_manager)
: network_manager_(network_manager), socket_factory_(nullptr) {
- ASSERT(network_manager_ != nullptr);
+ RTC_DCHECK(network_manager_ != nullptr);
Construct();
}
@@ -115,7 +115,7 @@ BasicPortAllocator::BasicPortAllocator(rtc::NetworkManager* network_manager,
rtc::PacketSocketFactory* socket_factory,
const ServerAddresses& stun_servers)
: network_manager_(network_manager), socket_factory_(socket_factory) {
- ASSERT(socket_factory_ != NULL);
+ RTC_DCHECK(socket_factory_ != NULL);
SetConfiguration(stun_servers, std::vector<RelayServerConfig>(), 0, false);
Construct();
}
@@ -274,7 +274,7 @@ void BasicPortAllocatorSession::StartGettingPorts() {
}
void BasicPortAllocatorSession::StopGettingPorts() {
- ASSERT(rtc::Thread::Current() == network_thread_);
+ RTC_DCHECK(rtc::Thread::Current() == network_thread_);
ClearGettingPorts();
// Note: this must be called after ClearGettingPorts because both may set the
// session state and we should set the state to STOPPED.
@@ -282,7 +282,7 @@ void BasicPortAllocatorSession::StopGettingPorts() {
}
void BasicPortAllocatorSession::ClearGettingPorts() {
- ASSERT(rtc::Thread::Current() == network_thread_);
+ RTC_DCHECK(rtc::Thread::Current() == network_thread_);
network_thread_->Clear(this, MSG_ALLOCATE);
for (uint32_t i = 0; i < sequences_.size(); ++i) {
sequences_[i]->Stop();
@@ -435,23 +435,23 @@ bool BasicPortAllocatorSession::CandidatesAllocationDone() const {
void BasicPortAllocatorSession::OnMessage(rtc::Message *message) {
switch (message->message_id) {
case MSG_CONFIG_START:
- ASSERT(rtc::Thread::Current() == network_thread_);
+ RTC_DCHECK(rtc::Thread::Current() == network_thread_);
GetPortConfigurations();
break;
case MSG_CONFIG_READY:
- ASSERT(rtc::Thread::Current() == network_thread_);
+ RTC_DCHECK(rtc::Thread::Current() == network_thread_);
OnConfigReady(static_cast<PortConfiguration*>(message->pdata));
break;
case MSG_ALLOCATE:
- ASSERT(rtc::Thread::Current() == network_thread_);
+ RTC_DCHECK(rtc::Thread::Current() == network_thread_);
OnAllocate();
break;
case MSG_SEQUENCEOBJECTS_CREATED:
- ASSERT(rtc::Thread::Current() == network_thread_);
+ RTC_DCHECK(rtc::Thread::Current() == network_thread_);
OnAllocationSequenceObjectsCreated();
break;
case MSG_CONFIG_STOP:
- ASSERT(rtc::Thread::Current() == network_thread_);
+ RTC_DCHECK(rtc::Thread::Current() == network_thread_);
OnConfigStop();
break;
default:
@@ -491,7 +491,7 @@ void BasicPortAllocatorSession::OnConfigReady(PortConfiguration* config) {
}
void BasicPortAllocatorSession::OnConfigStop() {
- ASSERT(rtc::Thread::Current() == network_thread_);
+ RTC_DCHECK(rtc::Thread::Current() == network_thread_);
// If any of the allocated ports have not completed the candidates allocation,
// mark those as error. Since session doesn't need any new candidates
@@ -522,7 +522,7 @@ void BasicPortAllocatorSession::OnConfigStop() {
}
void BasicPortAllocatorSession::AllocatePorts() {
- ASSERT(rtc::Thread::Current() == network_thread_);
+ RTC_DCHECK(rtc::Thread::Current() == network_thread_);
network_thread_->Post(RTC_FROM_HERE, this, MSG_ALLOCATE);
}
@@ -536,7 +536,7 @@ void BasicPortAllocatorSession::OnAllocate() {
std::vector<rtc::Network*> BasicPortAllocatorSession::GetNetworks() {
std::vector<rtc::Network*> networks;
rtc::NetworkManager* network_manager = allocator_->network_manager();
- ASSERT(network_manager != nullptr);
+ RTC_DCHECK(network_manager != nullptr);
// If the network permission state is BLOCKED, we just act as if the flag has
// been passed in.
if (network_manager->enumeration_permission() ==
@@ -720,9 +720,9 @@ void BasicPortAllocatorSession::OnAllocationSequenceObjectsCreated() {
void BasicPortAllocatorSession::OnCandidateReady(
Port* port, const Candidate& c) {
- ASSERT(rtc::Thread::Current() == network_thread_);
+ RTC_DCHECK(rtc::Thread::Current() == network_thread_);
PortData* data = FindPort(port);
- ASSERT(data != NULL);
+ RTC_DCHECK(data != NULL);
LOG_J(LS_INFO, port) << "Gathered candidate: " << c.ToSensitiveString();
// Discarding any candidate signal if port allocation status is
// already done with gathering.
@@ -831,10 +831,10 @@ void BasicPortAllocatorSession::PruneAllPorts() {
}
void BasicPortAllocatorSession::OnPortComplete(Port* port) {
- ASSERT(rtc::Thread::Current() == network_thread_);
+ RTC_DCHECK(rtc::Thread::Current() == network_thread_);
LOG_J(LS_INFO, port) << "Port completed gathering candidates.";
PortData* data = FindPort(port);
- ASSERT(data != NULL);
+ RTC_DCHECK(data != NULL);
// Ignore any late signals.
if (!data->inprogress()) {
@@ -848,10 +848,10 @@ void BasicPortAllocatorSession::OnPortComplete(Port* port) {
}
void BasicPortAllocatorSession::OnPortError(Port* port) {
- ASSERT(rtc::Thread::Current() == network_thread_);
+ RTC_DCHECK(rtc::Thread::Current() == network_thread_);
LOG_J(LS_INFO, port) << "Port encountered error while gathering candidates.";
PortData* data = FindPort(port);
- ASSERT(data != NULL);
+ RTC_DCHECK(data != NULL);
// We might have already given up on this port and stopped it.
if (!data->inprogress()) {
return;
@@ -965,7 +965,7 @@ void BasicPortAllocatorSession::MaybeSignalCandidatesAllocationDone() {
void BasicPortAllocatorSession::OnPortDestroyed(
PortInterface* port) {
- ASSERT(rtc::Thread::Current() == network_thread_);
+ RTC_DCHECK(rtc::Thread::Current() == network_thread_);
for (std::vector<PortData>::iterator iter = ports_.begin();
iter != ports_.end(); ++iter) {
if (port == iter->port()) {
@@ -1123,8 +1123,8 @@ void AllocationSequence::Stop() {
}
void AllocationSequence::OnMessage(rtc::Message* msg) {
- ASSERT(rtc::Thread::Current() == session_->network_thread());
- ASSERT(msg->message_id == MSG_ALLOCATION_PHASE);
+ RTC_DCHECK(rtc::Thread::Current() == session_->network_thread());
+ RTC_DCHECK(msg->message_id == MSG_ALLOCATION_PHASE);
const char* const PHASE_NAMES[kNumPhases] = {
"Udp", "Relay", "Tcp", "SslTcp"
@@ -1292,7 +1292,7 @@ void AllocationSequence::CreateRelayPorts() {
// If BasicPortAllocatorSession::OnAllocate left relay ports enabled then we
// ought to have a relay list for them here.
- ASSERT(config_ && !config_->relays.empty());
+ RTC_DCHECK(config_ && !config_->relays.empty());
if (!(config_ && !config_->relays.empty())) {
LOG(LS_WARNING)
<< "AllocationSequence: No relay server configured, skipping.";
@@ -1393,7 +1393,7 @@ void AllocationSequence::CreateTurnPort(const RelayServerConfig& config) {
*relay_port, config.credentials, config.priority,
session_->allocator()->origin());
}
- ASSERT(port != NULL);
+ RTC_DCHECK(port != NULL);
port->SetTlsCertPolicy(config.tls_cert_policy);
session_->AddAllocatedPort(port, this, true);
}
@@ -1403,7 +1403,7 @@ void AllocationSequence::OnReadPacket(
rtc::AsyncPacketSocket* socket, const char* data, size_t size,
const rtc::SocketAddress& remote_addr,
const rtc::PacketTime& packet_time) {
- ASSERT(socket == udp_socket_.get());
+ RTC_DCHECK(socket == udp_socket_.get());
bool turn_port_found = false;
« no previous file with comments | « webrtc/p2p/client/basicportallocator.h ('k') | webrtc/p2p/client/socketmonitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698