55#ifndef QUICHE_QUIC_CORE_CONGESTION_CONTROL_BANDWIDTH_SAMPLER_H_
66#define QUICHE_QUIC_CORE_CONGESTION_CONTROL_BANDWIDTH_SAMPLER_H_
77
8+ #include < cstdint>
9+ #include < ostream>
10+
811#include " quiche/quic/core/congestion_control/send_algorithm_interface.h"
912#include " quiche/quic/core/congestion_control/windowed_filter.h"
1013#include " quiche/quic/core/packet_number_indexed_queue.h"
1114#include " quiche/quic/core/quic_bandwidth.h"
1215#include " quiche/quic/core/quic_packet_number.h"
13- #include " quiche/quic/core/quic_packets.h"
1416#include " quiche/quic/core/quic_time.h"
1517#include " quiche/quic/core/quic_types.h"
1618#include " quiche/quic/core/quic_unacked_packet_map.h"
17- #include " quiche/quic/platform/api/quic_export.h"
1819#include " quiche/quic/platform/api/quic_flags.h"
20+ #include " quiche/common/platform/api/quiche_export.h"
21+ #include " quiche/common/platform/api/quiche_logging.h"
1922#include " quiche/common/quiche_circular_deque.h"
2023
2124namespace quic {
@@ -27,14 +30,7 @@ class BandwidthSamplerPeer;
2730// A subset of BandwidthSampler::ConnectionStateOnSentPacket which is returned
2831// to the caller when the packet is acked or lost.
2932struct QUICHE_EXPORT SendTimeState {
30- SendTimeState ()
31- : is_valid(false ),
32- is_app_limited (false ),
33- total_bytes_sent(0 ),
34- total_bytes_acked(0 ),
35- total_bytes_lost(0 ),
36- bytes_in_flight(0 ) {}
37-
33+ SendTimeState () = default ;
3834 SendTimeState (bool is_app_limited, QuicByteCount total_bytes_sent,
3935 QuicByteCount total_bytes_acked, QuicByteCount total_bytes_lost,
4036 QuicByteCount bytes_in_flight)
@@ -52,28 +48,28 @@ struct QUICHE_EXPORT SendTimeState {
5248 const SendTimeState& s);
5349
5450 // Whether other states in this object is valid.
55- bool is_valid;
51+ bool is_valid = false ;
5652
5753 // Whether the sender is app limited at the time the packet was sent.
5854 // App limited bandwidth sample might be artificially low because the sender
5955 // did not have enough data to send in order to saturate the link.
60- bool is_app_limited;
56+ bool is_app_limited = false ;
6157
6258 // Total number of sent bytes at the time the packet was sent.
6359 // Includes the packet itself.
64- QuicByteCount total_bytes_sent;
60+ QuicByteCount total_bytes_sent = 0 ;
6561
6662 // Total number of acked bytes at the time the packet was sent.
67- QuicByteCount total_bytes_acked;
63+ QuicByteCount total_bytes_acked = 0 ;
6864
6965 // Total number of lost bytes at the time the packet was sent.
70- QuicByteCount total_bytes_lost;
66+ QuicByteCount total_bytes_lost = 0 ;
7167
7268 // Total number of inflight bytes at the time the packet was sent.
7369 // Includes the packet itself.
7470 // It should be equal to |total_bytes_sent| minus the sum of
7571 // |total_bytes_acked|, |total_bytes_lost| and total neutered bytes.
76- QuicByteCount bytes_in_flight;
72+ QuicByteCount bytes_in_flight = 0 ;
7773};
7874
7975struct QUICHE_EXPORT ExtraAckedEvent {
@@ -340,7 +336,6 @@ class QUICHE_EXPORT BandwidthSampler : public BandwidthSamplerInterface {
340336 // Copy states from |other|. This is useful when changing send algorithms in
341337 // the middle of a connection.
342338 BandwidthSampler (const BandwidthSampler& other);
343- ~BandwidthSampler () override ;
344339
345340 void OnPacketSent (QuicTime sent_time, QuicPacketNumber packet_number,
346341 QuicByteCount bytes, QuicByteCount bytes_in_flight,
@@ -502,12 +497,7 @@ class QUICHE_EXPORT BandwidthSampler : public BandwidthSamplerInterface {
502497
503498 // Default constructor. Required to put this structure into
504499 // PacketNumberIndexedQueue.
505- ConnectionStateOnSentPacket ()
506- : sent_time_(QuicTime::Zero()),
507- size_(0 ),
508- total_bytes_sent_at_last_acked_packet_(0 ),
509- last_acked_packet_sent_time_(QuicTime::Zero()),
510- last_acked_packet_ack_time_(QuicTime::Zero()) {}
500+ ConnectionStateOnSentPacket () = default;
511501
512502 friend QUICHE_EXPORT std::ostream& operator <<(
513503 std::ostream& os, const ConnectionStateOnSentPacket& p) {
@@ -521,11 +511,11 @@ class QUICHE_EXPORT BandwidthSampler : public BandwidthSamplerInterface {
521511 }
522512
523513 private:
524- QuicTime sent_time_;
525- QuicByteCount size_;
526- QuicByteCount total_bytes_sent_at_last_acked_packet_;
527- QuicTime last_acked_packet_sent_time_;
528- QuicTime last_acked_packet_ack_time_;
514+ QuicTime sent_time_ = QuicTime::Zero() ;
515+ QuicByteCount size_ = 0 ;
516+ QuicByteCount total_bytes_sent_at_last_acked_packet_ = 0 ;
517+ QuicTime last_acked_packet_sent_time_ = QuicTime::Zero() ;
518+ QuicTime last_acked_packet_ack_time_ = QuicTime::Zero() ;
529519 SendTimeState send_time_state_;
530520 };
531521
@@ -555,27 +545,27 @@ class QUICHE_EXPORT BandwidthSampler : public BandwidthSamplerInterface {
555545 bool ChooseA0Point (QuicByteCount total_bytes_acked, AckPoint* a0);
556546
557547 // The total number of congestion controlled bytes sent during the connection.
558- QuicByteCount total_bytes_sent_;
548+ QuicByteCount total_bytes_sent_ = 0 ;
559549
560550 // The total number of congestion controlled bytes which were acknowledged.
561- QuicByteCount total_bytes_acked_;
551+ QuicByteCount total_bytes_acked_ = 0 ;
562552
563553 // The total number of congestion controlled bytes which were lost.
564- QuicByteCount total_bytes_lost_;
554+ QuicByteCount total_bytes_lost_ = 0 ;
565555
566556 // The total number of congestion controlled bytes which have been neutered.
567- QuicByteCount total_bytes_neutered_;
557+ QuicByteCount total_bytes_neutered_ = 0 ;
568558
569559 // The value of |total_bytes_sent_| at the time the last acknowledged packet
570560 // was sent. Valid only when |last_acked_packet_sent_time_| is valid.
571- QuicByteCount total_bytes_sent_at_last_acked_packet_;
561+ QuicByteCount total_bytes_sent_at_last_acked_packet_ = 0 ;
572562
573563 // The time at which the last acknowledged packet was sent. Set to
574564 // QuicTime::Zero() if no valid timestamp is available.
575- QuicTime last_acked_packet_sent_time_;
565+ QuicTime last_acked_packet_sent_time_ = QuicTime::Zero() ;
576566
577567 // The time at which the most recent packet was acknowledged.
578- QuicTime last_acked_packet_ack_time_;
568+ QuicTime last_acked_packet_ack_time_ = QuicTime::Zero() ;
579569
580570 // The most recently sent packet.
581571 QuicPacketNumber last_sent_packet_;
@@ -585,7 +575,7 @@ class QUICHE_EXPORT BandwidthSampler : public BandwidthSamplerInterface {
585575
586576 // Indicates whether the bandwidth sampler is currently in an app-limited
587577 // phase.
588- bool is_app_limited_;
578+ bool is_app_limited_ = true ;
589579
590580 // The packet that will be acknowledged after this one will cause the sampler
591581 // to exit the app-limited phase.
@@ -613,13 +603,13 @@ class QUICHE_EXPORT BandwidthSampler : public BandwidthSamplerInterface {
613603 const ConnectionStateOnSentPacket& sent_packet);
614604
615605 MaxAckHeightTracker max_ack_height_tracker_;
616- QuicByteCount total_bytes_acked_after_last_ack_event_;
606+ QuicByteCount total_bytes_acked_after_last_ack_event_ = 0 ;
617607
618608 // True if connection option 'BSAO' is set.
619- bool overestimate_avoidance_;
609+ bool overestimate_avoidance_ = false ;
620610
621611 // True if connection option 'BBRB' is set.
622- bool limit_max_ack_height_tracker_by_send_rate_;
612+ bool limit_max_ack_height_tracker_by_send_rate_ = false ;
623613};
624614
625615} // namespace quic
0 commit comments