| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef NET_QUIC_QUIC_ACK_NOTIFIER_H_ | 5 #ifndef NET_QUIC_QUIC_ACK_NOTIFIER_H_ | 
| 6 #define NET_QUIC_QUIC_ACK_NOTIFIER_H_ | 6 #define NET_QUIC_QUIC_ACK_NOTIFIER_H_ | 
| 7 | 7 | 
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" | 
| 9 #include "net/quic/quic_protocol.h" | 9 #include "net/quic/quic_protocol.h" | 
| 10 | 10 | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
| 33     friend class base::RefCounted<DelegateInterface>; | 33     friend class base::RefCounted<DelegateInterface>; | 
| 34 | 34 | 
| 35     // Delegates are ref counted. | 35     // Delegates are ref counted. | 
| 36     virtual ~DelegateInterface(); | 36     virtual ~DelegateInterface(); | 
| 37   }; | 37   }; | 
| 38 | 38 | 
| 39   // QuicAckNotifier is expected to keep its own reference to the delegate. | 39   // QuicAckNotifier is expected to keep its own reference to the delegate. | 
| 40   explicit QuicAckNotifier(DelegateInterface* delegate); | 40   explicit QuicAckNotifier(DelegateInterface* delegate); | 
| 41   virtual ~QuicAckNotifier(); | 41   virtual ~QuicAckNotifier(); | 
| 42 | 42 | 
| 43   // Register a sequence number that this AckNotifier should be interested in. | 43   // Register a serialized packet the notifier should track. | 
| 44   void AddSequenceNumber(const QuicPacketSequenceNumber& sequence_number, | 44   void OnSerializedPacket(); | 
| 45                          int packet_payload_size); |  | 
| 46 | 45 | 
| 47   // Called by the QuicConnection on receipt of new ACK frame, with the sequence | 46   // Called on receipt of new ACK frame for an unacked packet. | 
| 48   // number referenced by the ACK frame. | 47   // Decrements the number of unacked packets and if there are none left, calls | 
| 49   // Deletes the matching sequence number from the stored set of sequence | 48   // the stored delegate's OnAckNotification method. | 
| 50   // numbers. If this set is now empty, call the stored delegate's |  | 
| 51   // OnAckNotification method. |  | 
| 52   // | 49   // | 
| 53   // Returns true if the provided sequence_number caused the delegate to be | 50   // Returns true if the delegate was called, false otherwise. | 
| 54   // called, false otherwise. | 51   bool OnAck(QuicTime::Delta delta_largest_observed); | 
| 55   bool OnAck(QuicPacketSequenceNumber sequence_number, |  | 
| 56              QuicTime::Delta delta_largest_observed); |  | 
| 57 | 52 | 
| 58   bool IsEmpty() { return unacked_packets_ == 0; } | 53   // Called when we've given up waiting for a sequence number, typically when | 
|  | 54   // the connection is torn down. | 
|  | 55   // Returns true if there are no more unacked packets being tracked. | 
|  | 56   bool OnPacketAbandoned(); | 
|  | 57 | 
|  | 58   bool HasUnackedPackets() const { return unacked_packets_ > 0; } | 
| 59 | 59 | 
| 60   // If a packet is retransmitted by the connection, it will be sent with a | 60   // If a packet is retransmitted by the connection, it will be sent with a | 
| 61   // different sequence number. | 61   // different sequence number. | 
| 62   void OnPacketRetransmitted(int packet_payload_size); | 62   void OnPacketRetransmitted(int packet_payload_size); | 
| 63 | 63 | 
| 64  private: | 64  private: | 
| 65   // The delegate's OnAckNotification() method will be called once we have been | 65   // The delegate's OnAckNotification() method will be called once we have been | 
| 66   // notified of ACKs for all the sequence numbers we are tracking. | 66   // notified of ACKs for all the sequence numbers we are tracking. | 
| 67   // This is not owned by OnAckNotifier and must outlive it. | 67   // This is not owned by OnAckNotifier and must outlive it. | 
| 68   scoped_refptr<DelegateInterface> delegate_; | 68   scoped_refptr<DelegateInterface> delegate_; | 
| 69 | 69 | 
| 70   // The number of unacked packets being tracked. | 70   // The number of unacked packets being tracked. | 
| 71   int unacked_packets_; | 71   int unacked_packets_; | 
| 72 | 72 | 
| 73   // Number of packets that had to be retransmitted. | 73   // Number of packets that had to be retransmitted. | 
| 74   int retransmitted_packet_count_; | 74   int retransmitted_packet_count_; | 
| 75   // Number of bytes that had to be retransmitted. | 75   // Number of bytes that had to be retransmitted. | 
| 76   int retransmitted_byte_count_; | 76   int retransmitted_byte_count_; | 
| 77 | 77 | 
| 78   DISALLOW_COPY_AND_ASSIGN(QuicAckNotifier); | 78   DISALLOW_COPY_AND_ASSIGN(QuicAckNotifier); | 
| 79 }; | 79 }; | 
| 80 | 80 | 
| 81 }  // namespace net | 81 }  // namespace net | 
| 82 | 82 | 
| 83 #endif  // NET_QUIC_QUIC_ACK_NOTIFIER_H_ | 83 #endif  // NET_QUIC_QUIC_ACK_NOTIFIER_H_ | 
| OLD | NEW | 
|---|