summaryrefslogtreecommitdiffstats
path: root/chromium/net/quic/quic_ack_notifier.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/net/quic/quic_ack_notifier.h')
-rw-r--r--chromium/net/quic/quic_ack_notifier.h58
1 files changed, 46 insertions, 12 deletions
diff --git a/chromium/net/quic/quic_ack_notifier.h b/chromium/net/quic/quic_ack_notifier.h
index 5ec92134e78..f19d0f8c6b9 100644
--- a/chromium/net/quic/quic_ack_notifier.h
+++ b/chromium/net/quic/quic_ack_notifier.h
@@ -5,6 +5,7 @@
#ifndef NET_QUIC_QUIC_ACK_NOTIFIER_H_
#define NET_QUIC_QUIC_ACK_NOTIFIER_H_
+#include "base/memory/ref_counted.h"
#include "net/quic/quic_protocol.h"
namespace net {
@@ -16,22 +17,35 @@ namespace net {
// trigger a call to a provided Closure.
class NET_EXPORT_PRIVATE QuicAckNotifier {
public:
- class NET_EXPORT_PRIVATE DelegateInterface {
+ class NET_EXPORT_PRIVATE DelegateInterface
+ : public base::RefCounted<DelegateInterface> {
public:
DelegateInterface();
+ // Args:
+ // num_original_packets - Number of packets in the original transmission.
+ // num_original_bytes - Number of packets in the original transmission.
+ // num_retransmitted_packets - Number of packets that had to be
+ // retransmitted.
+ // num_retransmitted_bytes - Number of bytes that had to be retransmitted.
+ virtual void OnAckNotification(int num_original_packets,
+ int num_original_bytes,
+ int num_retransmitted_packets,
+ int num_retransmitted_bytes,
+ QuicTime::Delta delta_largest_observed) = 0;
+ protected:
+ friend class base::RefCounted<DelegateInterface>;
+
+ // Delegates are ref counted.
virtual ~DelegateInterface();
- virtual void OnAckNotification() = 0;
};
+ // QuicAckNotifier is expected to keep its own reference to the delegate.
explicit QuicAckNotifier(DelegateInterface* delegate);
virtual ~QuicAckNotifier();
// Register a sequence number that this AckNotifier should be interested in.
- void AddSequenceNumber(const QuicPacketSequenceNumber& sequence_number);
-
- // Register a set of sequence numbers that this AckNotifier should be
- // interested in.
- void AddSequenceNumbers(const SequenceNumberSet& sequence_numbers);
+ void AddSequenceNumber(const QuicPacketSequenceNumber& sequence_number,
+ int packet_payload_size);
// Called by the QuicConnection on receipt of new ACK frame, with the sequence
// number referenced by the ACK frame.
@@ -41,7 +55,8 @@ class NET_EXPORT_PRIVATE QuicAckNotifier {
//
// Returns true if the provided sequence_number caused the delegate to be
// called, false otherwise.
- bool OnAck(QuicPacketSequenceNumber sequence_number);
+ bool OnAck(QuicPacketSequenceNumber sequence_number,
+ QuicTime::Delta delta_largest_observed);
bool IsEmpty() { return sequence_numbers_.empty(); }
@@ -52,14 +67,33 @@ class NET_EXPORT_PRIVATE QuicAckNotifier {
QuicPacketSequenceNumber new_sequence_number);
private:
+ struct PacketInfo {
+ PacketInfo();
+ explicit PacketInfo(int payload_size);
+
+ int packet_payload_size;
+ };
+
// The delegate's OnAckNotification() method will be called once we have been
// notified of ACKs for all the sequence numbers we are tracking.
// This is not owned by OnAckNotifier and must outlive it.
- DelegateInterface* delegate_;
+ scoped_refptr<DelegateInterface> delegate_;
+
+ // Sequence numbers this notifier is waiting to hear about. The
+ // delegate will not be called until this is empty.
+ base::hash_map<QuicPacketSequenceNumber, PacketInfo> sequence_numbers_;
+
+ // Transmission and retransmission stats.
+ // Number of packets in the original transmission.
+ int original_packet_count_;
+ // Number of packets in the original transmission.
+ int original_byte_count_;
+ // Number of packets that had to be retransmitted.
+ int retransmitted_packet_count_;
+ // Number of bytes that had to be retransmitted.
+ int retransmitted_byte_count_;
- // Set of sequence numbers this notifier is waiting to hear about. The
- // delegate will not be called until this is an empty set.
- SequenceNumberSet sequence_numbers_;
+ DISALLOW_COPY_AND_ASSIGN(QuicAckNotifier);
};
}; // namespace net