Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / net / quic / congestion_control / tcp_cubic_sender.h
index 89e9bd6..3327bda 100644 (file)
@@ -40,30 +40,28 @@ class NET_EXPORT_PRIVATE TcpCubicSender : public SendAlgorithmInterface {
                  QuicConnectionStats* stats);
   virtual ~TcpCubicSender();
 
+  bool InSlowStart() const;
+
   // Start implementation of SendAlgorithmInterface.
   virtual void SetFromConfig(const QuicConfig& config, bool is_server) OVERRIDE;
   virtual void OnIncomingQuicCongestionFeedbackFrame(
       const QuicCongestionFeedbackFrame& feedback,
       QuicTime feedback_receive_time) OVERRIDE;
-  virtual void OnPacketAcked(QuicPacketSequenceNumber acked_sequence_number,
-                             QuicByteCount acked_bytes) OVERRIDE;
-  virtual void OnPacketLost(QuicPacketSequenceNumber largest_loss,
-                            QuicTime ack_receive_time) OVERRIDE;
+  virtual void OnCongestionEvent(bool rtt_updated,
+                                 QuicByteCount bytes_in_flight,
+                                 const CongestionMap& acked_packets,
+                                 const CongestionMap& lost_packets) OVERRIDE;
   virtual bool OnPacketSent(QuicTime sent_time,
+                            QuicByteCount bytes_in_flight,
                             QuicPacketSequenceNumber sequence_number,
                             QuicByteCount bytes,
-                            TransmissionType transmission_type,
                             HasRetransmittableData is_retransmittable) OVERRIDE;
   virtual void OnRetransmissionTimeout(bool packets_retransmitted) OVERRIDE;
-  virtual void OnPacketAbandoned(QuicPacketSequenceNumber sequence_number,
-                                 QuicByteCount abandoned_bytes) OVERRIDE;
   virtual QuicTime::Delta TimeUntilSend(
       QuicTime now,
-      TransmissionType transmission_type,
-      HasRetransmittableData has_retransmittable_data,
-      IsHandshake handshake) OVERRIDE;
+      QuicByteCount bytes_in_flight,
+      HasRetransmittableData has_retransmittable_data) OVERRIDE;
   virtual QuicBandwidth BandwidthEstimate() const OVERRIDE;
-  virtual void UpdateRtt(QuicTime::Delta rtt_sample) OVERRIDE;
   virtual QuicTime::Delta RetransmissionDelay() const OVERRIDE;
   virtual QuicByteCount GetCongestionWindow() const OVERRIDE;
   // End implementation of SendAlgorithmInterface.
@@ -71,15 +69,28 @@ class NET_EXPORT_PRIVATE TcpCubicSender : public SendAlgorithmInterface {
  private:
   friend class test::TcpCubicSenderPeer;
 
-  QuicByteCount AvailableSendWindow();
+  // TODO(ianswett): Remove these and migrate to OnCongestionEvent.
+  void OnPacketAcked(QuicPacketSequenceNumber acked_sequence_number,
+                     QuicByteCount acked_bytes,
+                     QuicByteCount bytes_in_flight);
+  void OnPacketLost(QuicPacketSequenceNumber largest_loss,
+                    QuicByteCount bytes_in_flight);
+
   QuicByteCount SendWindow();
-  void MaybeIncreaseCwnd(QuicPacketSequenceNumber acked_sequence_number);
-  bool IsCwndLimited() const;
+  void MaybeIncreaseCwnd(QuicPacketSequenceNumber acked_sequence_number,
+                         QuicByteCount bytes_in_flight);
+  bool IsCwndLimited(QuicByteCount bytes_in_flight) const;
   bool InRecovery() const;
+  // Methods for isolating PRR from the rest of TCP Cubic.
+  void PrrOnPacketLost(QuicByteCount bytes_in_flight);
+  void PrrOnPacketAcked(QuicByteCount acked_bytes);
+  QuicTime::Delta PrrTimeUntilSend(QuicByteCount bytes_in_flight);
+
 
   HybridSlowStart hybrid_slow_start_;
   Cubic cubic_;
   const RttStats* rtt_stats_;
+  QuicConnectionStats* stats_;
 
   // Reno provided for testing.
   const bool reno_;
@@ -90,9 +101,6 @@ class NET_EXPORT_PRIVATE TcpCubicSender : public SendAlgorithmInterface {
   // Receiver side advertised window.
   QuicByteCount receive_window_;
 
-  // Bytes in flight, aka bytes on the wire.
-  QuicByteCount bytes_in_flight_;
-
   // Bytes sent and acked since the last loss event.  Used for PRR.
   QuicByteCount prr_out_;
   QuicByteCount prr_delivered_;
@@ -101,10 +109,6 @@ class NET_EXPORT_PRIVATE TcpCubicSender : public SendAlgorithmInterface {
   // The congestion window before the last loss event.
   QuicByteCount bytes_in_flight_before_loss_;
 
-  // We need to keep track of the end sequence number of each RTT "burst".
-  bool update_end_sequence_number_;
-  QuicPacketSequenceNumber end_sequence_number_;
-
   // Track the largest packet that has been sent.
   QuicPacketSequenceNumber largest_sent_sequence_number_;
 
@@ -120,6 +124,10 @@ class NET_EXPORT_PRIVATE TcpCubicSender : public SendAlgorithmInterface {
   // Slow start congestion window in packets, aka ssthresh.
   QuicTcpCongestionWindow slowstart_threshold_;
 
+  // Whether the last loss event caused us to exit slowstart.
+  // Used for stats collection of slowstart_packets_lost
+  bool last_cutback_exited_slowstart_;
+
   // Maximum number of outstanding packets for tcp.
   QuicTcpCongestionWindow max_tcp_congestion_window_;