Make HttpEncoder methods static.
This class stores no state, no need to ever instantiate it.
gfe-relnote: n/a, no functional change.
PiperOrigin-RevId: 277333157
Change-Id: I9ea319aa186b975325a70a321a50259eaec47093
diff --git a/quic/core/http/http_encoder.h b/quic/core/http/http_encoder.h
index 12c5bab..4420fc6 100644
--- a/quic/core/http/http_encoder.h
+++ b/quic/core/http/http_encoder.h
@@ -17,68 +17,59 @@
// session.
class QUIC_EXPORT_PRIVATE HttpEncoder {
public:
- HttpEncoder();
-
- ~HttpEncoder();
+ HttpEncoder() = delete;
// Serializes a DATA frame header into a new buffer stored in |output|.
// Returns the length of the buffer on success, or 0 otherwise.
- QuicByteCount SerializeDataFrameHeader(QuicByteCount payload_length,
- std::unique_ptr<char[]>* output);
+ static QuicByteCount SerializeDataFrameHeader(
+ QuicByteCount payload_length,
+ std::unique_ptr<char[]>* output);
// Serializes a HEADERS frame header into a new buffer stored in |output|.
// Returns the length of the buffer on success, or 0 otherwise.
- QuicByteCount SerializeHeadersFrameHeader(QuicByteCount payload_length,
- std::unique_ptr<char[]>* output);
+ static QuicByteCount SerializeHeadersFrameHeader(
+ QuicByteCount payload_length,
+ std::unique_ptr<char[]>* output);
// Serializes a PRIORITY frame into a new buffer stored in |output|.
// Returns the length of the buffer on success, or 0 otherwise.
- QuicByteCount SerializePriorityFrame(const PriorityFrame& priority,
- std::unique_ptr<char[]>* output);
+ static QuicByteCount SerializePriorityFrame(const PriorityFrame& priority,
+ std::unique_ptr<char[]>* output);
// Serializes a CANCEL_PUSH frame into a new buffer stored in |output|.
// Returns the length of the buffer on success, or 0 otherwise.
- QuicByteCount SerializeCancelPushFrame(const CancelPushFrame& cancel_push,
- std::unique_ptr<char[]>* output);
+ static QuicByteCount SerializeCancelPushFrame(
+ const CancelPushFrame& cancel_push,
+ std::unique_ptr<char[]>* output);
// Serializes a SETTINGS frame into a new buffer stored in |output|.
// Returns the length of the buffer on success, or 0 otherwise.
- QuicByteCount SerializeSettingsFrame(const SettingsFrame& settings,
- std::unique_ptr<char[]>* output);
+ static QuicByteCount SerializeSettingsFrame(const SettingsFrame& settings,
+ std::unique_ptr<char[]>* output);
// Serializes the header and push_id of a PUSH_PROMISE frame into a new buffer
// stored in |output|. Returns the length of the buffer on success, or 0
// otherwise.
- QuicByteCount SerializePushPromiseFrameWithOnlyPushId(
+ static QuicByteCount SerializePushPromiseFrameWithOnlyPushId(
const PushPromiseFrame& push_promise,
std::unique_ptr<char[]>* output);
// Serializes a GOAWAY frame into a new buffer stored in |output|.
// Returns the length of the buffer on success, or 0 otherwise.
- QuicByteCount SerializeGoAwayFrame(const GoAwayFrame& goaway,
- std::unique_ptr<char[]>* output);
+ static QuicByteCount SerializeGoAwayFrame(const GoAwayFrame& goaway,
+ std::unique_ptr<char[]>* output);
// Serializes a MAX_PUSH frame into a new buffer stored in |output|.
// Returns the length of the buffer on success, or 0 otherwise.
- QuicByteCount SerializeMaxPushIdFrame(const MaxPushIdFrame& max_push_id,
- std::unique_ptr<char[]>* output);
+ static QuicByteCount SerializeMaxPushIdFrame(
+ const MaxPushIdFrame& max_push_id,
+ std::unique_ptr<char[]>* output);
// Serialize a DUPLICATE_PUSH frame into a new buffer stored in |output|.
// Returns the length of the buffer on success, or 0 otherwise.
- QuicByteCount SerializeDuplicatePushFrame(
+ static QuicByteCount SerializeDuplicatePushFrame(
const DuplicatePushFrame& duplicate_push,
std::unique_ptr<char[]>* output);
-
- private:
- bool WriteFrameHeader(QuicByteCount length,
- HttpFrameType type,
- QuicDataWriter* writer);
-
- QuicByteCount GetTotalLength(QuicByteCount payload_length,
- HttpFrameType type);
-
- // Write prioritized element id and element dependency id if needed.
- bool MaybeWriteIds(const PriorityFrame& priority, QuicDataWriter* writer);
};
} // namespace quic