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

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

Issue 1525303003: Remove QuicPacketGenerator::OnSerializedPacket with functionality in QuicPacketCreator. No functio… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@110008813
Patch Set: get newly added files from upstream Created 5 years 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
« no previous file with comments | « net/quic/quic_connection_test.cc ('k') | net/quic/quic_packet_creator.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 // Accumulates frames for the next packet until more frames no longer fit or 5 // Accumulates frames for the next packet until more frames no longer fit or
6 // it's time to create a packet from them. Also provides packet creation of 6 // it's time to create a packet from them. Also provides packet creation of
7 // FEC packets based on previously created packets. If multipath enabled, only 7 // FEC packets based on previously created packets. If multipath enabled, only
8 // creates packets on one path at the same time. Currently, next packet number 8 // creates packets on one path at the same time. Currently, next packet number
9 // is tracked per-path. 9 // is tracked per-path.
10 10
(...skipping 20 matching lines...) Expand all
31 class QuicRandom; 31 class QuicRandom;
32 class QuicRandomBoolSource; 32 class QuicRandomBoolSource;
33 33
34 class NET_EXPORT_PRIVATE QuicPacketCreator { 34 class NET_EXPORT_PRIVATE QuicPacketCreator {
35 public: 35 public:
36 // A delegate interface for further processing serialized packet. 36 // A delegate interface for further processing serialized packet.
37 class NET_EXPORT_PRIVATE DelegateInterface { 37 class NET_EXPORT_PRIVATE DelegateInterface {
38 public: 38 public:
39 virtual ~DelegateInterface() {} 39 virtual ~DelegateInterface() {}
40 // Called when a packet is serialized. Delegate does not take the ownership 40 // Called when a packet is serialized. Delegate does not take the ownership
41 // of |serialized_packet|. 41 // of |serialized_packet|, but may take ownership of |packet.packet|
42 // and |packet.retransmittable_frames|. If it does so, they must be set
43 // to nullptr.
42 virtual void OnSerializedPacket(SerializedPacket* serialized_packet) = 0; 44 virtual void OnSerializedPacket(SerializedPacket* serialized_packet) = 0;
45 virtual void CloseConnection(QuicErrorCode error, bool from_peer) = 0;
43 // Called when current FEC group is reset (closed). 46 // Called when current FEC group is reset (closed).
44 virtual void OnResetFecGroup() = 0; 47 virtual void OnResetFecGroup() = 0;
45 }; 48 };
46 49
47 // Interface which gets callbacks from the QuicPacketCreator at interesting 50 // Interface which gets callbacks from the QuicPacketCreator at interesting
48 // points. Implementations must not mutate the state of the creator 51 // points. Implementations must not mutate the state of the creator
49 // as a result of these callbacks. 52 // as a result of these callbacks.
50 class NET_EXPORT_PRIVATE DebugDelegate { 53 class NET_EXPORT_PRIVATE DebugDelegate {
51 public: 54 public:
52 virtual ~DebugDelegate() {} 55 virtual ~DebugDelegate() {}
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 size_t PacketSize() const; 173 size_t PacketSize() const;
171 174
172 // Tries to add |frame| to the packet creator's list of frames to be 175 // Tries to add |frame| to the packet creator's list of frames to be
173 // serialized. If the frame does not fit into the current packet, flushes the 176 // serialized. If the frame does not fit into the current packet, flushes the
174 // packet and returns false. 177 // packet and returns false.
175 bool AddSavedFrame(const QuicFrame& frame); 178 bool AddSavedFrame(const QuicFrame& frame);
176 179
177 // Identical to AddSavedFrame, but allows the frame to be padded. 180 // Identical to AddSavedFrame, but allows the frame to be padded.
178 bool AddPaddedSavedFrame(const QuicFrame& frame); 181 bool AddPaddedSavedFrame(const QuicFrame& frame);
179 182
183 // Adds |listener| to the next serialized packet and notifies the
184 // std::listener
185 // with |length| as the number of acked bytes.
186 void AddAckListener(QuicAckListenerInterface* listener,
187 QuicPacketLength length);
188
180 // Creates a version negotiation packet which supports |supported_versions|. 189 // Creates a version negotiation packet which supports |supported_versions|.
181 // Caller owns the created packet. Also, sets the entropy hash of the 190 // Caller owns the created packet. Also, sets the entropy hash of the
182 // serialized packet to a random bool and returns that value as a member of 191 // serialized packet to a random bool and returns that value as a member of
183 // SerializedPacket. 192 // SerializedPacket.
184 QuicEncryptedPacket* SerializeVersionNegotiationPacket( 193 QuicEncryptedPacket* SerializeVersionNegotiationPacket(
185 const QuicVersionVector& supported_versions); 194 const QuicVersionVector& supported_versions);
186 195
187 // Returns a dummy packet that is valid but contains no useful information. 196 // Returns a dummy packet that is valid but contains no useful information.
188 static SerializedPacket NoPacket(); 197 static SerializedPacket NoPacket();
189 198
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 // Serializes all frames which have been added and adds any which should be 333 // Serializes all frames which have been added and adds any which should be
325 // retransmitted to queued_retransmittable_frames_ if it's not nullptr. All 334 // retransmitted to queued_retransmittable_frames_ if it's not nullptr. All
326 // frames must fit into a single packet. Sets the entropy hash of the 335 // frames must fit into a single packet. Sets the entropy hash of the
327 // serialized packet to a random bool and returns that value as a member of 336 // serialized packet to a random bool and returns that value as a member of
328 // SerializedPacket. Also, sets |serialized_frames| in the SerializedPacket to 337 // SerializedPacket. Also, sets |serialized_frames| in the SerializedPacket to
329 // the corresponding RetransmittableFrames if any frames are to be 338 // the corresponding RetransmittableFrames if any frames are to be
330 // retransmitted. 339 // retransmitted.
331 // Fails if |buffer_len| isn't long enough for the encrypted packet. 340 // Fails if |buffer_len| isn't long enough for the encrypted packet.
332 SerializedPacket SerializePacket(char* encrypted_buffer, size_t buffer_len); 341 SerializedPacket SerializePacket(char* encrypted_buffer, size_t buffer_len);
333 342
343 // Called after a new SerialiedPacket is created to call the delegate's
344 // OnSerializedPacket, reset state, and potentially flush FEC groups.
345 void OnSerializedPacket(SerializedPacket* packet);
346
334 // Turn on FEC protection for subsequent packets. If no FEC group is currently 347 // Turn on FEC protection for subsequent packets. If no FEC group is currently
335 // open, this method flushes current open packet and then turns FEC on. 348 // open, this method flushes current open packet and then turns FEC on.
336 void MaybeStartFecProtection(); 349 void MaybeStartFecProtection();
337 350
338 // Turn on FEC protection for subsequently created packets. FEC should be 351 // Turn on FEC protection for subsequently created packets. FEC should be
339 // enabled first (max_packets_per_fec_group should be non-zero) for FEC 352 // enabled first (max_packets_per_fec_group should be non-zero) for FEC
340 // protection to start. 353 // protection to start.
341 void StartFecProtectingPackets(); 354 void StartFecProtectingPackets();
342 355
343 // Turn off FEC protection for subsequently created packets. If the creator 356 // Turn off FEC protection for subsequently created packets. If the creator
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 // is empty. 415 // is empty.
403 mutable QuicPacketNumberLength packet_number_length_; 416 mutable QuicPacketNumberLength packet_number_length_;
404 // packet_size_ is mutable because it's just a cache of the current size. 417 // packet_size_ is mutable because it's just a cache of the current size.
405 // packet_size should never be read directly, use PacketSize() instead. 418 // packet_size should never be read directly, use PacketSize() instead.
406 mutable size_t packet_size_; 419 mutable size_t packet_size_;
407 mutable size_t max_plaintext_size_; 420 mutable size_t max_plaintext_size_;
408 QuicFrames queued_frames_; 421 QuicFrames queued_frames_;
409 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_; 422 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_;
410 // If true, the packet will be padded up to |max_packet_length_|. 423 // If true, the packet will be padded up to |max_packet_length_|.
411 bool needs_padding_; 424 bool needs_padding_;
425 // Stores ack std::listeners that should be attached to the next packet.
426 std::list<AckListenerWrapper> ack_listeners_;
427
412 // FEC policy that specifies when to send FEC packet. 428 // FEC policy that specifies when to send FEC packet.
413 FecSendPolicy fec_send_policy_; 429 FecSendPolicy fec_send_policy_;
414 // Timeout used for FEC alarm. Can be set to zero initially or if the SRTT has 430 // Timeout used for FEC alarm. Can be set to zero initially or if the SRTT has
415 // not yet been set. 431 // not yet been set.
416 QuicTime::Delta fec_timeout_; 432 QuicTime::Delta fec_timeout_;
417 // The multiplication factor for FEC timeout based on RTT. 433 // The multiplication factor for FEC timeout based on RTT.
418 // TODO(rtenneti): Delete this code after the 0.25 RTT FEC experiment. 434 // TODO(rtenneti): Delete this code after the 0.25 RTT FEC experiment.
419 float rtt_multiplier_for_fec_timeout_; 435 float rtt_multiplier_for_fec_timeout_;
420 436
421 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); 437 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator);
422 }; 438 };
423 439
424 } // namespace net 440 } // namespace net
425 441
426 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ 442 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_
OLDNEW
« no previous file with comments | « net/quic/quic_connection_test.cc ('k') | net/quic/quic_packet_creator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698