Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Side by Side Diff: net/quic/quic_ack_notifier.h

Issue 127633002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/quic/quic_ack_notifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "net/quic/quic_protocol.h" 9 #include "net/quic/quic_protocol.h"
9 10
10 namespace net { 11 namespace net {
11 12
12 // 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
13 // have all been ACKed. 14 // have all been ACKed.
14 // 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
15 // 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
16 // trigger a call to a provided Closure. 17 // trigger a call to a provided Closure.
17 class NET_EXPORT_PRIVATE QuicAckNotifier { 18 class NET_EXPORT_PRIVATE QuicAckNotifier {
18 public: 19 public:
19 class NET_EXPORT_PRIVATE DelegateInterface { 20 class NET_EXPORT_PRIVATE DelegateInterface
21 : public base::RefCounted<DelegateInterface> {
20 public: 22 public:
21 DelegateInterface(); 23 DelegateInterface();
24 virtual void OnAckNotification() = 0;
25
26 protected:
27 friend class base::RefCounted<DelegateInterface>;
28
29 // Delegates are ref counted.
22 virtual ~DelegateInterface(); 30 virtual ~DelegateInterface();
23 virtual void OnAckNotification() = 0;
24 }; 31 };
25 32
33 // QuicAckNotifier is expected to keep its own reference to the delegate.
26 explicit QuicAckNotifier(DelegateInterface* delegate); 34 explicit QuicAckNotifier(DelegateInterface* delegate);
27 virtual ~QuicAckNotifier(); 35 virtual ~QuicAckNotifier();
28 36
29 // Register a sequence number that this AckNotifier should be interested in. 37 // Register a sequence number that this AckNotifier should be interested in.
30 void AddSequenceNumber(const QuicPacketSequenceNumber& sequence_number); 38 void AddSequenceNumber(const QuicPacketSequenceNumber& sequence_number);
31 39
32 // Register a set of sequence numbers that this AckNotifier should be 40 // Register a set of sequence numbers that this AckNotifier should be
33 // interested in. 41 // interested in.
34 void AddSequenceNumbers(const SequenceNumberSet& sequence_numbers); 42 void AddSequenceNumbers(const SequenceNumberSet& sequence_numbers);
35 43
(...skipping 12 matching lines...) Expand all
48 // If a packet is retransmitted by the connection it will be sent with a 56 // If a packet is retransmitted by the connection it will be sent with a
49 // different sequence number. Updates our internal set of sequence_numbers to 57 // different sequence number. Updates our internal set of sequence_numbers to
50 // track the latest number. 58 // track the latest number.
51 void UpdateSequenceNumber(QuicPacketSequenceNumber old_sequence_number, 59 void UpdateSequenceNumber(QuicPacketSequenceNumber old_sequence_number,
52 QuicPacketSequenceNumber new_sequence_number); 60 QuicPacketSequenceNumber new_sequence_number);
53 61
54 private: 62 private:
55 // The delegate's OnAckNotification() method will be called once we have been 63 // The delegate's OnAckNotification() method will be called once we have been
56 // notified of ACKs for all the sequence numbers we are tracking. 64 // notified of ACKs for all the sequence numbers we are tracking.
57 // This is not owned by OnAckNotifier and must outlive it. 65 // This is not owned by OnAckNotifier and must outlive it.
58 DelegateInterface* delegate_; 66 scoped_refptr<DelegateInterface> delegate_;
59 67
60 // Set of sequence numbers this notifier is waiting to hear about. The 68 // Set of sequence numbers this notifier is waiting to hear about. The
61 // delegate will not be called until this is an empty set. 69 // delegate will not be called until this is an empty set.
62 SequenceNumberSet sequence_numbers_; 70 SequenceNumberSet sequence_numbers_;
63 }; 71 };
64 72
65 }; // namespace net 73 }; // namespace net
66 74
67 #endif // NET_QUIC_QUIC_ACK_NOTIFIER_H_ 75 #endif // NET_QUIC_QUIC_ACK_NOTIFIER_H_
OLDNEW
« no previous file with comments | « no previous file | net/quic/quic_ack_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698