Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(909)

Side by Side Diff: net/quic/core/congestion_control/pacing_sender.h

Issue 2236973002: Landing Recent QUIC changes until 4AM, Aug 7, 2016 UTC-4 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: flip quic_sequencer_buffer_retire_block_in_time to true Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 that adds pacing on top of an another send algorithm. 5 // A send algorithm that adds pacing on top of an another send algorithm.
6 // It uses the underlying sender's pacing rate to schedule packets. 6 // It uses the underlying sender's pacing rate to schedule packets.
7 // It also takes into consideration the expected granularity of the underlying 7 // It also takes into consideration the expected granularity of the underlying
8 // alarm to ensure that alarms are not set too aggressively, and err towards 8 // alarm to ensure that alarms are not set too aggressively, and err towards
9 // sending packets too early instead of too late. 9 // sending packets too early instead of too late.
10 10
11 #ifndef NET_QUIC_CONGESTION_CONTROL_PACING_SENDER_H_ 11 #ifndef NET_QUIC_CONGESTION_CONTROL_PACING_SENDER_H_
12 #define NET_QUIC_CONGESTION_CONTROL_PACING_SENDER_H_ 12 #define NET_QUIC_CONGESTION_CONTROL_PACING_SENDER_H_
13 13
14 #include <stdint.h> 14 #include <stdint.h>
15 15
16 #include <map> 16 #include <map>
17 #include <memory> 17 #include <memory>
18 18
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "net/quic/core/congestion_control/send_algorithm_interface.h" 20 #include "net/quic/core/congestion_control/send_algorithm_interface.h"
21 #include "net/quic/core/quic_bandwidth.h" 21 #include "net/quic/core/quic_bandwidth.h"
22 #include "net/quic/core/quic_config.h" 22 #include "net/quic/core/quic_config.h"
23 #include "net/quic/core/quic_protocol.h" 23 #include "net/quic/core/quic_protocol.h"
24 #include "net/quic/core/quic_time.h" 24 #include "net/quic/core/quic_time.h"
25 25
26 namespace net { 26 namespace net {
27 27
28 class NET_EXPORT_PRIVATE PacingSender : public SendAlgorithmInterface { 28 class NET_EXPORT_PRIVATE PacingSender {
29 public: 29 public:
30 PacingSender(); 30 PacingSender();
31 ~PacingSender() override; 31 ~PacingSender();
32 32
33 void SetMaxPacingRate(QuicBandwidth max_pacing_rate); 33 // Sets the underlying sender. Does not take ownership of |sender|. |sender|
34 // Sets the underlying sender. Takes ownership of |sender| if |owns_sender| is 34 // must not be null. This must be called before any of the
35 // true. 35 // SendAlgorithmInterface wrapper methods are called.
36 void SetSender(SendAlgorithmInterface* sender, bool owns_sender); 36 void set_sender(SendAlgorithmInterface* sender);
37 37
38 // SendAlgorithmInterface methods. 38 void set_max_pacing_rate(QuicBandwidth max_pacing_rate) {
39 void SetFromConfig(const QuicConfig& config, 39 max_pacing_rate_ = max_pacing_rate;
40 Perspective perspective) override; 40 }
41 void ResumeConnectionState( 41
42 const CachedNetworkParameters& cached_network_params, 42 void OnCongestionEvent(
43 bool max_bandwidth_resumption) override; 43 bool rtt_updated,
44 void SetNumEmulatedConnections(int num_connections) override; 44 QuicByteCount bytes_in_flight,
45 void OnCongestionEvent(bool rtt_updated, 45 const SendAlgorithmInterface::CongestionVector& acked_packets,
46 QuicByteCount bytes_in_flight, 46 const SendAlgorithmInterface::CongestionVector& lost_packets);
47 const CongestionVector& acked_packets,
48 const CongestionVector& lost_packets) override;
49 bool OnPacketSent(QuicTime sent_time, 47 bool OnPacketSent(QuicTime sent_time,
50 QuicByteCount bytes_in_flight, 48 QuicByteCount bytes_in_flight,
51 QuicPacketNumber packet_number, 49 QuicPacketNumber packet_number,
52 QuicByteCount bytes, 50 QuicByteCount bytes,
53 HasRetransmittableData is_retransmittable) override; 51 HasRetransmittableData is_retransmittable);
54 void OnRetransmissionTimeout(bool packets_retransmitted) override;
55 void OnConnectionMigration() override;
56 QuicTime::Delta TimeUntilSend(QuicTime now, 52 QuicTime::Delta TimeUntilSend(QuicTime now,
57 QuicByteCount bytes_in_flight) const override; 53 QuicByteCount bytes_in_flight) const;
58 QuicBandwidth PacingRate(QuicByteCount bytes_in_flight) const override; 54 QuicBandwidth PacingRate(QuicByteCount bytes_in_flight) const;
59 QuicBandwidth BandwidthEstimate() const override;
60 QuicTime::Delta RetransmissionDelay() const override;
61 QuicByteCount GetCongestionWindow() const override;
62 bool InSlowStart() const override;
63 bool InRecovery() const override;
64 QuicByteCount GetSlowStartThreshold() const override;
65 CongestionControlType GetCongestionControlType() const override;
66 // End implementation of SendAlgorithmInterface.
67 55
68 private: 56 private:
69 // Underlying sender. Owned if |owns_sender_| is true. 57 // Underlying sender. Not owned.
70 SendAlgorithmInterface* sender_; 58 SendAlgorithmInterface* sender_;
71 // If not QuicBandidth::Zero, the maximum rate the PacingSender will use. 59 // If not QuicBandidth::Zero, the maximum rate the PacingSender will use.
72 QuicBandwidth max_pacing_rate_; 60 QuicBandwidth max_pacing_rate_;
73 61
74 // Number of unpaced packets to be sent before packets are delayed. 62 // Number of unpaced packets to be sent before packets are delayed.
75 uint32_t burst_tokens_; 63 uint32_t burst_tokens_;
76 // Send time of the last packet considered delayed. 64 // Send time of the last packet considered delayed.
77 QuicTime last_delayed_packet_sent_time_; 65 QuicTime last_delayed_packet_sent_time_;
78 QuicTime ideal_next_packet_send_time_; // When can the next packet be sent. 66 QuicTime ideal_next_packet_send_time_; // When can the next packet be sent.
79 mutable bool was_last_send_delayed_; // True when the last send was delayed. 67 mutable bool was_last_send_delayed_; // True when the last send was delayed.
80 bool owns_sender_; // True if PacingSender owns |sender_|.
81 68
82 DISALLOW_COPY_AND_ASSIGN(PacingSender); 69 DISALLOW_COPY_AND_ASSIGN(PacingSender);
83 }; 70 };
84 71
85 } // namespace net 72 } // namespace net
86 73
87 #endif // NET_QUIC_CONGESTION_CONTROL_PACING_SENDER_H_ 74 #endif // NET_QUIC_CONGESTION_CONTROL_PACING_SENDER_H_
OLDNEW
« no previous file with comments | « net/quic/core/congestion_control/general_loss_algorithm.cc ('k') | net/quic/core/congestion_control/pacing_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698