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

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

Issue 398873003: Adds dynamic setting of FEC group size based on the connection's current (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « net/quic/quic_packet_creator_test.cc ('k') | net/quic/quic_packet_generator.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Responsible for generating packets on behalf of a QuicConnection. 5 // Responsible for generating packets on behalf of a QuicConnection.
6 // Packets are serialized just-in-time. Control frames are queued. 6 // Packets are serialized just-in-time. Control frames are queued.
7 // Ack and Feedback frames will be requested from the Connection 7 // Ack and Feedback frames will be requested from the Connection
8 // just-in-time. When a packet needs to be sent, the Generator 8 // just-in-time. When a packet needs to be sent, the Generator
9 // will serialize a packet and pass it to QuicConnection::SendOrQueuePacket() 9 // will serialize a packet and pass it to QuicConnection::SendOrQueuePacket()
10 // 10 //
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // operations can be grouped into the same FEC group. 47 // operations can be grouped into the same FEC group.
48 // 48 //
49 // When an FEC packet is generated, it will be send to the Delegate, 49 // When an FEC packet is generated, it will be send to the Delegate,
50 // even if the Delegate has become unwritable after handling the 50 // even if the Delegate has become unwritable after handling the
51 // data packet immediately proceeding the FEC packet. 51 // data packet immediately proceeding the FEC packet.
52 52
53 #ifndef NET_QUIC_QUIC_PACKET_GENERATOR_H_ 53 #ifndef NET_QUIC_QUIC_PACKET_GENERATOR_H_
54 #define NET_QUIC_QUIC_PACKET_GENERATOR_H_ 54 #define NET_QUIC_QUIC_PACKET_GENERATOR_H_
55 55
56 #include "net/quic/quic_packet_creator.h" 56 #include "net/quic/quic_packet_creator.h"
57 #include "net/quic/quic_sent_packet_manager.h"
57 #include "net/quic/quic_types.h" 58 #include "net/quic/quic_types.h"
58 59
59 namespace net { 60 namespace net {
60 61
61 namespace test { 62 namespace test {
62 class QuicPacketGeneratorPeer; 63 class QuicPacketGeneratorPeer;
63 } // namespace test 64 } // namespace test
64 65
65 class QuicAckNotifier; 66 class QuicAckNotifier;
66 67
67 class NET_EXPORT_PRIVATE QuicPacketGenerator { 68 class NET_EXPORT_PRIVATE QuicPacketGenerator
69 : public QuicSentPacketManager::NetworkChangeVisitor {
68 public: 70 public:
69 class NET_EXPORT_PRIVATE DelegateInterface { 71 class NET_EXPORT_PRIVATE DelegateInterface {
70 public: 72 public:
71 virtual ~DelegateInterface() {} 73 virtual ~DelegateInterface() {}
72 virtual bool ShouldGeneratePacket(TransmissionType transmission_type, 74 virtual bool ShouldGeneratePacket(TransmissionType transmission_type,
73 HasRetransmittableData retransmittable, 75 HasRetransmittableData retransmittable,
74 IsHandshake handshake) = 0; 76 IsHandshake handshake) = 0;
75 virtual QuicAckFrame* CreateAckFrame() = 0; 77 virtual QuicAckFrame* CreateAckFrame() = 0;
76 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() = 0; 78 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() = 0;
77 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() = 0; 79 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() = 0;
(...skipping 13 matching lines...) Expand all
91 virtual void OnFrameAddedToPacket(const QuicFrame& frame) {} 93 virtual void OnFrameAddedToPacket(const QuicFrame& frame) {}
92 }; 94 };
93 95
94 QuicPacketGenerator(QuicConnectionId connection_id, 96 QuicPacketGenerator(QuicConnectionId connection_id,
95 QuicFramer* framer, 97 QuicFramer* framer,
96 QuicRandom* random_generator, 98 QuicRandom* random_generator,
97 DelegateInterface* delegate); 99 DelegateInterface* delegate);
98 100
99 virtual ~QuicPacketGenerator(); 101 virtual ~QuicPacketGenerator();
100 102
103 // QuicSentPacketManager::NetworkChangeVisitor methods.
104 virtual void OnCongestionWindowChange(QuicByteCount congestion_window)
105 OVERRIDE;
106
101 // Indicates that an ACK frame should be sent. If |also_send_feedback| is 107 // Indicates that an ACK frame should be sent. If |also_send_feedback| is
102 // true, then it also indicates a CONGESTION_FEEDBACK frame should be sent. 108 // true, then it also indicates a CONGESTION_FEEDBACK frame should be sent.
103 // If |also_send_stop_waiting| is true, then it also indicates that a 109 // If |also_send_stop_waiting| is true, then it also indicates that a
104 // STOP_WAITING frame should be sent as well. 110 // STOP_WAITING frame should be sent as well.
105 // The contents of the frame(s) will be generated via a call to the delegates 111 // The contents of the frame(s) will be generated via a call to the delegates
106 // CreateAckFrame() and CreateFeedbackFrame() when the packet is serialized. 112 // CreateAckFrame() and CreateFeedbackFrame() when the packet is serialized.
107 void SetShouldSendAck(bool also_send_feedback, 113 void SetShouldSendAck(bool also_send_feedback,
108 bool also_send_stop_waiting); 114 bool also_send_stop_waiting);
109 115
110 // Indicates that a STOP_WAITING frame should be sent. 116 // Indicates that a STOP_WAITING frame should be sent.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // Turn on FEC protection for subsequent packets in the generator. 190 // Turn on FEC protection for subsequent packets in the generator.
185 // If no FEC group is currently open in the creator, this method flushes any 191 // If no FEC group is currently open in the creator, this method flushes any
186 // queued frames in the generator and in the creator, and it then turns FEC on 192 // queued frames in the generator and in the creator, and it then turns FEC on
187 // in the creator. This method may be called with an open FEC group in the 193 // in the creator. This method may be called with an open FEC group in the
188 // creator, in which case, only the generator's state is altered. 194 // creator, in which case, only the generator's state is altered.
189 void MaybeStartFecProtection(); 195 void MaybeStartFecProtection();
190 196
191 // Serializes and calls the delegate on an FEC packet if one was under 197 // Serializes and calls the delegate on an FEC packet if one was under
192 // construction in the creator. When |force| is false, it relies on the 198 // construction in the creator. When |force| is false, it relies on the
193 // creator being ready to send an FEC packet, otherwise FEC packet is sent 199 // creator being ready to send an FEC packet, otherwise FEC packet is sent
194 // as long as one is under construction in the creator. Also tries to turns 200 // as long as one is under construction in the creator. Also tries to turn
195 // off FEC protection in the creator if it's off in the generator. 201 // off FEC protection in the creator if it's off in the generator.
196 void MaybeSendFecPacketAndCloseGroup(bool force); 202 void MaybeSendFecPacketAndCloseGroup(bool force);
197 203
198 void SendQueuedFrames(bool flush); 204 void SendQueuedFrames(bool flush);
199 205
200 // Test to see if we have pending ack, feedback, or control frames. 206 // Test to see if we have pending ack, feedback, or control frames.
201 bool HasPendingFrames() const; 207 bool HasPendingFrames() const;
202 // Test to see if the addition of a pending frame (which might be 208 // Test to see if the addition of a pending frame (which might be
203 // retransmittable) would still allow the resulting packet to be sent now. 209 // retransmittable) would still allow the resulting packet to be sent now.
204 bool CanSendWithNextPendingFrameAddition() const; 210 bool CanSendWithNextPendingFrameAddition() const;
(...skipping 29 matching lines...) Expand all
234 scoped_ptr<QuicAckFrame> pending_ack_frame_; 240 scoped_ptr<QuicAckFrame> pending_ack_frame_;
235 scoped_ptr<QuicCongestionFeedbackFrame> pending_feedback_frame_; 241 scoped_ptr<QuicCongestionFeedbackFrame> pending_feedback_frame_;
236 scoped_ptr<QuicStopWaitingFrame> pending_stop_waiting_frame_; 242 scoped_ptr<QuicStopWaitingFrame> pending_stop_waiting_frame_;
237 243
238 DISALLOW_COPY_AND_ASSIGN(QuicPacketGenerator); 244 DISALLOW_COPY_AND_ASSIGN(QuicPacketGenerator);
239 }; 245 };
240 246
241 } // namespace net 247 } // namespace net
242 248
243 #endif // NET_QUIC_QUIC_PACKET_GENERATOR_H_ 249 #endif // NET_QUIC_QUIC_PACKET_GENERATOR_H_
OLDNEW
« no previous file with comments | « net/quic/quic_packet_creator_test.cc ('k') | net/quic/quic_packet_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698