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

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

Issue 2019423006: Adding more detail to MessageQueue::Dispatch logging. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing one more place where RTC_FROM_HERE wasn't used. Created 4 years, 6 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 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 void P2PTransportChannel::Connect() { 448 void P2PTransportChannel::Connect() {
449 ASSERT(worker_thread_ == rtc::Thread::Current()); 449 ASSERT(worker_thread_ == rtc::Thread::Current());
450 if (ice_ufrag_.empty() || ice_pwd_.empty()) { 450 if (ice_ufrag_.empty() || ice_pwd_.empty()) {
451 ASSERT(false); 451 ASSERT(false);
452 LOG(LS_ERROR) << "P2PTransportChannel::Connect: The ice_ufrag_ and the " 452 LOG(LS_ERROR) << "P2PTransportChannel::Connect: The ice_ufrag_ and the "
453 << "ice_pwd_ are not set."; 453 << "ice_pwd_ are not set.";
454 return; 454 return;
455 } 455 }
456 456
457 // Start checking and pinging as the ports come in. 457 // Start checking and pinging as the ports come in.
458 thread()->Post(this, MSG_CHECK_AND_PING); 458 thread()->Post(RTC_FROM_HERE, this, MSG_CHECK_AND_PING);
459 } 459 }
460 460
461 void P2PTransportChannel::MaybeStartGathering() { 461 void P2PTransportChannel::MaybeStartGathering() {
462 // Start gathering if we never started before, or if an ICE restart occurred. 462 // Start gathering if we never started before, or if an ICE restart occurred.
463 if (allocator_sessions_.empty() || 463 if (allocator_sessions_.empty() ||
464 IceCredentialsChanged(allocator_sessions_.back()->ice_ufrag(), 464 IceCredentialsChanged(allocator_sessions_.back()->ice_ufrag(),
465 allocator_sessions_.back()->ice_pwd(), ice_ufrag_, 465 allocator_sessions_.back()->ice_pwd(), ice_ufrag_,
466 ice_pwd_)) { 466 ice_pwd_)) {
467 if (gathering_state_ != kIceGatheringGathering) { 467 if (gathering_state_ != kIceGatheringGathering) {
468 gathering_state_ = kIceGatheringGathering; 468 gathering_state_ = kIceGatheringGathering;
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 1051
1052 // We need to copy the list of connections since some may delete themselves 1052 // We need to copy the list of connections since some may delete themselves
1053 // when we call UpdateState. 1053 // when we call UpdateState.
1054 for (size_t i = 0; i < connections_.size(); ++i) 1054 for (size_t i = 0; i < connections_.size(); ++i)
1055 connections_[i]->UpdateState(now); 1055 connections_[i]->UpdateState(now);
1056 } 1056 }
1057 1057
1058 // Prepare for best candidate sorting. 1058 // Prepare for best candidate sorting.
1059 void P2PTransportChannel::RequestSort() { 1059 void P2PTransportChannel::RequestSort() {
1060 if (!sort_dirty_) { 1060 if (!sort_dirty_) {
1061 worker_thread_->Post(this, MSG_SORT); 1061 worker_thread_->Post(RTC_FROM_HERE, this, MSG_SORT);
1062 sort_dirty_ = true; 1062 sort_dirty_ = true;
1063 } 1063 }
1064 } 1064 }
1065 1065
1066 // Sort the available connections to find the best one. We also monitor 1066 // Sort the available connections to find the best one. We also monitor
1067 // the number of available connections and the current state. 1067 // the number of available connections and the current state.
1068 void P2PTransportChannel::SortConnections() { 1068 void P2PTransportChannel::SortConnections() {
1069 ASSERT(worker_thread_ == rtc::Thread::Current()); 1069 ASSERT(worker_thread_ == rtc::Thread::Current());
1070 1070
1071 // Make sure the connection states are up-to-date since this affects how they 1071 // Make sure the connection states are up-to-date since this affects how they
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 ? weak_ping_interval_ 1334 ? weak_ping_interval_
1335 : STRONG_PING_INTERVAL; 1335 : STRONG_PING_INTERVAL;
1336 if (rtc::TimeMillis() >= last_ping_sent_ms_ + ping_interval) { 1336 if (rtc::TimeMillis() >= last_ping_sent_ms_ + ping_interval) {
1337 Connection* conn = FindNextPingableConnection(); 1337 Connection* conn = FindNextPingableConnection();
1338 if (conn) { 1338 if (conn) {
1339 PingConnection(conn); 1339 PingConnection(conn);
1340 MarkConnectionPinged(conn); 1340 MarkConnectionPinged(conn);
1341 } 1341 }
1342 } 1342 }
1343 int delay = std::min(ping_interval, check_receiving_interval_); 1343 int delay = std::min(ping_interval, check_receiving_interval_);
1344 thread()->PostDelayed(delay, this, MSG_CHECK_AND_PING); 1344 thread()->PostDelayed(RTC_FROM_HERE, delay, this, MSG_CHECK_AND_PING);
1345 } 1345 }
1346 1346
1347 // A connection is considered a backup connection if the channel state 1347 // A connection is considered a backup connection if the channel state
1348 // is completed, the connection is not the best connection and it is active. 1348 // is completed, the connection is not the best connection and it is active.
1349 bool P2PTransportChannel::IsBackupConnection(Connection* conn) const { 1349 bool P2PTransportChannel::IsBackupConnection(Connection* conn) const {
1350 return state_ == STATE_COMPLETED && conn != best_connection_ && 1350 return state_ == STATE_COMPLETED && conn != best_connection_ &&
1351 conn->active(); 1351 conn->active();
1352 } 1352 }
1353 1353
1354 // Is the connection in a state for us to even consider pinging the other side? 1354 // Is the connection in a state for us to even consider pinging the other side?
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 1688
1689 // During the initial state when nothing has been pinged yet, return the first 1689 // During the initial state when nothing has been pinged yet, return the first
1690 // one in the ordered |connections_|. 1690 // one in the ordered |connections_|.
1691 return *(std::find_if(connections_.begin(), connections_.end(), 1691 return *(std::find_if(connections_.begin(), connections_.end(),
1692 [conn1, conn2](Connection* conn) { 1692 [conn1, conn2](Connection* conn) {
1693 return conn == conn1 || conn == conn2; 1693 return conn == conn1 || conn == conn2;
1694 })); 1694 }));
1695 } 1695 }
1696 1696
1697 } // namespace cricket 1697 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/faketransportcontroller.h ('k') | webrtc/p2p/base/p2ptransportchannel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698