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

Side by Side Diff: net/quic/core/quic_received_packet_manager.h

Issue 2713963003: Simplify QuicReceivedPacketManager by combining DontWaitForPacketsBefore and UpdatePacketInformatio… (Closed)
Patch Set: Created 3 years, 9 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
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_CORE_QUIC_RECEIVED_PACKET_MANAGER_H_ 5 #ifndef NET_QUIC_CORE_QUIC_RECEIVED_PACKET_MANAGER_H_
6 #define NET_QUIC_CORE_QUIC_RECEIVED_PACKET_MANAGER_H_ 6 #define NET_QUIC_CORE_QUIC_RECEIVED_PACKET_MANAGER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "net/quic/core/quic_config.h" 9 #include "net/quic/core/quic_config.h"
10 #include "net/quic/core/quic_framer.h" 10 #include "net/quic/core/quic_framer.h"
11 #include "net/quic/core/quic_packets.h" 11 #include "net/quic/core/quic_packets.h"
12 #include "net/quic/platform/api/quic_export.h" 12 #include "net/quic/platform/api/quic_export.h"
13 13
14 namespace net { 14 namespace net {
15 15
16 namespace test { 16 namespace test {
17 class QuicConnectionPeer; 17 class QuicConnectionPeer;
18 class QuicReceivedPacketManagerPeer;
19 } // namespace test 18 } // namespace test
20 19
21 struct QuicConnectionStats; 20 struct QuicConnectionStats;
22 21
23 // Records all received packets by a connection. 22 // Records all received packets by a connection.
24 class QUIC_EXPORT_PRIVATE QuicReceivedPacketManager { 23 class QUIC_EXPORT_PRIVATE QuicReceivedPacketManager {
25 public: 24 public:
26 explicit QuicReceivedPacketManager(QuicConnectionStats* stats); 25 explicit QuicReceivedPacketManager(QuicConnectionStats* stats);
27 virtual ~QuicReceivedPacketManager(); 26 virtual ~QuicReceivedPacketManager();
28 27
29 // Updates the internal state concerning which packets have been received. 28 // Updates the internal state concerning which packets have been received.
30 // header: the packet header. 29 // header: the packet header.
31 // timestamp: the arrival time of the packet. 30 // timestamp: the arrival time of the packet.
32 virtual void RecordPacketReceived(const QuicPacketHeader& header, 31 virtual void RecordPacketReceived(const QuicPacketHeader& header,
33 QuicTime receipt_time); 32 QuicTime receipt_time);
34 33
35 // Checks whether |packet_number| is missing and less than largest observed. 34 // Checks whether |packet_number| is missing and less than largest observed.
36 virtual bool IsMissing(QuicPacketNumber packet_number); 35 virtual bool IsMissing(QuicPacketNumber packet_number);
37 36
38 // Checks if we're still waiting for the packet with |packet_number|. 37 // Checks if we're still waiting for the packet with |packet_number|.
39 virtual bool IsAwaitingPacket(QuicPacketNumber packet_number); 38 virtual bool IsAwaitingPacket(QuicPacketNumber packet_number);
40 39
41 // Retrieves a frame containing a QuicAckFrame. The ack frame may not be 40 // Retrieves a frame containing a QuicAckFrame. The ack frame may not be
42 // changed outside QuicReceivedPacketManager and must be serialized before 41 // changed outside QuicReceivedPacketManager and must be serialized before
43 // another packet is received, or it will change. 42 // another packet is received, or it will change.
44 const QuicFrame GetUpdatedAckFrame(QuicTime approximate_now); 43 const QuicFrame GetUpdatedAckFrame(QuicTime approximate_now);
45 44
46 // Updates internal state based on |stop_waiting|. 45 // Deletes all missing packets before least unacked. The connection won't
47 virtual void UpdatePacketInformationSentByPeer( 46 // process any packets with packet number before |least_unacked| that it
48 const QuicStopWaitingFrame& stop_waiting); 47 // received after this call.
48 void DontWaitForPacketsBefore(QuicPacketNumber least_unacked);
49 49
50 // Returns true if there are any missing packets. 50 // Returns true if there are any missing packets.
51 bool HasMissingPackets() const; 51 bool HasMissingPackets() const;
52 52
53 // Returns true when there are new missing packets to be reported within 3 53 // Returns true when there are new missing packets to be reported within 3
54 // packets of the largest observed. 54 // packets of the largest observed.
55 virtual bool HasNewMissingPackets() const; 55 virtual bool HasNewMissingPackets() const;
56 56
57 QuicPacketNumber peer_least_packet_awaiting_ack() { 57 QuicPacketNumber peer_least_packet_awaiting_ack() {
58 return peer_least_packet_awaiting_ack_; 58 return peer_least_packet_awaiting_ack_;
59 } 59 }
60 60
61 virtual bool ack_frame_updated() const; 61 virtual bool ack_frame_updated() const;
62 62
63 QuicPacketNumber GetLargestObserved() const; 63 QuicPacketNumber GetLargestObserved() const;
64 64
65 // For logging purposes. 65 // For logging purposes.
66 const QuicAckFrame& ack_frame() const { return ack_frame_; } 66 const QuicAckFrame& ack_frame() const { return ack_frame_; }
67 67
68 private: 68 private:
69 friend class test::QuicConnectionPeer; 69 friend class test::QuicConnectionPeer;
70 friend class test::QuicReceivedPacketManagerPeer;
71
72 // Deletes all missing packets before least unacked. The connection won't
73 // process any packets with packet number before |least_unacked| that it
74 // received after this call. Returns true if there were missing packets before
75 // |least_unacked| unacked, false otherwise.
76 bool DontWaitForPacketsBefore(QuicPacketNumber least_unacked);
77 70
78 // Least packet number of the the packet sent by the peer for which it 71 // Least packet number of the the packet sent by the peer for which it
79 // hasn't received an ack. 72 // hasn't received an ack.
80 QuicPacketNumber peer_least_packet_awaiting_ack_; 73 QuicPacketNumber peer_least_packet_awaiting_ack_;
81 74
82 // Received packet information used to produce acks. 75 // Received packet information used to produce acks.
83 QuicAckFrame ack_frame_; 76 QuicAckFrame ack_frame_;
84 77
85 // True if |ack_frame_| has been updated since UpdateReceivedPacketInfo was 78 // True if |ack_frame_| has been updated since UpdateReceivedPacketInfo was
86 // last called. 79 // last called.
87 bool ack_frame_updated_; 80 bool ack_frame_updated_;
88 81
89 // The time we received the largest_observed packet number, or zero if 82 // The time we received the largest_observed packet number, or zero if
90 // no packet numbers have been received since UpdateReceivedPacketInfo. 83 // no packet numbers have been received since UpdateReceivedPacketInfo.
91 // Needed for calculating ack_delay_time. 84 // Needed for calculating ack_delay_time.
92 QuicTime time_largest_observed_; 85 QuicTime time_largest_observed_;
93 86
94 QuicConnectionStats* stats_; 87 QuicConnectionStats* stats_;
95 88
96 DISALLOW_COPY_AND_ASSIGN(QuicReceivedPacketManager); 89 DISALLOW_COPY_AND_ASSIGN(QuicReceivedPacketManager);
97 }; 90 };
98 91
99 } // namespace net 92 } // namespace net
100 93
101 #endif // NET_QUIC_CORE_QUIC_RECEIVED_PACKET_MANAGER_H_ 94 #endif // NET_QUIC_CORE_QUIC_RECEIVED_PACKET_MANAGER_H_
OLDNEW
« no previous file with comments | « net/quic/core/quic_multipath_received_packet_manager_test.cc ('k') | net/quic/core/quic_received_packet_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698