#ifndef NET_QUIC_CONGESTION_CONTROL_PACING_SENDER_H_
#define NET_QUIC_CONGESTION_CONTROL_PACING_SENDER_H_
#include <map>
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "net/quic/congestion_control/send_algorithm_interface.h"
#include "net/quic/quic_bandwidth.h"
#include "net/quic/quic_config.h"
#include "net/quic/quic_protocol.h"
#include "net/quic/quic_time.h"
namespace net {
class NET_EXPORT_PRIVATE PacingSender : public SendAlgorithmInterface {
public:
PacingSender(SendAlgorithmInterface* sender,
QuicTime::Delta alarm_granularity);
virtual ~PacingSender();
virtual void SetFromConfig(const QuicConfig& config, bool is_server) OVERRIDE;
virtual void OnIncomingQuicCongestionFeedbackFrame(
const QuicCongestionFeedbackFrame& feedback,
QuicTime feedback_receive_time) OVERRIDE;
virtual void OnPacketAcked(QuicPacketSequenceNumber acked_sequence_number,
QuicByteCount acked_bytes) OVERRIDE;
virtual void OnPacketLost(QuicPacketSequenceNumber sequence_number,
QuicTime ack_receive_time) OVERRIDE;
virtual bool OnPacketSent(QuicTime sent_time,
QuicPacketSequenceNumber sequence_number,
QuicByteCount bytes,
HasRetransmittableData is_retransmittable) OVERRIDE;
virtual void OnRetransmissionTimeout(bool packets_retransmitted) OVERRIDE;
virtual void OnPacketAbandoned(QuicPacketSequenceNumber sequence_number,
QuicByteCount abandoned_bytes) OVERRIDE;
virtual QuicTime::Delta TimeUntilSend(
QuicTime now,
HasRetransmittableData has_retransmittable_data) OVERRIDE;
virtual QuicBandwidth BandwidthEstimate() const OVERRIDE;
virtual void UpdateRtt(QuicTime::Delta rtt_sample) OVERRIDE;
virtual QuicTime::Delta RetransmissionDelay() const OVERRIDE;
virtual QuicByteCount GetCongestionWindow() const OVERRIDE;
private:
scoped_ptr<SendAlgorithmInterface> sender_;
QuicTime::Delta alarm_granularity_;
QuicTime next_packet_send_time_;
bool was_last_send_delayed_;
bool updated_rtt_;
DISALLOW_COPY_AND_ASSIGN(PacingSender);
};
}
#endif