| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 // Fix rate send side congestion control, used for testing. | 5 // Fix rate send side congestion control, used for testing. |
| 6 | 6 |
| 7 #ifndef NET_QUIC_CONGESTION_CONTROL_FIX_RATE_SENDER_H_ | 7 #ifndef NET_QUIC_CONGESTION_CONTROL_FIX_RATE_SENDER_H_ |
| 8 #define NET_QUIC_CONGESTION_CONTROL_FIX_RATE_SENDER_H_ | 8 #define NET_QUIC_CONGESTION_CONTROL_FIX_RATE_SENDER_H_ |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
| 13 #include "net/quic/quic_clock.h" | 13 #include "net/quic/quic_clock.h" |
| 14 #include "net/quic/quic_time.h" | 14 #include "net/quic/quic_time.h" |
| 15 #include "net/quic/congestion_control/leaky_bucket.h" | 15 #include "net/quic/congestion_control/leaky_bucket.h" |
| 16 #include "net/quic/congestion_control/paced_sender.h" | 16 #include "net/quic/congestion_control/paced_sender.h" |
| 17 #include "net/quic/congestion_control/send_algorithm_interface.h" | 17 #include "net/quic/congestion_control/send_algorithm_interface.h" |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 | 20 |
| 21 namespace test { | 21 class NET_EXPORT_PRIVATE FixRateSender : public SendAlgorithmInterface { |
| 22 class FixRateSenderPeer; | |
| 23 } // namespace test | |
| 24 | 22 |
| 25 class NET_EXPORT_PRIVATE FixRateSender : public SendAlgorithmInterface { | |
| 26 public: | 23 public: |
| 27 explicit FixRateSender(const QuicClock* clock); | 24 explicit FixRateSender(const QuicClock* clock); |
| 28 | 25 |
| 29 // Start implementation of SendAlgorithmInterface. | 26 // Start implementation of SendAlgorithmInterface. |
| 30 virtual void OnIncomingQuicCongestionFeedbackFrame( | 27 virtual void OnIncomingQuicCongestionFeedbackFrame( |
| 31 const QuicCongestionFeedbackFrame& feedback, | 28 const QuicCongestionFeedbackFrame& feedback, |
| 29 QuicTime feedback_receive_time, |
| 30 QuicBandwidth sent_bandwidth, |
| 32 const SentPacketsMap& sent_packets) OVERRIDE; | 31 const SentPacketsMap& sent_packets) OVERRIDE; |
| 33 virtual void OnIncomingAck(QuicPacketSequenceNumber acked_sequence_number, | 32 virtual void OnIncomingAck(QuicPacketSequenceNumber acked_sequence_number, |
| 34 QuicByteCount acked_bytes, | 33 QuicByteCount acked_bytes, |
| 35 QuicTime::Delta rtt) OVERRIDE; | 34 QuicTime::Delta rtt) OVERRIDE; |
| 36 virtual void OnIncomingLoss(int number_of_lost_packets) OVERRIDE; | 35 virtual void OnIncomingLoss(QuicTime ack_receive_time) OVERRIDE; |
| 37 virtual void SentPacket(QuicPacketSequenceNumber equence_number, | 36 virtual void SentPacket(QuicTime sent_time, |
| 37 QuicPacketSequenceNumber equence_number, |
| 38 QuicByteCount bytes, | 38 QuicByteCount bytes, |
| 39 bool is_retransmission) OVERRIDE; | 39 bool is_retransmission) OVERRIDE; |
| 40 virtual QuicTime::Delta TimeUntilSend(bool is_retransmission) OVERRIDE; | 40 virtual QuicTime::Delta TimeUntilSend(QuicTime now, |
| 41 bool is_retransmission) OVERRIDE; |
| 41 virtual QuicBandwidth BandwidthEstimate() OVERRIDE; | 42 virtual QuicBandwidth BandwidthEstimate() OVERRIDE; |
| 42 // End implementation of SendAlgorithmInterface. | 43 // End implementation of SendAlgorithmInterface. |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 friend class test::FixRateSenderPeer; | |
| 46 | |
| 47 QuicByteCount AvailableCongestionWindow(); | |
| 48 QuicByteCount CongestionWindow(); | 46 QuicByteCount CongestionWindow(); |
| 49 | 47 |
| 50 QuicBandwidth bitrate_; | 48 QuicBandwidth bitrate_; |
| 51 LeakyBucket fix_rate_leaky_bucket_; | 49 LeakyBucket fix_rate_leaky_bucket_; |
| 52 PacedSender paced_sender_; | 50 PacedSender paced_sender_; |
| 53 QuicByteCount data_in_flight_; | 51 QuicByteCount data_in_flight_; |
| 54 | 52 |
| 55 DISALLOW_COPY_AND_ASSIGN(FixRateSender); | 53 DISALLOW_COPY_AND_ASSIGN(FixRateSender); |
| 56 }; | 54 }; |
| 57 | 55 |
| 58 } // namespace net | 56 } // namespace net |
| 59 | 57 |
| 60 #endif // NET_QUIC_CONGESTION_CONTROL_FIX_RATE_SENDER_H_ | 58 #endif // NET_QUIC_CONGESTION_CONTROL_FIX_RATE_SENDER_H_ |
| OLD | NEW |