| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "net/quic/congestion_control/pacing_sender.h" | 5 #include "net/quic/congestion_control/pacing_sender.h" |
| 6 | 6 |
| 7 using std::min; | 7 using std::min; |
| 8 | 8 |
| 9 namespace net { | 9 namespace net { |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 72 } |
| 73 if (burst_tokens_ > 0) { | 73 if (burst_tokens_ > 0) { |
| 74 --burst_tokens_; | 74 --burst_tokens_; |
| 75 was_last_send_delayed_ = false; | 75 was_last_send_delayed_ = false; |
| 76 last_delayed_packet_sent_time_ = QuicTime::Zero(); | 76 last_delayed_packet_sent_time_ = QuicTime::Zero(); |
| 77 ideal_next_packet_send_time_ = QuicTime::Zero(); | 77 ideal_next_packet_send_time_ = QuicTime::Zero(); |
| 78 return in_flight; | 78 return in_flight; |
| 79 } | 79 } |
| 80 // The next packet should be sent as soon as the current packets has been | 80 // The next packet should be sent as soon as the current packets has been |
| 81 // transferred. | 81 // transferred. |
| 82 QuicTime::Delta delay = PacingRate().TransferTime(bytes); | 82 QuicTime::Delta delay = sender_->PacingRate().TransferTime(bytes); |
| 83 // If the last send was delayed, and the alarm took a long time to get | 83 // If the last send was delayed, and the alarm took a long time to get |
| 84 // invoked, allow the connection to make up for lost time. | 84 // invoked, allow the connection to make up for lost time. |
| 85 if (was_last_send_delayed_) { | 85 if (was_last_send_delayed_) { |
| 86 ideal_next_packet_send_time_ = ideal_next_packet_send_time_.Add(delay); | 86 ideal_next_packet_send_time_ = ideal_next_packet_send_time_.Add(delay); |
| 87 // The send was application limited if it takes longer than the | 87 // The send was application limited if it takes longer than the |
| 88 // pacing delay between sent packets. | 88 // pacing delay between sent packets. |
| 89 const bool application_limited = | 89 const bool application_limited = |
| 90 last_delayed_packet_sent_time_.IsInitialized() && | 90 last_delayed_packet_sent_time_.IsInitialized() && |
| 91 sent_time > last_delayed_packet_sent_time_.Add(delay); | 91 sent_time > last_delayed_packet_sent_time_.Add(delay); |
| 92 const bool making_up_for_lost_time = | 92 const bool making_up_for_lost_time = |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 QuicByteCount PacingSender::GetSlowStartThreshold() const { | 177 QuicByteCount PacingSender::GetSlowStartThreshold() const { |
| 178 return sender_->GetSlowStartThreshold(); | 178 return sender_->GetSlowStartThreshold(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 CongestionControlType PacingSender::GetCongestionControlType() const { | 181 CongestionControlType PacingSender::GetCongestionControlType() const { |
| 182 return sender_->GetCongestionControlType(); | 182 return sender_->GetCongestionControlType(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace net | 185 } // namespace net |
| OLD | NEW |