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
3 // found in the LICENSE file.
5 // Helper class that limits the congestion window to pace the packets.
7 #ifndef NET_QUIC_CONGESTION_CONTROL_PACED_SENDER_H_
8 #define NET_QUIC_CONGESTION_CONTROL_PACED_SENDER_H_
10 #include "base/basictypes.h"
11 #include "net/base/net_export.h"
12 #include "net/quic/congestion_control/leaky_bucket.h"
13 #include "net/quic/quic_bandwidth.h"
14 #include "net/quic/quic_time.h"
18 class NET_EXPORT_PRIVATE PacedSender
{
20 PacedSender(QuicBandwidth bandwidth_estimate
, QuicByteCount max_segment_size
);
22 void set_max_segment_size(QuicByteCount max_segment_size
);
24 // The estimated bandidth from the congestion algorithm changed.
25 void UpdateBandwidthEstimate(QuicTime now
, QuicBandwidth bandwidth_estimate
);
27 // A packet of size bytes was sent.
28 void OnPacketSent(QuicTime now
, QuicByteCount bytes
);
30 // Return time until we can send based on the pacing.
31 QuicTime::Delta
TimeUntilSend(QuicTime now
, QuicTime::Delta time_until_send
);
34 // Helper object to track the rate data can leave the buffer for pacing.
35 LeakyBucket leaky_bucket_
;
37 QuicByteCount max_segment_size_
;
39 DISALLOW_COPY_AND_ASSIGN(PacedSender
);
44 #endif // NET_QUIC_CONGESTION_CONTROL_PACED_SENDER_H_