Add explicit |forceOnlineSignin| to user pod status
[chromium-blink-merge.git] / net / quic / congestion_control / pacing_sender.h
blobc8ffe0b05521de1c77b0dc992fa69482d889ddcd
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
3 // found in the LICENSE file.
4 //
5 // A send algorithm which adds pacing on top of an another send algorithm.
6 // It uses the underlying sender's bandwidth estimate to determine the
7 // pacing rate to be used. It also takes into consideration the expected
8 // resolution of the underlying alarm mechanism to ensure that alarms are
9 // not set too aggressively, and to smooth out variations.
11 #ifndef NET_QUIC_CONGESTION_CONTROL_PACING_SENDER_H_
12 #define NET_QUIC_CONGESTION_CONTROL_PACING_SENDER_H_
14 #include <map>
16 #include "base/basictypes.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "net/quic/congestion_control/send_algorithm_interface.h"
19 #include "net/quic/quic_bandwidth.h"
20 #include "net/quic/quic_config.h"
21 #include "net/quic/quic_protocol.h"
22 #include "net/quic/quic_time.h"
24 namespace net {
26 class NET_EXPORT_PRIVATE PacingSender : public SendAlgorithmInterface {
27 public:
28 PacingSender(SendAlgorithmInterface* sender,
29 QuicTime::Delta alarm_granularity);
30 virtual ~PacingSender();
32 // SendAlgorithmInterface methods.
33 virtual void SetFromConfig(const QuicConfig& config, bool is_server) OVERRIDE;
34 virtual void SetMaxPacketSize(QuicByteCount max_packet_size) OVERRIDE;
35 virtual void OnIncomingQuicCongestionFeedbackFrame(
36 const QuicCongestionFeedbackFrame& feedback,
37 QuicTime feedback_receive_time,
38 const SendAlgorithmInterface::SentPacketsMap& sent_packets) OVERRIDE;
39 virtual void OnPacketAcked(QuicPacketSequenceNumber acked_sequence_number,
40 QuicByteCount acked_bytes) OVERRIDE;
41 virtual void OnPacketLost(QuicPacketSequenceNumber sequence_number,
42 QuicTime ack_receive_time) OVERRIDE;
43 virtual bool OnPacketSent(QuicTime sent_time,
44 QuicPacketSequenceNumber sequence_number,
45 QuicByteCount bytes,
46 TransmissionType transmission_type,
47 HasRetransmittableData is_retransmittable) OVERRIDE;
48 virtual void OnRetransmissionTimeout(bool packets_retransmitted) OVERRIDE;
49 virtual void OnPacketAbandoned(QuicPacketSequenceNumber sequence_number,
50 QuicByteCount abandoned_bytes) OVERRIDE;
51 virtual QuicTime::Delta TimeUntilSend(
52 QuicTime now,
53 TransmissionType transmission_type,
54 HasRetransmittableData has_retransmittable_data,
55 IsHandshake handshake) OVERRIDE;
56 virtual QuicBandwidth BandwidthEstimate() const OVERRIDE;
57 virtual void UpdateRtt(QuicTime::Delta rtt_sample) OVERRIDE;
58 virtual QuicTime::Delta SmoothedRtt() const OVERRIDE;
59 virtual QuicTime::Delta RetransmissionDelay() const OVERRIDE;
60 virtual QuicByteCount GetCongestionWindow() const OVERRIDE;
62 private:
63 QuicTime::Delta GetTransferTime(QuicByteCount bytes);
65 scoped_ptr<SendAlgorithmInterface> sender_; // Underlying sender.
66 QuicTime::Delta alarm_granularity_;
67 QuicTime next_packet_send_time_; // When can the next packet be sent.
68 bool was_last_send_delayed_; // True when the last send was delayed.
69 QuicByteCount max_segment_size_;
71 DISALLOW_COPY_AND_ASSIGN(PacingSender);
74 } // namespace net
76 #endif // NET_QUIC_CONGESTION_CONTROL_PACING_SENDER_H_