| 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 |
| 11 namespace net { | 11 namespace net { |
| 12 | 12 |
| 13 // Used to register with a QuicConnection for notification once a set of packets | 13 // Used to register with a QuicConnection for notification once a set of packets |
| 14 // have all been ACKed. | 14 // have all been ACKed. |
| 15 // The connection informs this class of newly ACKed sequence numbers, and once | 15 // The connection informs this class of newly ACKed sequence numbers, and once |
| 16 // we have seen ACKs for all the sequence numbers we are interested in, we | 16 // we have seen ACKs for all the sequence numbers we are interested in, we |
| 17 // trigger a call to a provided Closure. | 17 // trigger a call to a provided Closure. |
| 18 class NET_EXPORT_PRIVATE QuicAckNotifier { | 18 class NET_EXPORT_PRIVATE QuicAckNotifier { |
| 19 public: | 19 public: |
| 20 class NET_EXPORT_PRIVATE DelegateInterface | 20 class NET_EXPORT_PRIVATE DelegateInterface |
| 21 : public base::RefCounted<DelegateInterface> { | 21 : public base::RefCounted<DelegateInterface> { |
| 22 public: | 22 public: |
| 23 DelegateInterface(); | 23 DelegateInterface(); |
| 24 // Args: | 24 // Args: |
| 25 // num_original_packets - Number of packets in the original transmission. | |
| 26 // num_original_bytes - Number of packets in the original transmission. | |
| 27 // num_retransmitted_packets - Number of packets that had to be | 25 // num_retransmitted_packets - Number of packets that had to be |
| 28 // retransmitted. | 26 // retransmitted. |
| 29 // num_retransmitted_bytes - Number of bytes that had to be retransmitted. | 27 // num_retransmitted_bytes - Number of bytes that had to be retransmitted. |
| 30 virtual void OnAckNotification(int num_original_packets, | 28 virtual void OnAckNotification(int num_retransmitted_packets, |
| 31 int num_original_bytes, | |
| 32 int num_retransmitted_packets, | |
| 33 int num_retransmitted_bytes, | 29 int num_retransmitted_bytes, |
| 34 QuicTime::Delta delta_largest_observed) = 0; | 30 QuicTime::Delta delta_largest_observed) = 0; |
| 31 |
| 35 protected: | 32 protected: |
| 36 friend class base::RefCounted<DelegateInterface>; | 33 friend class base::RefCounted<DelegateInterface>; |
| 37 | 34 |
| 38 // Delegates are ref counted. | 35 // Delegates are ref counted. |
| 39 virtual ~DelegateInterface(); | 36 virtual ~DelegateInterface(); |
| 40 }; | 37 }; |
| 41 | 38 |
| 42 // QuicAckNotifier is expected to keep its own reference to the delegate. | 39 // QuicAckNotifier is expected to keep its own reference to the delegate. |
| 43 explicit QuicAckNotifier(DelegateInterface* delegate); | 40 explicit QuicAckNotifier(DelegateInterface* delegate); |
| 44 virtual ~QuicAckNotifier(); | 41 virtual ~QuicAckNotifier(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 73 |
| 77 // The delegate's OnAckNotification() method will be called once we have been | 74 // The delegate's OnAckNotification() method will be called once we have been |
| 78 // notified of ACKs for all the sequence numbers we are tracking. | 75 // notified of ACKs for all the sequence numbers we are tracking. |
| 79 // This is not owned by OnAckNotifier and must outlive it. | 76 // This is not owned by OnAckNotifier and must outlive it. |
| 80 scoped_refptr<DelegateInterface> delegate_; | 77 scoped_refptr<DelegateInterface> delegate_; |
| 81 | 78 |
| 82 // Sequence numbers this notifier is waiting to hear about. The | 79 // Sequence numbers this notifier is waiting to hear about. The |
| 83 // delegate will not be called until this is empty. | 80 // delegate will not be called until this is empty. |
| 84 base::hash_map<QuicPacketSequenceNumber, PacketInfo> sequence_numbers_; | 81 base::hash_map<QuicPacketSequenceNumber, PacketInfo> sequence_numbers_; |
| 85 | 82 |
| 86 // Transmission and retransmission stats. | |
| 87 // Number of packets in the original transmission. | |
| 88 int original_packet_count_; | |
| 89 // Number of packets in the original transmission. | |
| 90 int original_byte_count_; | |
| 91 // Number of packets that had to be retransmitted. | 83 // Number of packets that had to be retransmitted. |
| 92 int retransmitted_packet_count_; | 84 int retransmitted_packet_count_; |
| 93 // Number of bytes that had to be retransmitted. | 85 // Number of bytes that had to be retransmitted. |
| 94 int retransmitted_byte_count_; | 86 int retransmitted_byte_count_; |
| 95 | 87 |
| 96 DISALLOW_COPY_AND_ASSIGN(QuicAckNotifier); | 88 DISALLOW_COPY_AND_ASSIGN(QuicAckNotifier); |
| 97 }; | 89 }; |
| 98 | 90 |
| 99 }; // namespace net | 91 }; // namespace net |
| 100 | 92 |
| 101 #endif // NET_QUIC_QUIC_ACK_NOTIFIER_H_ | 93 #endif // NET_QUIC_QUIC_ACK_NOTIFIER_H_ |
| OLD | NEW |