OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 | 5 |
6 #include "net/quic/congestion_control/quic_send_scheduler.h" | 6 #include "net/quic/congestion_control/quic_send_scheduler.h" |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <cmath> | 9 #include <cmath> |
10 #include <map> | 10 #include <map> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 | 80 |
81 void QuicSendScheduler::OnIncomingQuicCongestionFeedbackFrame( | 81 void QuicSendScheduler::OnIncomingQuicCongestionFeedbackFrame( |
82 const QuicCongestionFeedbackFrame& congestion_feedback_frame) { | 82 const QuicCongestionFeedbackFrame& congestion_feedback_frame) { |
83 send_algorithm_->OnIncomingQuicCongestionFeedbackFrame( | 83 send_algorithm_->OnIncomingQuicCongestionFeedbackFrame( |
84 congestion_feedback_frame); | 84 congestion_feedback_frame); |
85 } | 85 } |
86 | 86 |
87 void QuicSendScheduler::OnIncomingAckFrame(const QuicAckFrame& ack_frame) { | 87 void QuicSendScheduler::OnIncomingAckFrame(const QuicAckFrame& ack_frame) { |
88 // We want to. | 88 // We want to. |
89 // * Get all packets lower(including) than largest_received | 89 // * Get all packets lower(including) than largest_observed |
90 // from pending_packets_. | 90 // from pending_packets_. |
91 // * Remove all missing packets. | 91 // * Remove all missing packets. |
92 // * Send each ACK in the list to send_algorithm_. | 92 // * Send each ACK in the list to send_algorithm_. |
93 QuicTime last_timestamp(QuicTime::FromMicroseconds(0)); | 93 QuicTime last_timestamp(QuicTime::FromMicroseconds(0)); |
94 map<QuicPacketSequenceNumber, size_t> acked_packets; | 94 map<QuicPacketSequenceNumber, size_t> acked_packets; |
95 | 95 |
96 PendingPacketsMap::iterator it, it_upper; | 96 PendingPacketsMap::iterator it, it_upper; |
97 it = pending_packets_.begin(); | 97 it = pending_packets_.begin(); |
98 it_upper = pending_packets_.upper_bound( | 98 it_upper = pending_packets_.upper_bound( |
99 ack_frame.received_info.largest_received); | 99 ack_frame.received_info.largest_observed); |
100 | 100 |
101 while (it != it_upper) { | 101 while (it != it_upper) { |
102 QuicPacketSequenceNumber sequence_number = it->first; | 102 QuicPacketSequenceNumber sequence_number = it->first; |
103 if (!ack_frame.received_info.IsAwaitingPacket(sequence_number)) { | 103 if (!ack_frame.received_info.IsAwaitingPacket(sequence_number)) { |
104 // Not missing, hence implicitly acked. | 104 // Not missing, hence implicitly acked. |
105 scoped_ptr<PendingPacket> pending_packet_cleaner(it->second); | 105 scoped_ptr<PendingPacket> pending_packet_cleaner(it->second); |
106 acked_packets[sequence_number] = pending_packet_cleaner->BytesSent(); | 106 acked_packets[sequence_number] = pending_packet_cleaner->BytesSent(); |
107 last_timestamp = pending_packet_cleaner->SendTimestamp(); | 107 last_timestamp = pending_packet_cleaner->SendTimestamp(); |
108 pending_packets_.erase(it++); // Must be incremented post to work. | 108 pending_packets_.erase(it++); // Must be incremented post to work. |
109 } else { | 109 } else { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 int QuicSendScheduler::PeakSustainedBandwidth() { | 181 int QuicSendScheduler::PeakSustainedBandwidth() { |
182 // To make sure that we get the latest estimate we call SentBandwidth. | 182 // To make sure that we get the latest estimate we call SentBandwidth. |
183 if (HasSentPacket()) { | 183 if (HasSentPacket()) { |
184 SentBandwidth(); | 184 SentBandwidth(); |
185 } | 185 } |
186 return max_estimated_bandwidth_; | 186 return max_estimated_bandwidth_; |
187 } | 187 } |
188 | 188 |
189 } // namespace net | 189 } // namespace net |
OLD | NEW |