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

Unified Diff: net/quic/quic_packet_creator.h

Issue 288313003: Land Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: implemented rch's comments Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: net/quic/quic_packet_creator.h
diff --git a/net/quic/quic_packet_creator.h b/net/quic/quic_packet_creator.h
index 95c0847178c31ce91cb53e76e334899d9feda760..f8b60ee16f8f77c24b60d87b0936e576e6e162e2 100644
--- a/net/quic/quic_packet_creator.h
+++ b/net/quic/quic_packet_creator.h
@@ -57,10 +57,27 @@ class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface {
virtual void OnBuiltFecProtectedPayload(const QuicPacketHeader& header,
base::StringPiece payload) OVERRIDE;
+ // Turn on FEC protection for subsequently created packets. FEC should
+ // be enabled first (set_max_packets_per_fec_group should be non-zero) for
wtc 2014/05/19 18:58:40 Typo: It seems that "set_max_packets_per_fec_group
ramant (doing other things) 2014/05/20 03:22:32 Done.
+ // FEC protection to start.
+ void StartFecProtectingPackets();
+
+ // Turn off FEC protection for subsequently created packets. If the creator
+ // has any open fec group, call will fail. It is the caller's responsibility
+ // to flush out FEC packets in generation, and to verify with ShouldSendFec()
+ // that there is no open FEC group.
+ void StopFecProtectingPackets();
+
// Checks if it's time to send an FEC packet. |force_close| forces this to
// return true if an fec group is open.
bool ShouldSendFec(bool force_close) const;
+ // Returns current max number of packets covered by an FEC group.
+ size_t max_packets_per_fec_group() const;
+
+ // Sets creator's max number of packets covered by an FEC group.
+ void set_max_packets_per_fec_group(size_t max_packets_per_fec_group);
+
// Makes the framer not serialize the protocol version in sent packets.
void StopSendingVersion();
@@ -109,19 +126,23 @@ class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface {
// Re-serializes frames with the original packet's sequence number length.
// Used for retransmitting packets to ensure they aren't too long.
+ // Caller must ensure that any open FEC group are closed before calling this
wtc 2014/05/19 18:58:40 Nit: the subject "any open FEC group" (singular) a
ramant (doing other things) 2014/05/20 03:22:32 Done.
+ // method.
SerializedPacket ReserializeAllFrames(
const QuicFrames& frames, QuicSequenceNumberLength original_length);
// Returns true if there are frames pending to be serialized.
bool HasPendingFrames();
- // Returns IN_FEC_GROUP or NOT_IN_FEC_GROUP, depending on whether FEC is
- // enabled or not. Note: This does not mean that an FEC group is currently
- // active; i.e., fec_group_.get() may still be NULL.
- // TODO(jri): Straighten out naming: Enabling FEC for the connection
- // should use FEC_ENABLED/DISABLED, and IN_FEC_GROUP/NOT_IN_FEC_GROUP should
- // be used if a given packet is in an fec group.
- InFecGroup IsFecEnabled() const;
+ // Returns whether FEC protection is currently enabled. Note: Enabled does not
+ // mean that an FEC group is currently active; i.e., IsFecProtected() may
+ // still return NOT_IN_FEC_GROUP, and fec_group_.get() may still be NULL.
wtc 2014/05/19 18:58:40 Nit: "IsFecProtected() may still return NOT_IN_FEC
ramant (doing other things) 2014/05/20 03:22:32 jri and I went through the code and updated the co
+ bool IsFecEnabled() const;
+
+ // Returns true if subsequent packets will be FEC protected. Note: True does
+ // not mean that an FEC packet is currently under construction; i.e.,
+ // fec_group_.get() may still be NULL, until MaybeStartFec() is called.
+ bool IsFecProtected() const;
// Returns the number of bytes which are available to be used by additional
// frames in the packet. Since stream frames are slightly smaller when they
@@ -202,7 +223,7 @@ class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface {
// Starts a new FEC group with the next serialized packet, if FEC is enabled
// and there is not already an FEC group open.
- InFecGroup MaybeStartFEC();
+ InFecGroup MaybeStartFec();
void FillPacketHeader(QuicFecGroupNumber fec_group,
bool fec_flag,
@@ -223,6 +244,8 @@ class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface {
QuicFramer* framer_;
scoped_ptr<QuicRandomBoolSource> random_bool_source_;
QuicPacketSequenceNumber sequence_number_;
+ // If true, any created packets will be FEC protected.
+ bool should_fec_protect_;
QuicFecGroupNumber fec_group_number_;
scoped_ptr<QuicFecGroup> fec_group_;
// bool to keep track if this packet creator is being used the server.

Powered by Google App Engine
This is Rietveld 408576698