Move PRIORITY frame constants into http_frames.h.

Change type from size_t to the more appropriate QuicByteCount.  Also, use
kPriorityExclusiveBit in decoder.

gfe-relnote: n/a, QUIC v99-only refactor.
PiperOrigin-RevId: 258670873
Change-Id: I9dd825a86b983a1f95f6809460310d96713b053c
diff --git a/quic/core/http/http_decoder.cc b/quic/core/http/http_decoder.cc
index faffdc9..ef871ab 100644
--- a/quic/core/http/http_decoder.cc
+++ b/quic/core/http/http_decoder.cc
@@ -13,14 +13,6 @@
 
 namespace quic {
 
-namespace {
-// Length of the weight field of a priority frame.
-static const size_t kPriorityWeightLength = 1;
-// Length of a priority frame's first byte.
-static const size_t kPriorityFirstByteLength = 1;
-
-}  // namespace
-
 HttpDecoder::HttpDecoder(Visitor* visitor)
     : visitor_(visitor),
       state_(STATE_READING_FRAME_TYPE),
@@ -464,7 +456,10 @@
   frame->prioritized_type = static_cast<PriorityElementType>((flags >> 6) & 3);
   // Assign the next two most significant bits to dependency type.
   frame->dependency_type = static_cast<PriorityElementType>((flags >> 4) & 3);
-  frame->exclusive = flags >> 3 & 1;
+  frame->exclusive = flags & kPriorityExclusiveBit;
+  // TODO(bnc): Close connection with HTTP_MALFORMED_FRAME
+  // if lowest three bits are not all zero.
+
   // TODO(b/137359636): Handle partial delivery.
   if (frame->prioritized_type != ROOT_OF_TREE &&
       !reader->ReadVarInt62(&frame->prioritized_element_id)) {
diff --git a/quic/core/http/http_encoder.cc b/quic/core/http/http_encoder.cc
index 2306b8e..b97f7f7 100644
--- a/quic/core/http/http_encoder.cc
+++ b/quic/core/http/http_encoder.cc
@@ -40,13 +40,6 @@
   }
 }
 
-// Length of the weight field of a priority frame.
-static const size_t kPriorityWeightLength = 1;
-// Length of a priority frame's first byte.
-static const size_t kPriorityFirstByteLength = 1;
-// The bit that indicates Priority frame is exclusive.
-static const uint8_t kPriorityExclusiveBit = 8;
-
 }  // namespace
 
 HttpEncoder::HttpEncoder() {}
diff --git a/quic/core/http/http_frames.h b/quic/core/http/http_frames.h
index b84b658..ac590e6 100644
--- a/quic/core/http/http_frames.h
+++ b/quic/core/http/http_frames.h
@@ -49,6 +49,14 @@
 //
 //   The PRIORITY (type=0x02) frame specifies the sender-advised priority
 //   of a stream
+
+// Length of the weight field of a priority frame.
+const QuicByteCount kPriorityWeightLength = 1;
+// Length of a priority frame's first byte.
+const QuicByteCount kPriorityFirstByteLength = 1;
+// The bit that indicates Priority frame is exclusive.
+const uint8_t kPriorityExclusiveBit = 8;
+
 enum PriorityElementType : uint8_t {
   REQUEST_STREAM = 0,
   PUSH_STREAM = 1,