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 #ifndef NET_QUIC_CONGESTION_CONTROL_INTER_ARRIVAL_SENDER_H_ | 5 #ifndef NET_QUIC_CONGESTION_CONTROL_INTER_ARRIVAL_SENDER_H_ |
6 #define NET_QUIC_CONGESTION_CONTROL_INTER_ARRIVAL_SENDER_H_ | 6 #define NET_QUIC_CONGESTION_CONTROL_INTER_ARRIVAL_SENDER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
11 #include "net/quic/congestion_control/channel_estimator.h" | 11 #include "net/quic/congestion_control/channel_estimator.h" |
12 #include "net/quic/congestion_control/inter_arrival_bitrate_ramp_up.h" | 12 #include "net/quic/congestion_control/inter_arrival_bitrate_ramp_up.h" |
13 #include "net/quic/congestion_control/inter_arrival_overuse_detector.h" | 13 #include "net/quic/congestion_control/inter_arrival_overuse_detector.h" |
14 #include "net/quic/congestion_control/inter_arrival_probe.h" | 14 #include "net/quic/congestion_control/inter_arrival_probe.h" |
15 #include "net/quic/congestion_control/inter_arrival_state_machine.h" | 15 #include "net/quic/congestion_control/inter_arrival_state_machine.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 #include "net/quic/quic_bandwidth.h" | 18 #include "net/quic/quic_bandwidth.h" |
19 #include "net/quic/quic_clock.h" | 19 #include "net/quic/quic_clock.h" |
20 #include "net/quic/quic_protocol.h" | 20 #include "net/quic/quic_protocol.h" |
21 #include "net/quic/quic_time.h" | 21 #include "net/quic/quic_time.h" |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 | 24 |
25 class NET_EXPORT_PRIVATE InterArrivalSender : public SendAlgorithmInterface { | 25 class NET_EXPORT_PRIVATE InterArrivalSender : public SendAlgorithmInterface { |
26 public: | 26 public: |
27 explicit InterArrivalSender(const QuicClock* clock); | 27 InterArrivalSender(const QuicClock* clock, const RttStats* rtt_stats); |
28 virtual ~InterArrivalSender(); | 28 virtual ~InterArrivalSender(); |
29 | 29 |
30 // Start implementation of SendAlgorithmInterface. | 30 // Start implementation of SendAlgorithmInterface. |
31 virtual void SetFromConfig(const QuicConfig& config, bool is_server) OVERRIDE; | 31 virtual void SetFromConfig(const QuicConfig& config, bool is_server) OVERRIDE; |
32 virtual void OnIncomingQuicCongestionFeedbackFrame( | 32 virtual void OnIncomingQuicCongestionFeedbackFrame( |
33 const QuicCongestionFeedbackFrame& feedback, | 33 const QuicCongestionFeedbackFrame& feedback, |
34 QuicTime feedback_receive_time) OVERRIDE; | 34 QuicTime feedback_receive_time) OVERRIDE; |
35 virtual void OnPacketAcked(QuicPacketSequenceNumber acked_sequence_number, | 35 virtual void OnPacketAcked(QuicPacketSequenceNumber acked_sequence_number, |
36 QuicByteCount acked_bytes) OVERRIDE; | 36 QuicByteCount acked_bytes) OVERRIDE; |
37 virtual void OnPacketLost(QuicPacketSequenceNumber sequence_number, | 37 virtual void OnPacketLost(QuicPacketSequenceNumber sequence_number, |
38 QuicTime ack_receive_time) OVERRIDE; | 38 QuicTime ack_receive_time) OVERRIDE; |
39 virtual bool OnPacketSent( | 39 virtual bool OnPacketSent( |
40 QuicTime sent_time, | 40 QuicTime sent_time, |
41 QuicPacketSequenceNumber sequence_number, | 41 QuicPacketSequenceNumber sequence_number, |
42 QuicByteCount bytes, | 42 QuicByteCount bytes, |
43 TransmissionType transmission_type, | 43 TransmissionType transmission_type, |
44 HasRetransmittableData has_retransmittable_data) OVERRIDE; | 44 HasRetransmittableData has_retransmittable_data) OVERRIDE; |
45 virtual void OnRetransmissionTimeout(bool packets_retransmitted) OVERRIDE; | 45 virtual void OnRetransmissionTimeout(bool packets_retransmitted) OVERRIDE; |
46 virtual void OnPacketAbandoned(QuicPacketSequenceNumber sequence_number, | 46 virtual void OnPacketAbandoned(QuicPacketSequenceNumber sequence_number, |
47 QuicByteCount abandoned_bytes) OVERRIDE; | 47 QuicByteCount abandoned_bytes) OVERRIDE; |
48 virtual QuicTime::Delta TimeUntilSend( | 48 virtual QuicTime::Delta TimeUntilSend( |
49 QuicTime now, | 49 QuicTime now, |
50 TransmissionType transmission_type, | 50 TransmissionType transmission_type, |
51 HasRetransmittableData has_retransmittable_data, | 51 HasRetransmittableData has_retransmittable_data, |
52 IsHandshake handshake) OVERRIDE; | 52 IsHandshake handshake) OVERRIDE; |
53 virtual QuicBandwidth BandwidthEstimate() const OVERRIDE; | 53 virtual QuicBandwidth BandwidthEstimate() const OVERRIDE; |
54 virtual void UpdateRtt(QuicTime::Delta rtt_sample) OVERRIDE; | 54 virtual void UpdateRtt(QuicTime::Delta rtt_sample) OVERRIDE; |
55 virtual QuicTime::Delta SmoothedRtt() const OVERRIDE; | |
56 virtual QuicTime::Delta RetransmissionDelay() const OVERRIDE; | 55 virtual QuicTime::Delta RetransmissionDelay() const OVERRIDE; |
57 virtual QuicByteCount GetCongestionWindow() const OVERRIDE; | 56 virtual QuicByteCount GetCongestionWindow() const OVERRIDE; |
58 // End implementation of SendAlgorithmInterface. | 57 // End implementation of SendAlgorithmInterface. |
59 | 58 |
60 private: | 59 private: |
61 class SentPacket { | 60 class SentPacket { |
62 public: | 61 public: |
63 SentPacket(QuicByteCount bytes, QuicTime timestamp) | 62 SentPacket(QuicByteCount bytes, QuicTime timestamp) |
64 : bytes_sent_(bytes), | 63 : bytes_sent_(bytes), |
65 send_timestamp_(timestamp) { } | 64 send_timestamp_(timestamp) { } |
(...skipping 22 matching lines...) Expand all Loading... |
88 void ResetCurrentBandwidth(QuicTime feedback_receive_time, | 87 void ResetCurrentBandwidth(QuicTime feedback_receive_time, |
89 QuicBandwidth new_rate); | 88 QuicBandwidth new_rate); |
90 bool ProbingPhase(QuicTime feedback_receive_time); | 89 bool ProbingPhase(QuicTime feedback_receive_time); |
91 void CleanupPacketHistory(); | 90 void CleanupPacketHistory(); |
92 | 91 |
93 // Tracks the send time and size of sent packets. Packets are | 92 // Tracks the send time and size of sent packets. Packets are |
94 // removed 5 seconds and they've been added. | 93 // removed 5 seconds and they've been added. |
95 SentPacketsMap packet_history_map_; | 94 SentPacketsMap packet_history_map_; |
96 | 95 |
97 const QuicClock* clock_; | 96 const QuicClock* clock_; |
| 97 const RttStats* rtt_stats_; |
98 bool probing_; // Are we currently in the probing phase? | 98 bool probing_; // Are we currently in the probing phase? |
99 QuicByteCount max_segment_size_; | 99 QuicByteCount max_segment_size_; |
100 QuicBandwidth current_bandwidth_; | 100 QuicBandwidth current_bandwidth_; |
101 QuicTime::Delta smoothed_rtt_; | 101 QuicTime::Delta smoothed_rtt_; |
102 scoped_ptr<ChannelEstimator> channel_estimator_; | 102 scoped_ptr<ChannelEstimator> channel_estimator_; |
103 scoped_ptr<InterArrivalBitrateRampUp> bitrate_ramp_up_; | 103 scoped_ptr<InterArrivalBitrateRampUp> bitrate_ramp_up_; |
104 scoped_ptr<InterArrivalOveruseDetector> overuse_detector_; | 104 scoped_ptr<InterArrivalOveruseDetector> overuse_detector_; |
105 scoped_ptr<InterArrivalProbe> probe_; | 105 scoped_ptr<InterArrivalProbe> probe_; |
106 scoped_ptr<InterArrivalStateMachine> state_machine_; | 106 scoped_ptr<InterArrivalStateMachine> state_machine_; |
107 scoped_ptr<PacedSender> paced_sender_; | 107 scoped_ptr<PacedSender> paced_sender_; |
108 BandwidthUsage bandwidth_usage_state_; | 108 BandwidthUsage bandwidth_usage_state_; |
109 QuicTime back_down_time_; // Time when we decided to back down. | 109 QuicTime back_down_time_; // Time when we decided to back down. |
110 QuicBandwidth back_down_bandwidth_; // Bandwidth before backing down. | 110 QuicBandwidth back_down_bandwidth_; // Bandwidth before backing down. |
111 QuicTime::Delta back_down_congestion_delay_; // Delay when backing down. | 111 QuicTime::Delta back_down_congestion_delay_; // Delay when backing down. |
112 | 112 |
113 DISALLOW_COPY_AND_ASSIGN(InterArrivalSender); | 113 DISALLOW_COPY_AND_ASSIGN(InterArrivalSender); |
114 }; | 114 }; |
115 | 115 |
116 } // namespace net | 116 } // namespace net |
117 #endif // NET_QUIC_CONGESTION_CONTROL_INTER_ARRIVAL_SENDER_H_ | 117 #endif // NET_QUIC_CONGESTION_CONTROL_INTER_ARRIVAL_SENDER_H_ |
OLD | NEW |