| 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 // The pure virtual class for send side congestion control algorithm. | 5 // The pure virtual class for send side congestion control algorithm. |
| 6 | 6 |
| 7 #ifndef NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_INTERFACE_H_ | 7 #ifndef NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_INTERFACE_H_ |
| 8 #define NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_INTERFACE_H_ | 8 #define NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_INTERFACE_H_ |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <map> | 11 #include <map> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
| 15 #include "net/quic/quic_bandwidth.h" | 15 #include "net/quic/quic_bandwidth.h" |
| 16 #include "net/quic/quic_clock.h" | 16 #include "net/quic/quic_clock.h" |
| 17 #include "net/quic/quic_config.h" | 17 #include "net/quic/quic_config.h" |
| 18 #include "net/quic/quic_connection_stats.h" | 18 #include "net/quic/quic_connection_stats.h" |
| 19 #include "net/quic/quic_protocol.h" | 19 #include "net/quic/quic_protocol.h" |
| 20 #include "net/quic/quic_time.h" | 20 #include "net/quic/quic_time.h" |
| 21 | 21 |
| 22 namespace net { | 22 namespace net { |
| 23 | 23 |
| 24 class RttStats; |
| 25 |
| 24 class NET_EXPORT_PRIVATE SendAlgorithmInterface { | 26 class NET_EXPORT_PRIVATE SendAlgorithmInterface { |
| 25 public: | 27 public: |
| 26 static SendAlgorithmInterface* Create(const QuicClock* clock, | 28 static SendAlgorithmInterface* Create(const QuicClock* clock, |
| 29 const RttStats* rtt_stats, |
| 27 CongestionFeedbackType type, | 30 CongestionFeedbackType type, |
| 28 QuicConnectionStats* stats); | 31 QuicConnectionStats* stats); |
| 29 | 32 |
| 30 virtual ~SendAlgorithmInterface() {} | 33 virtual ~SendAlgorithmInterface() {} |
| 31 | 34 |
| 32 virtual void SetFromConfig(const QuicConfig& config, bool is_server) = 0; | 35 virtual void SetFromConfig(const QuicConfig& config, bool is_server) = 0; |
| 33 | 36 |
| 34 // Called when we receive congestion feedback from remote peer. | 37 // Called when we receive congestion feedback from remote peer. |
| 35 virtual void OnIncomingQuicCongestionFeedbackFrame( | 38 virtual void OnIncomingQuicCongestionFeedbackFrame( |
| 36 const QuicCongestionFeedbackFrame& feedback, | 39 const QuicCongestionFeedbackFrame& feedback, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 QuicTime now, | 72 QuicTime now, |
| 70 TransmissionType transmission_type, | 73 TransmissionType transmission_type, |
| 71 HasRetransmittableData has_retransmittable_data, | 74 HasRetransmittableData has_retransmittable_data, |
| 72 IsHandshake handshake) = 0; | 75 IsHandshake handshake) = 0; |
| 73 | 76 |
| 74 // What's the current estimated bandwidth in bytes per second. | 77 // What's the current estimated bandwidth in bytes per second. |
| 75 // Returns 0 when it does not have an estimate. | 78 // Returns 0 when it does not have an estimate. |
| 76 virtual QuicBandwidth BandwidthEstimate() const = 0; | 79 virtual QuicBandwidth BandwidthEstimate() const = 0; |
| 77 | 80 |
| 78 // Updates the smoothed RTT based on a new sample. | 81 // Updates the smoothed RTT based on a new sample. |
| 82 // TODO(ianswett): Now that the RTT is managed by RTTStats, it may be |
| 83 // possible to remove this method. |
| 79 virtual void UpdateRtt(QuicTime::Delta rtt_sample) = 0; | 84 virtual void UpdateRtt(QuicTime::Delta rtt_sample) = 0; |
| 80 | 85 |
| 81 // TODO(satyamshekhar): Monitor MinRtt. | |
| 82 virtual QuicTime::Delta SmoothedRtt() const = 0; | |
| 83 | |
| 84 // Get the send algorithm specific retransmission delay, called RTO in TCP, | 86 // Get the send algorithm specific retransmission delay, called RTO in TCP, |
| 85 // Note 1: the caller is responsible for sanity checking this value. | 87 // Note 1: the caller is responsible for sanity checking this value. |
| 86 // Note 2: this will return zero if we don't have enough data for an estimate. | 88 // Note 2: this will return zero if we don't have enough data for an estimate. |
| 87 virtual QuicTime::Delta RetransmissionDelay() const = 0; | 89 virtual QuicTime::Delta RetransmissionDelay() const = 0; |
| 88 | 90 |
| 89 // Returns the size of the current congestion window in bytes. Note, this is | 91 // Returns the size of the current congestion window in bytes. Note, this is |
| 90 // not the *available* window. Some send algorithms may not use a congestion | 92 // not the *available* window. Some send algorithms may not use a congestion |
| 91 // window and will return 0. | 93 // window and will return 0. |
| 92 virtual QuicByteCount GetCongestionWindow() const = 0; | 94 virtual QuicByteCount GetCongestionWindow() const = 0; |
| 93 }; | 95 }; |
| 94 | 96 |
| 95 } // namespace net | 97 } // namespace net |
| 96 | 98 |
| 97 #endif // NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_INTERFACE_H_ | 99 #endif // NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_INTERFACE_H_ |
| OLD | NEW |