Chromium Code Reviews| Index: webrtc/p2p/base/p2ptransportchannel.cc |
| diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc |
| index 1b7cb58756e0dc11bcc5abf63621c6787ef7380a..b50d8c0b46a16aa9d49f44bdeaf80c35b1bd5937 100644 |
| --- a/webrtc/p2p/base/p2ptransportchannel.cc |
| +++ b/webrtc/p2p/base/p2ptransportchannel.cc |
| @@ -30,18 +30,18 @@ enum { MSG_SORT = 1, MSG_CHECK_AND_PING }; |
| // we don't want to degrade the quality on a modem. These numbers should work |
| // well on a 28.8K modem, which is the slowest connection on which the voice |
| // quality is reasonable at all. |
| -static const uint32 PING_PACKET_SIZE = 60 * 8; |
| +static const uint32_t PING_PACKET_SIZE = 60 * 8; |
| // STRONG_PING_DELAY (480ms) is applied when the best connection is both |
| // writable and receiving. |
| -static const uint32 STRONG_PING_DELAY = 1000 * PING_PACKET_SIZE / 1000; |
| +static const uint32_t STRONG_PING_DELAY = 1000 * PING_PACKET_SIZE / 1000; |
| // WEAK_PING_DELAY (48ms) is applied when the best connection is either not |
| // writable or not receiving. |
| -static const uint32 WEAK_PING_DELAY = 1000 * PING_PACKET_SIZE / 10000; |
| +static const uint32_t WEAK_PING_DELAY = 1000 * PING_PACKET_SIZE / 10000; |
| // If the current best connection is both writable and receiving, then we will |
| // also try hard to make sure it is pinged at this rate (a little less than |
| // 2 * STRONG_PING_DELAY). |
| -static const uint32 MAX_CURRENT_STRONG_DELAY = 900; |
| +static const uint32_t MAX_CURRENT_STRONG_DELAY = 900; |
| static const int MIN_CHECK_RECEIVING_DELAY = 50; // ms |
| @@ -225,14 +225,14 @@ P2PTransportChannel::P2PTransportChannel(const std::string& transport_name, |
| P2PTransportChannel::~P2PTransportChannel() { |
| ASSERT(worker_thread_ == rtc::Thread::Current()); |
| - for (uint32 i = 0; i < allocator_sessions_.size(); ++i) |
| + for (uint32_t i = 0; i < allocator_sessions_.size(); ++i) |
| delete allocator_sessions_[i]; |
| } |
| // Add the allocator session to our list so that we know which sessions |
| // are still active. |
| void P2PTransportChannel::AddAllocatorSession(PortAllocatorSession* session) { |
| - session->set_generation(static_cast<uint32>(allocator_sessions_.size())); |
| + session->set_generation(static_cast<uint32_t>(allocator_sessions_.size())); |
| allocator_sessions_.push_back(session); |
| // We now only want to apply new candidates that we receive to the ports |
| @@ -275,7 +275,7 @@ void P2PTransportChannel::SetIceRole(IceRole ice_role) { |
| } |
| } |
| -void P2PTransportChannel::SetIceTiebreaker(uint64 tiebreaker) { |
| +void P2PTransportChannel::SetIceTiebreaker(uint64_t tiebreaker) { |
| ASSERT(worker_thread_ == rtc::Thread::Current()); |
| if (!ports_.empty()) { |
| LOG(LS_ERROR) |
| @@ -553,7 +553,7 @@ void P2PTransportChannel::OnUnknownAddress( |
| // The foundation of the candidate is set to an arbitrary value, different |
| // from the foundation for all other remote candidates. |
| remote_candidate.set_foundation( |
| - rtc::ToString<uint32>(rtc::ComputeCrc32(remote_candidate.id()))); |
| + rtc::ToString<uint32_t>(rtc::ComputeCrc32(remote_candidate.id()))); |
| remote_candidate.set_priority(remote_candidate_priority); |
| } |
| @@ -638,7 +638,7 @@ void P2PTransportChannel::OnNominated(Connection* conn) { |
| void P2PTransportChannel::AddRemoteCandidate(const Candidate& candidate) { |
| ASSERT(worker_thread_ == rtc::Thread::Current()); |
| - uint32 generation = candidate.generation(); |
| + uint32_t generation = candidate.generation(); |
| // Network may not guarantee the order of the candidate delivery. If a |
| // remote candidate with an older generation arrives, drop it. |
| if (generation != 0 && generation < remote_candidate_generation_) { |
| @@ -765,7 +765,7 @@ bool P2PTransportChannel::FindConnection( |
| return citer != connections_.end(); |
| } |
| -uint32 P2PTransportChannel::GetRemoteCandidateGeneration( |
| +uint32_t P2PTransportChannel::GetRemoteCandidateGeneration( |
| const Candidate& candidate) { |
| // We need to keep track of the remote ice restart so newer |
| // connections are prioritized over the older. |
| @@ -777,7 +777,7 @@ uint32 P2PTransportChannel::GetRemoteCandidateGeneration( |
| // Check if remote candidate is already cached. |
| bool P2PTransportChannel::IsDuplicateRemoteCandidate( |
| const Candidate& candidate) { |
| - for (uint32 i = 0; i < remote_candidates_.size(); ++i) { |
| + for (uint32_t i = 0; i < remote_candidates_.size(); ++i) { |
| if (remote_candidates_[i].IsEquivalent(candidate)) { |
| return true; |
| } |
| @@ -790,7 +790,7 @@ void P2PTransportChannel::RememberRemoteCandidate( |
| const Candidate& remote_candidate, PortInterface* origin_port) { |
| // Remove any candidates whose generation is older than this one. The |
| // presence of a new generation indicates that the old ones are not useful. |
| - uint32 i = 0; |
| + uint32_t i = 0; |
| while (i < remote_candidates_.size()) { |
| if (remote_candidates_[i].generation() < remote_candidate.generation()) { |
| LOG(INFO) << "Pruning candidate from old generation: " |
| @@ -824,7 +824,7 @@ int P2PTransportChannel::SetOption(rtc::Socket::Option opt, int value) { |
| it->second = value; |
| } |
| - for (uint32 i = 0; i < ports_.size(); ++i) { |
| + for (uint32_t i = 0; i < ports_.size(); ++i) { |
| int val = ports_[i]->SetOption(opt, value); |
| if (val < 0) { |
| // Because this also occurs deferred, probably no point in reporting an |
| @@ -911,11 +911,11 @@ rtc::DiffServCodePoint P2PTransportChannel::DefaultDscpValue() const { |
| // Monitor connection states. |
| void P2PTransportChannel::UpdateConnectionStates() { |
| - uint32 now = rtc::Time(); |
| + uint32_t now = rtc::Time(); |
| // We need to copy the list of connections since some may delete themselves |
| // when we call UpdateState. |
| - for (uint32 i = 0; i < connections_.size(); ++i) |
| + for (uint32_t i = 0; i < connections_.size(); ++i) |
| connections_[i]->UpdateState(now); |
| } |
| @@ -947,7 +947,7 @@ void P2PTransportChannel::SortConnections() { |
| std::stable_sort(connections_.begin(), connections_.end(), cmp); |
| LOG(LS_VERBOSE) << "Sorting " << connections_.size() |
| << " available connections:"; |
| - for (uint32 i = 0; i < connections_.size(); ++i) { |
| + for (size_t i = 0; i < connections_.size(); ++i) { |
|
the sun
2015/10/06 11:23:54
size_t here and uint32_t in other loops? Consisten
pbos-webrtc
2015/10/06 11:55:12
Done.
|
| LOG(LS_VERBOSE) << connections_[i]->ToString(); |
| } |
| @@ -971,7 +971,7 @@ void P2PTransportChannel::SortConnections() { |
| // Check if all connections are timedout. |
| bool all_connections_timedout = true; |
| - for (uint32 i = 0; i < connections_.size(); ++i) { |
| + for (uint32_t i = 0; i < connections_.size(); ++i) { |
| if (connections_[i]->write_state() != Connection::STATE_WRITE_TIMEOUT) { |
| all_connections_timedout = false; |
| break; |
| @@ -1120,7 +1120,7 @@ Connection* P2PTransportChannel::GetBestConnectionOnNetwork( |
| return best_connection_; |
| // Otherwise, we return the top-most in sorted order. |
| - for (uint32 i = 0; i < connections_.size(); ++i) { |
| + for (uint32_t i = 0; i < connections_.size(); ++i) { |
| if (connections_[i]->port()->Network() == network) |
| return connections_[i]; |
| } |
| @@ -1198,7 +1198,7 @@ bool P2PTransportChannel::IsPingable(Connection* conn) { |
| // reconnecting. The newly created connection should be selected as the ping |
| // target to become writable instead. See the big comment in CompareConnections. |
| Connection* P2PTransportChannel::FindNextPingableConnection() { |
| - uint32 now = rtc::Time(); |
| + uint32_t now = rtc::Time(); |
| if (best_connection_ && best_connection_->connected() && |
| best_connection_->writable() && |
| (best_connection_->last_ping_sent() + MAX_CURRENT_STRONG_DELAY <= now)) { |