Specifies a storage class for several enum types in //third_party/http2/...

These enums do not need more than 8 bits to represent the defined values.

#cleanup

Protected by refactoring, no functional change.

PiperOrigin-RevId: 839758250
diff --git a/quiche/http2/adapter/header_validator.h b/quiche/http2/adapter/header_validator.h
index ef55948..d75e1e8 100644
--- a/quiche/http2/adapter/header_validator.h
+++ b/quiche/http2/adapter/header_validator.h
@@ -44,7 +44,7 @@
   static bool IsValidPath(absl::string_view path, bool allow_fragment);
 
  private:
-  enum ContentLengthStatus {
+  enum ContentLengthStatus : uint8_t {
     CONTENT_LENGTH_OK,
     CONTENT_LENGTH_SKIP,  // Used to handle duplicate content length values.
     CONTENT_LENGTH_ERROR,
@@ -52,7 +52,7 @@
   ContentLengthStatus HandleContentLength(absl::string_view value);
   bool ValidateAndSetAuthority(absl::string_view authority);
 
-  enum PseudoHeaderTag {
+  enum PseudoHeaderTag : uint8_t {
     TAG_AUTHORITY = 0,
     TAG_METHOD,
     TAG_PATH,
@@ -66,7 +66,7 @@
 
   using PseudoHeaderTagSet = std::bitset<TAG_ENUM_SIZE>;
 
-  enum PseudoHeaderState {
+  enum PseudoHeaderState : uint8_t {
     STATE_AUTHORITY_IS_NONEMPTY,
     STATE_METHOD_IS_OPTIONS,
     STATE_METHOD_IS_CONNECT,
diff --git a/quiche/http2/adapter/header_validator_base.h b/quiche/http2/adapter/header_validator_base.h
index 416c3aa..3fcdcbb 100644
--- a/quiche/http2/adapter/header_validator_base.h
+++ b/quiche/http2/adapter/header_validator_base.h
@@ -35,7 +35,7 @@
     content_length_ = std::nullopt;
   }
 
-  enum HeaderStatus {
+  enum HeaderStatus : uint8_t {
     HEADER_OK,
     HEADER_SKIP,
     HEADER_FIELD_INVALID,
diff --git a/quiche/http2/adapter/oghttp2_session.h b/quiche/http2/adapter/oghttp2_session.h
index a120b15..19d3545 100644
--- a/quiche/http2/adapter/oghttp2_session.h
+++ b/quiche/http2/adapter/oghttp2_session.h
@@ -92,7 +92,7 @@
     // If true, allows a GOAWAY to be sent even when acting as a client.
     bool send_goaway_as_client = false;
     // Specifies the behavior of the HPACK encoder when compressing headers.
-    enum CompressionOption {
+    enum CompressionOption : uint8_t {
       ENABLE_COMPRESSION,   // Dynamic table enabled, Huffman enabled.
       DISABLE_COMPRESSION,  // Dynamic table disabled, Huffman disabled.
       DISABLE_HUFFMAN,      // Dynamic table enabled, Huffman disabled.
@@ -344,7 +344,7 @@
 
   void SendWindowUpdate(Http2StreamId stream_id, size_t update_delta);
 
-  enum class SendResult {
+  enum class SendResult : uint8_t {
     // All data was flushed.
     SEND_OK,
     // Not all data was flushed (due to flow control or TCP back pressure).
@@ -356,7 +356,7 @@
   // Returns the int corresponding to the `result`, updating state as needed.
   int InterpretSendResult(SendResult result);
 
-  enum class ProcessBytesError {
+  enum class ProcessBytesError : uint8_t {
     // A general, unspecified error.
     kUnspecified,
     // The (server-side) session received an invalid client connection preface.
diff --git a/quiche/http2/core/spdy_framer.h b/quiche/http2/core/spdy_framer.h
index 5e81caf..391cb17 100644
--- a/quiche/http2/core/spdy_framer.h
+++ b/quiche/http2/core/spdy_framer.h
@@ -44,7 +44,7 @@
 
 class QUICHE_EXPORT SpdyFramer {
  public:
-  enum CompressionOption {
+  enum CompressionOption : uint8_t {
     // Both the dynamic table and Huffman compression are enabled.
     ENABLE_COMPRESSION,
     // Both the dynamic table and Huffman compression are disabled.
diff --git a/quiche/http2/decoder/http2_frame_decoder.h b/quiche/http2/decoder/http2_frame_decoder.h
index 8baaab0..cef9e99 100644
--- a/quiche/http2/decoder/http2_frame_decoder.h
+++ b/quiche/http2/decoder/http2_frame_decoder.h
@@ -104,7 +104,7 @@
   uint32_t remaining_padding() const;
 
  private:
-  enum class State {
+  enum class State : uint8_t {
     // Ready to start decoding a new frame's header.
     kStartDecodingHeader,
     // Was in state kStartDecodingHeader, but unable to read the entire frame
diff --git a/quiche/http2/hpack/http2_hpack_constants.h b/quiche/http2/hpack/http2_hpack_constants.h
index 1deaf05..88feee8 100644
--- a/quiche/http2/hpack/http2_hpack_constants.h
+++ b/quiche/http2/hpack/http2_hpack_constants.h
@@ -19,7 +19,7 @@
 
 const size_t kFirstDynamicTableIndex = 62;
 
-enum class HpackEntryType {
+enum class HpackEntryType : uint8_t {
   // Entry is an index into the static or dynamic table. Decoding it has no
   // effect on the dynamic table.
   kIndexedHeader,
diff --git a/quiche/http2/hpack/http2_hpack_constants_test.cc b/quiche/http2/hpack/http2_hpack_constants_test.cc
index 39bacd4..dbfc3a0 100644
--- a/quiche/http2/hpack/http2_hpack_constants_test.cc
+++ b/quiche/http2/hpack/http2_hpack_constants_test.cc
@@ -24,8 +24,8 @@
             HpackEntryTypeToString(HpackEntryType::kUnindexedLiteralHeader));
   EXPECT_EQ("kNeverIndexedLiteralHeader",
             HpackEntryTypeToString(HpackEntryType::kNeverIndexedLiteralHeader));
-  EXPECT_EQ("UnknownHpackEntryType(12321)",
-            HpackEntryTypeToString(static_cast<HpackEntryType>(12321)));
+  EXPECT_EQ("UnknownHpackEntryType(123)",
+            HpackEntryTypeToString(static_cast<HpackEntryType>(123)));
 }
 
 TEST(HpackEntryTypeTest, OutputHpackEntryType) {
@@ -56,8 +56,8 @@
   }
   {
     std::stringstream log;
-    log << static_cast<HpackEntryType>(1234321);
-    EXPECT_EQ("UnknownHpackEntryType(1234321)", log.str());
+    log << static_cast<HpackEntryType>(124);
+    EXPECT_EQ("UnknownHpackEntryType(124)", log.str());
   }
 }