Index: net/quic/quic_protocol.h |
diff --git a/net/quic/quic_protocol.h b/net/quic/quic_protocol.h |
index eb80b7d39b710df8184ede173fcf97aa370d4132..b524aa40c429a46ea0878459669cc2837a92dfe6 100644 |
--- a/net/quic/quic_protocol.h |
+++ b/net/quic/quic_protocol.h |
@@ -690,13 +690,11 @@ enum QuicVersionNegotiationState { |
typedef QuicPacketPublicHeader QuicVersionNegotiationPacket; |
// A padding frame contains no payload. |
-struct NET_EXPORT_PRIVATE QuicPaddingFrame { |
-}; |
+struct NET_EXPORT_PRIVATE QuicPaddingFrame {}; |
// A ping frame contains no payload, though it is retransmittable, |
// and ACK'd just like other normal frames. |
-struct NET_EXPORT_PRIVATE QuicPingFrame { |
-}; |
+struct NET_EXPORT_PRIVATE QuicPingFrame {}; |
// A path MTU discovery frame contains no payload and is serialized as a ping |
// frame. |
@@ -999,39 +997,43 @@ enum EncryptionLevel { |
struct NET_EXPORT_PRIVATE QuicFrame { |
QuicFrame(); |
- explicit QuicFrame(QuicPaddingFrame* padding_frame); |
+ explicit QuicFrame(QuicPaddingFrame padding_frame); |
+ explicit QuicFrame(QuicMtuDiscoveryFrame frame); |
+ explicit QuicFrame(QuicPingFrame frame); |
+ explicit QuicFrame(QuicBlockedFrame frame); |
+ |
explicit QuicFrame(QuicStreamFrame* stream_frame); |
explicit QuicFrame(QuicAckFrame* frame); |
- explicit QuicFrame(QuicMtuDiscoveryFrame* frame); |
- |
explicit QuicFrame(QuicRstStreamFrame* frame); |
explicit QuicFrame(QuicConnectionCloseFrame* frame); |
explicit QuicFrame(QuicStopWaitingFrame* frame); |
- explicit QuicFrame(QuicPingFrame* frame); |
explicit QuicFrame(QuicGoAwayFrame* frame); |
explicit QuicFrame(QuicWindowUpdateFrame* frame); |
- explicit QuicFrame(QuicBlockedFrame* frame); |
NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
std::ostream& os, const QuicFrame& frame); |
QuicFrameType type; |
union { |
- QuicPaddingFrame* padding_frame; |
+ // Frames smaller than a pointer are inline. |
+ QuicPaddingFrame padding_frame; |
+ QuicMtuDiscoveryFrame mtu_discovery_frame; |
+ QuicPingFrame ping_frame; |
+ QuicBlockedFrame blocked_frame; |
+ |
+ // Frames larger than a pointer. |
QuicStreamFrame* stream_frame; |
QuicAckFrame* ack_frame; |
- QuicMtuDiscoveryFrame* mtu_discovery_frame; |
- |
QuicStopWaitingFrame* stop_waiting_frame; |
- |
- QuicPingFrame* ping_frame; |
QuicRstStreamFrame* rst_stream_frame; |
QuicConnectionCloseFrame* connection_close_frame; |
QuicGoAwayFrame* goaway_frame; |
QuicWindowUpdateFrame* window_update_frame; |
- QuicBlockedFrame* blocked_frame; |
}; |
}; |
+// QuicFrameType consumes 8 bytes with padding. |
+static_assert(sizeof(QuicFrame) <= 16, |
+ "Frames larger than 8 bytes should be referenced by pointer."); |
typedef std::vector<QuicFrame> QuicFrames; |