| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // number referenced by the ACK frame. | 48 // number referenced by the ACK frame. |
| 49 // Deletes the matching sequence number from the stored set of sequence | 49 // Deletes the matching sequence number from the stored set of sequence |
| 50 // numbers. If this set is now empty, call the stored delegate's | 50 // numbers. If this set is now empty, call the stored delegate's |
| 51 // OnAckNotification method. | 51 // OnAckNotification method. |
| 52 // | 52 // |
| 53 // Returns true if the provided sequence_number caused the delegate to be | 53 // Returns true if the provided sequence_number caused the delegate to be |
| 54 // called, false otherwise. | 54 // called, false otherwise. |
| 55 bool OnAck(QuicPacketSequenceNumber sequence_number, | 55 bool OnAck(QuicPacketSequenceNumber sequence_number, |
| 56 QuicTime::Delta delta_largest_observed); | 56 QuicTime::Delta delta_largest_observed); |
| 57 | 57 |
| 58 bool IsEmpty() { return sequence_numbers_.empty(); } | 58 bool IsEmpty() { 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. Updates our internal set of sequence_numbers to | 61 // different sequence number. |
| 62 // track the latest number. | 62 void OnPacketRetransmitted(int packet_payload_size); |
| 63 void UpdateSequenceNumber(QuicPacketSequenceNumber old_sequence_number, | |
| 64 QuicPacketSequenceNumber new_sequence_number); | |
| 65 | 63 |
| 66 private: | 64 private: |
| 67 struct PacketInfo { | |
| 68 PacketInfo(); | |
| 69 explicit PacketInfo(int payload_size); | |
| 70 | |
| 71 int packet_payload_size; | |
| 72 }; | |
| 73 | |
| 74 // 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 |
| 75 // notified of ACKs for all the sequence numbers we are tracking. | 66 // notified of ACKs for all the sequence numbers we are tracking. |
| 76 // This is not owned by OnAckNotifier and must outlive it. | 67 // This is not owned by OnAckNotifier and must outlive it. |
| 77 scoped_refptr<DelegateInterface> delegate_; | 68 scoped_refptr<DelegateInterface> delegate_; |
| 78 | 69 |
| 79 // Sequence numbers this notifier is waiting to hear about. The | 70 // The number of unacked packets being tracked. |
| 80 // delegate will not be called until this is empty. | 71 int unacked_packets_; |
| 81 base::hash_map<QuicPacketSequenceNumber, PacketInfo> sequence_numbers_; | |
| 82 | 72 |
| 83 // Number of packets that had to be retransmitted. | 73 // Number of packets that had to be retransmitted. |
| 84 int retransmitted_packet_count_; | 74 int retransmitted_packet_count_; |
| 85 // Number of bytes that had to be retransmitted. | 75 // Number of bytes that had to be retransmitted. |
| 86 int retransmitted_byte_count_; | 76 int retransmitted_byte_count_; |
| 87 | 77 |
| 88 DISALLOW_COPY_AND_ASSIGN(QuicAckNotifier); | 78 DISALLOW_COPY_AND_ASSIGN(QuicAckNotifier); |
| 89 }; | 79 }; |
| 90 | 80 |
| 91 }; // namespace net | 81 } // namespace net |
| 92 | 82 |
| 93 #endif // NET_QUIC_QUIC_ACK_NOTIFIER_H_ | 83 #endif // NET_QUIC_QUIC_ACK_NOTIFIER_H_ |
| OLD | NEW |