Add explicit |forceOnlineSignin| to user pod status
[chromium-blink-merge.git] / net / quic / congestion_control / inter_arrival_sender.h
blob7760cef5ee6287cc6f73dbe0e44f12ffed6b9871
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
3 // found in the LICENSE file.
5 #ifndef NET_QUIC_CONGESTION_CONTROL_INTER_ARRIVAL_SENDER_H_
6 #define NET_QUIC_CONGESTION_CONTROL_INTER_ARRIVAL_SENDER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "net/base/net_export.h"
11 #include "net/quic/congestion_control/channel_estimator.h"
12 #include "net/quic/congestion_control/inter_arrival_bitrate_ramp_up.h"
13 #include "net/quic/congestion_control/inter_arrival_overuse_detector.h"
14 #include "net/quic/congestion_control/inter_arrival_probe.h"
15 #include "net/quic/congestion_control/inter_arrival_state_machine.h"
16 #include "net/quic/congestion_control/paced_sender.h"
17 #include "net/quic/congestion_control/send_algorithm_interface.h"
18 #include "net/quic/quic_bandwidth.h"
19 #include "net/quic/quic_clock.h"
20 #include "net/quic/quic_protocol.h"
21 #include "net/quic/quic_time.h"
23 namespace net {
25 class NET_EXPORT_PRIVATE InterArrivalSender : public SendAlgorithmInterface {
26 public:
27 explicit InterArrivalSender(const QuicClock* clock);
28 virtual ~InterArrivalSender();
30 static QuicBandwidth CalculateSentBandwidth(
31 const SendAlgorithmInterface::SentPacketsMap& sent_packets_map,
32 QuicTime feedback_receive_time);
34 // Start implementation of SendAlgorithmInterface.
35 virtual void SetFromConfig(const QuicConfig& config, bool is_server) OVERRIDE;
36 virtual void SetMaxPacketSize(QuicByteCount max_packet_size) OVERRIDE;
37 virtual void OnIncomingQuicCongestionFeedbackFrame(
38 const QuicCongestionFeedbackFrame& feedback,
39 QuicTime feedback_receive_time,
40 const SentPacketsMap& sent_packets) OVERRIDE;
41 virtual void OnPacketAcked(QuicPacketSequenceNumber acked_sequence_number,
42 QuicByteCount acked_bytes) OVERRIDE;
43 virtual void OnPacketLost(QuicPacketSequenceNumber sequence_number,
44 QuicTime ack_receive_time) OVERRIDE;
45 virtual bool OnPacketSent(
46 QuicTime sent_time,
47 QuicPacketSequenceNumber sequence_number,
48 QuicByteCount bytes,
49 TransmissionType transmission_type,
50 HasRetransmittableData has_retransmittable_data) OVERRIDE;
51 virtual void OnRetransmissionTimeout(bool packets_retransmitted) OVERRIDE;
52 virtual void OnPacketAbandoned(QuicPacketSequenceNumber sequence_number,
53 QuicByteCount abandoned_bytes) OVERRIDE;
54 virtual QuicTime::Delta TimeUntilSend(
55 QuicTime now,
56 TransmissionType transmission_type,
57 HasRetransmittableData has_retransmittable_data,
58 IsHandshake handshake) OVERRIDE;
59 virtual QuicBandwidth BandwidthEstimate() const OVERRIDE;
60 virtual void UpdateRtt(QuicTime::Delta rtt_sample) OVERRIDE;
61 virtual QuicTime::Delta SmoothedRtt() const OVERRIDE;
62 virtual QuicTime::Delta RetransmissionDelay() const OVERRIDE;
63 virtual QuicByteCount GetCongestionWindow() const OVERRIDE;
64 // End implementation of SendAlgorithmInterface.
66 private:
67 void EstimateDelayBandwidth(QuicTime feedback_receive_time,
68 QuicBandwidth sent_bandwidth);
69 void EstimateNewBandwidth(QuicTime feedback_receive_time,
70 QuicBandwidth sent_bandwidth);
71 void EstimateNewBandwidthAfterDraining(
72 QuicTime feedback_receive_time,
73 QuicTime::Delta estimated_congestion_delay);
74 void EstimateBandwidthAfterLossEvent(QuicTime feedback_receive_time);
75 void EstimateBandwidthAfterDelayEvent(
76 QuicTime feedback_receive_time,
77 QuicTime::Delta estimated_congestion_delay);
78 void ResetCurrentBandwidth(QuicTime feedback_receive_time,
79 QuicBandwidth new_rate);
80 bool ProbingPhase(QuicTime feedback_receive_time);
82 bool probing_; // Are we currently in the probing phase?
83 QuicByteCount max_segment_size_;
84 QuicBandwidth current_bandwidth_;
85 QuicTime::Delta smoothed_rtt_;
86 scoped_ptr<ChannelEstimator> channel_estimator_;
87 scoped_ptr<InterArrivalBitrateRampUp> bitrate_ramp_up_;
88 scoped_ptr<InterArrivalOveruseDetector> overuse_detector_;
89 scoped_ptr<InterArrivalProbe> probe_;
90 scoped_ptr<InterArrivalStateMachine> state_machine_;
91 scoped_ptr<PacedSender> paced_sender_;
92 int accumulated_number_of_lost_packets_;
93 BandwidthUsage bandwidth_usage_state_;
94 QuicTime back_down_time_; // Time when we decided to back down.
95 QuicBandwidth back_down_bandwidth_; // Bandwidth before backing down.
96 QuicTime::Delta back_down_congestion_delay_; // Delay when backing down.
98 DISALLOW_COPY_AND_ASSIGN(InterArrivalSender);
101 } // namespace net
102 #endif // NET_QUIC_CONGESTION_CONTROL_INTER_ARRIVAL_SENDER_H_