Index: net/quic/core/congestion_control/pacing_sender.cc |
diff --git a/net/quic/core/congestion_control/pacing_sender.cc b/net/quic/core/congestion_control/pacing_sender.cc |
index a292103f4024711743812ef85f857a7bba0b60af..308c608b2d0497065916b2010a013efb3860ad4c 100644 |
--- a/net/quic/core/congestion_control/pacing_sender.cc |
+++ b/net/quic/core/congestion_control/pacing_sender.cc |
@@ -11,32 +11,20 @@ |
using std::min; |
namespace net { |
-namespace { |
-// The estimated system alarm granularity. |
-static const QuicTime::Delta kAlarmGranularity = |
- QuicTime::Delta::FromMilliseconds(1); |
- |
-// Configured maximum size of the burst coming out of quiescence. The burst |
-// is never larger than the current CWND in packets. |
-static const uint32_t kInitialUnpacedBurst = 10; |
- |
-} // namespace |
- |
-PacingSender::PacingSender() |
- : sender_(nullptr), |
+PacingSender::PacingSender(SendAlgorithmInterface* sender, |
+ QuicTime::Delta alarm_granularity, |
+ uint32_t initial_packet_burst) |
+ : sender_(sender), |
+ alarm_granularity_(alarm_granularity), |
+ initial_packet_burst_(initial_packet_burst), |
max_pacing_rate_(QuicBandwidth::Zero()), |
- burst_tokens_(kInitialUnpacedBurst), |
+ burst_tokens_(initial_packet_burst), |
last_delayed_packet_sent_time_(QuicTime::Zero()), |
ideal_next_packet_send_time_(QuicTime::Zero()), |
- was_last_send_delayed_(false), |
- owns_sender_(false) {} |
+ was_last_send_delayed_(false) {} |
-PacingSender::~PacingSender() { |
- if (owns_sender_) { |
- delete sender_; |
- } |
-} |
+PacingSender::~PacingSender() {} |
void PacingSender::SetFromConfig(const QuicConfig& config, |
Perspective perspective) { |
@@ -58,14 +46,6 @@ void PacingSender::SetMaxPacingRate(QuicBandwidth max_pacing_rate) { |
max_pacing_rate_ = max_pacing_rate; |
} |
-void PacingSender::SetSender(SendAlgorithmInterface* sender, bool owns_sender) { |
- if (owns_sender_) { |
- delete sender_; |
- } |
- sender_ = sender; |
- owns_sender_ = owns_sender; |
-} |
- |
void PacingSender::OnCongestionEvent(bool rtt_updated, |
QuicByteCount bytes_in_flight, |
const CongestionVector& acked_packets, |
@@ -96,7 +76,7 @@ bool PacingSender::OnPacketSent( |
// limit it to the equivalent of a single bulk write, not exceeding the |
// current CWND in packets. |
burst_tokens_ = min( |
- kInitialUnpacedBurst, |
+ initial_packet_burst_, |
static_cast<uint32_t>(sender_->GetCongestionWindow() / kDefaultTCPMSS)); |
} |
if (burst_tokens_ > 0) { |
@@ -162,7 +142,7 @@ QuicTime::Delta PacingSender::TimeUntilSend( |
} |
// If the next send time is within the alarm granularity, send immediately. |
- if (ideal_next_packet_send_time_ > now + kAlarmGranularity) { |
+ if (ideal_next_packet_send_time_ > now + alarm_granularity_) { |
DVLOG(1) << "Delaying packet: " |
<< (ideal_next_packet_send_time_ - now).ToMicroseconds(); |
was_last_send_delayed_ = true; |