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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // number referenced by the ACK frame. | 47 // number referenced by the ACK frame. |
48 // Deletes the matching sequence number from the stored set of sequence | 48 // Deletes the matching sequence number from the stored set of sequence |
49 // numbers. If this set is now empty, call the stored delegate's | 49 // numbers. If this set is now empty, call the stored delegate's |
50 // OnAckNotification method. | 50 // OnAckNotification method. |
51 // | 51 // |
52 // Returns true if the provided sequence_number caused the delegate to be | 52 // Returns true if the provided sequence_number caused the delegate to be |
53 // called, false otherwise. | 53 // called, false otherwise. |
54 bool OnAck(QuicPacketSequenceNumber sequence_number, | 54 bool OnAck(QuicPacketSequenceNumber sequence_number, |
55 QuicTime::Delta delta_largest_observed); | 55 QuicTime::Delta delta_largest_observed); |
56 | 56 |
57 bool IsEmpty() { return unacked_packets_ == 0; } | 57 // Called when we've given up waiting for a sequence number, typically when |
| 58 // the connection is torn down. |
| 59 // Returns true if there are no more unacked packets being tracked. |
| 60 bool OnPacketAbandoned(); |
| 61 |
| 62 bool HasUnackedPackets() const { return unacked_packets_ > 0; } |
58 | 63 |
59 // If a packet is retransmitted by the connection, it will be sent with a | 64 // If a packet is retransmitted by the connection, it will be sent with a |
60 // different sequence number. | 65 // different sequence number. |
61 void OnPacketRetransmitted(int packet_payload_size); | 66 void OnPacketRetransmitted(int packet_payload_size); |
62 | 67 |
63 private: | 68 private: |
64 // The delegate's OnAckNotification() method will be called once we have been | 69 // The delegate's OnAckNotification() method will be called once we have been |
65 // notified of ACKs for all the sequence numbers we are tracking. | 70 // notified of ACKs for all the sequence numbers we are tracking. |
66 // This is not owned by OnAckNotifier and must outlive it. | 71 // This is not owned by OnAckNotifier and must outlive it. |
67 scoped_refptr<DelegateInterface> delegate_; | 72 scoped_refptr<DelegateInterface> delegate_; |
68 | 73 |
69 // The number of unacked packets being tracked. | 74 // The number of unacked packets being tracked. |
70 int unacked_packets_; | 75 int unacked_packets_; |
71 | 76 |
72 // Number of packets that had to be retransmitted. | 77 // Number of packets that had to be retransmitted. |
73 int retransmitted_packet_count_; | 78 int retransmitted_packet_count_; |
74 // Number of bytes that had to be retransmitted. | 79 // Number of bytes that had to be retransmitted. |
75 int retransmitted_byte_count_; | 80 int retransmitted_byte_count_; |
76 | 81 |
77 DISALLOW_COPY_AND_ASSIGN(QuicAckNotifier); | 82 DISALLOW_COPY_AND_ASSIGN(QuicAckNotifier); |
78 }; | 83 }; |
79 | 84 |
80 } // namespace net | 85 } // namespace net |
81 | 86 |
82 #endif // NET_QUIC_QUIC_ACK_NOTIFIER_H_ | 87 #endif // NET_QUIC_QUIC_ACK_NOTIFIER_H_ |
OLD | NEW |