| 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 // A send algorithm which adds pacing on top of an another send algorithm. | 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 | 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 | 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 | 8 // resolution of the underlying alarm mechanism to ensure that alarms are |
| 9 // not set too aggressively, and to smooth out variations. | 9 // not set too aggressively, and to smooth out variations. |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 virtual ~PacingSender(); | 30 virtual ~PacingSender(); |
| 31 | 31 |
| 32 // SendAlgorithmInterface methods. | 32 // SendAlgorithmInterface methods. |
| 33 virtual void SetFromConfig(const QuicConfig& config, bool is_server) OVERRIDE; | 33 virtual void SetFromConfig(const QuicConfig& config, bool is_server) OVERRIDE; |
| 34 virtual void SetMaxPacketSize(QuicByteCount max_packet_size) OVERRIDE; | 34 virtual void SetMaxPacketSize(QuicByteCount max_packet_size) OVERRIDE; |
| 35 virtual void OnIncomingQuicCongestionFeedbackFrame( | 35 virtual void OnIncomingQuicCongestionFeedbackFrame( |
| 36 const QuicCongestionFeedbackFrame& feedback, | 36 const QuicCongestionFeedbackFrame& feedback, |
| 37 QuicTime feedback_receive_time, | 37 QuicTime feedback_receive_time, |
| 38 const SendAlgorithmInterface::SentPacketsMap& sent_packets) OVERRIDE; | 38 const SendAlgorithmInterface::SentPacketsMap& sent_packets) OVERRIDE; |
| 39 virtual void OnPacketAcked(QuicPacketSequenceNumber acked_sequence_number, | 39 virtual void OnPacketAcked(QuicPacketSequenceNumber acked_sequence_number, |
| 40 QuicByteCount acked_bytes, | 40 QuicByteCount acked_bytes) OVERRIDE; |
| 41 QuicTime::Delta rtt) OVERRIDE; | |
| 42 virtual void OnPacketLost(QuicPacketSequenceNumber sequence_number, | 41 virtual void OnPacketLost(QuicPacketSequenceNumber sequence_number, |
| 43 QuicTime ack_receive_time) OVERRIDE; | 42 QuicTime ack_receive_time) OVERRIDE; |
| 44 virtual bool OnPacketSent(QuicTime sent_time, | 43 virtual bool OnPacketSent(QuicTime sent_time, |
| 45 QuicPacketSequenceNumber sequence_number, | 44 QuicPacketSequenceNumber sequence_number, |
| 46 QuicByteCount bytes, | 45 QuicByteCount bytes, |
| 47 TransmissionType transmission_type, | 46 TransmissionType transmission_type, |
| 48 HasRetransmittableData is_retransmittable) OVERRIDE; | 47 HasRetransmittableData is_retransmittable) OVERRIDE; |
| 49 virtual void OnRetransmissionTimeout(bool packets_retransmitted) OVERRIDE; | 48 virtual void OnRetransmissionTimeout(bool packets_retransmitted) OVERRIDE; |
| 50 virtual void OnPacketAbandoned(QuicPacketSequenceNumber sequence_number, | 49 virtual void OnPacketAbandoned(QuicPacketSequenceNumber sequence_number, |
| 51 QuicByteCount abandoned_bytes) OVERRIDE; | 50 QuicByteCount abandoned_bytes) OVERRIDE; |
| 52 virtual QuicTime::Delta TimeUntilSend( | 51 virtual QuicTime::Delta TimeUntilSend( |
| 53 QuicTime now, | 52 QuicTime now, |
| 54 TransmissionType transmission_type, | 53 TransmissionType transmission_type, |
| 55 HasRetransmittableData has_retransmittable_data, | 54 HasRetransmittableData has_retransmittable_data, |
| 56 IsHandshake handshake) OVERRIDE; | 55 IsHandshake handshake) OVERRIDE; |
| 57 virtual QuicBandwidth BandwidthEstimate() const OVERRIDE; | 56 virtual QuicBandwidth BandwidthEstimate() const OVERRIDE; |
| 57 virtual void UpdateRtt(QuicTime::Delta rtt_sample) OVERRIDE; |
| 58 virtual QuicTime::Delta SmoothedRtt() const OVERRIDE; | 58 virtual QuicTime::Delta SmoothedRtt() const OVERRIDE; |
| 59 virtual QuicTime::Delta RetransmissionDelay() const OVERRIDE; | 59 virtual QuicTime::Delta RetransmissionDelay() const OVERRIDE; |
| 60 virtual QuicByteCount GetCongestionWindow() const OVERRIDE; | 60 virtual QuicByteCount GetCongestionWindow() const OVERRIDE; |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 QuicTime::Delta GetTransferTime(QuicByteCount bytes); | 63 QuicTime::Delta GetTransferTime(QuicByteCount bytes); |
| 64 | 64 |
| 65 scoped_ptr<SendAlgorithmInterface> sender_; // Underlying sender. | 65 scoped_ptr<SendAlgorithmInterface> sender_; // Underlying sender. |
| 66 QuicTime::Delta alarm_granularity_; | 66 QuicTime::Delta alarm_granularity_; |
| 67 QuicTime next_packet_send_time_; // When can the next packet be sent. | 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. | 68 bool was_last_send_delayed_; // True when the last send was delayed. |
| 69 QuicByteCount max_segment_size_; | 69 QuicByteCount max_segment_size_; |
| 70 | 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(PacingSender); | 71 DISALLOW_COPY_AND_ASSIGN(PacingSender); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 } // namespace net | 74 } // namespace net |
| 75 | 75 |
| 76 #endif // NET_QUIC_CONGESTION_CONTROL_PACING_SENDER_H_ | 76 #endif // NET_QUIC_CONGESTION_CONTROL_PACING_SENDER_H_ |
| OLD | NEW |