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

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

Issue 23691073: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compiler/unittests fix Created 7 years, 3 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.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 //
11 // The Generator's mode of operation is controlled by two conditions: 11 // The Generator's mode of operation is controlled by two conditions:
12 // 12 //
13 // 1) Is the Delegate writable? 13 // 1) Is the Delegate writable?
14 // 14 //
15 // If the Delegate is not writable, then no operations will cause 15 // If the Delegate is not writable, then no operations will cause
16 // a packet to be serialized. In particular: 16 // a packet to be serialized. In particular:
17 // * SetShouldSendAck will simply record that an ack is to be sent. 17 // * SetShouldSendAck will simply record that an ack is to be sent.
18 // * AddControlFram will enqueue the control frame. 18 // * AddControlFrame will enqueue the control frame.
19 // * ConsumeData will do nothing. 19 // * ConsumeData will do nothing.
20 // 20 //
21 // If the Delegate is writable, then the behavior depends on the second 21 // If the Delegate is writable, then the behavior depends on the second
22 // condition: 22 // condition:
23 // 23 //
24 // 2) Is the Generator in batch mode? 24 // 2) Is the Generator in batch mode?
25 // 25 //
26 // If the Generator is NOT in batch mode, then each call to a write 26 // If the Generator is NOT in batch mode, then each call to a write
27 // operation will serialize one or more packets. The contents will 27 // operation will serialize one or more packets. The contents will
28 // include any previous queued frames. If an ack should be sent 28 // include any previous queued frames. If an ack should be sent
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // Called when a frame has been added to the current packet. 84 // Called when a frame has been added to the current packet.
85 virtual void OnFrameAddedToPacket(const QuicFrame& frame) = 0; 85 virtual void OnFrameAddedToPacket(const QuicFrame& frame) = 0;
86 }; 86 };
87 87
88 QuicPacketGenerator(DelegateInterface* delegate, 88 QuicPacketGenerator(DelegateInterface* delegate,
89 DebugDelegateInterface* debug_delegate, 89 DebugDelegateInterface* debug_delegate,
90 QuicPacketCreator* creator); 90 QuicPacketCreator* creator);
91 91
92 virtual ~QuicPacketGenerator(); 92 virtual ~QuicPacketGenerator();
93 93
94 // Indicates that an ACK frame should be sent. If |also_send_feedback| is
95 // true, then it also indicates a CONGESTION_FEEDBACK frame should be sent.
96 // The contents of the frame(s) will be generated via a call to the delegates
97 // CreateAckFrame() and CreateFeedbackFrame() when the packet is serialized.
94 void SetShouldSendAck(bool also_send_feedback); 98 void SetShouldSendAck(bool also_send_feedback);
95 void AddControlFrame(const QuicFrame& frame); 99 void AddControlFrame(const QuicFrame& frame);
96 100
97 // Given some data, may consume part or all of it and pass it to the packet 101 // Given some data, may consume part or all of it and pass it to the
98 // creator to be serialized into packets. If not in batch mode, these packets 102 // packet creator to be serialized into packets. If not in batch
99 // will also be sent during this call. 103 // mode, these packets will also be sent during this call. Also
104 // attaches a QuicAckNotifier to any created stream frames, which
105 // will be called once the frame is ACKed by the peer. The
106 // QuicAckNotifier is owned by the QuicConnection. |notifier| may
107 // be NULL.
100 QuicConsumedData ConsumeData(QuicStreamId id, 108 QuicConsumedData ConsumeData(QuicStreamId id,
101 base::StringPiece data, 109 base::StringPiece data,
102 QuicStreamOffset offset, 110 QuicStreamOffset offset,
103 bool fin);
104
105 // As above, but attaches a QuicAckNotifier to any created stream frames,
106 // which will be called once the frame is ACKed by the peer.
107 // The QuicAckNotifier is owned by the QuicConnection.
108 QuicConsumedData ConsumeData(QuicStreamId id,
109 base::StringPiece data,
110 QuicStreamOffset offset,
111 bool fin, 111 bool fin,
112 QuicAckNotifier* notifier); 112 QuicAckNotifier* notifier);
113 113
114 // Indicates whether batch mode is currently enabled. 114 // Indicates whether batch mode is currently enabled.
115 bool InBatchMode(); 115 bool InBatchMode();
116 // Disables flushing. 116 // Disables flushing.
117 void StartBatchOperations(); 117 void StartBatchOperations();
118 // Enables flushing and flushes queued data. 118 // Enables flushing and flushes queued data.
119 void FinishBatchOperations(); 119 void FinishBatchOperations();
120 120
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // can later be (optionally) retransmitted. 158 // can later be (optionally) retransmitted.
159 scoped_ptr<QuicAckFrame> pending_ack_frame_; 159 scoped_ptr<QuicAckFrame> pending_ack_frame_;
160 scoped_ptr<QuicCongestionFeedbackFrame> pending_feedback_frame_; 160 scoped_ptr<QuicCongestionFeedbackFrame> pending_feedback_frame_;
161 161
162 DISALLOW_COPY_AND_ASSIGN(QuicPacketGenerator); 162 DISALLOW_COPY_AND_ASSIGN(QuicPacketGenerator);
163 }; 163 };
164 164
165 } // namespace net 165 } // namespace net
166 166
167 #endif // NET_QUIC_QUIC_PACKET_GENERATOR_H_ 167 #endif // NET_QUIC_QUIC_PACKET_GENERATOR_H_
OLDNEW
« no previous file with comments | « net/quic/quic_packet_creator.cc ('k') | net/quic/quic_packet_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698