Make HTTP/2 logging use QUICHE logging

Also replace (D)CHECK with QUICHE_(D)CHECK.

PiperOrigin-RevId: 355220010
Change-Id: If829acb1f1669ef581f356c0d584b7275894bed9
diff --git a/http2/hpack/decoder/hpack_block_collector.cc b/http2/hpack/decoder/hpack_block_collector.cc
index f77100a..677f55a 100644
--- a/http2/hpack/decoder/hpack_block_collector.cc
+++ b/http2/hpack/decoder/hpack_block_collector.cc
@@ -95,7 +95,7 @@
 
 void HpackBlockCollector::AppendToHpackBlockBuilder(
     HpackBlockBuilder* hbb) const {
-  CHECK(IsNotPending());
+  QUICHE_CHECK(IsNotPending());
   for (const auto& entry : entries_) {
     entry.AppendToHpackBlockBuilder(hbb);
   }
diff --git a/http2/hpack/decoder/hpack_block_decoder.cc b/http2/hpack/decoder/hpack_block_decoder.cc
index c609f27..9c63f03 100644
--- a/http2/hpack/decoder/hpack_block_decoder.cc
+++ b/http2/hpack/decoder/hpack_block_decoder.cc
@@ -24,14 +24,14 @@
         before_entry_ = true;
         break;
       case DecodeStatus::kDecodeInProgress:
-        DCHECK_EQ(0u, db->Remaining());
+        QUICHE_DCHECK_EQ(0u, db->Remaining());
         return DecodeStatus::kDecodeInProgress;
       case DecodeStatus::kDecodeError:
         HTTP2_CODE_COUNT_N(decompress_failure_3, 1, 23);
         return DecodeStatus::kDecodeError;
     }
   }
-  DCHECK(before_entry_);
+  QUICHE_DCHECK(before_entry_);
   while (db->HasData()) {
     HTTP2_DVLOG(2) << "HpackBlockDecoder::Decode start entry, db->Remaining="
                    << db->Remaining();
@@ -40,16 +40,16 @@
       case DecodeStatus::kDecodeDone:
         continue;
       case DecodeStatus::kDecodeInProgress:
-        DCHECK_EQ(0u, db->Remaining());
+        QUICHE_DCHECK_EQ(0u, db->Remaining());
         before_entry_ = false;
         return DecodeStatus::kDecodeInProgress;
       case DecodeStatus::kDecodeError:
         HTTP2_CODE_COUNT_N(decompress_failure_3, 2, 23);
         return DecodeStatus::kDecodeError;
     }
-    DCHECK(false);
+    QUICHE_DCHECK(false);
   }
-  DCHECK(before_entry_);
+  QUICHE_DCHECK(before_entry_);
   return DecodeStatus::kDecodeDone;
 }
 
diff --git a/http2/hpack/decoder/hpack_block_decoder.h b/http2/hpack/decoder/hpack_block_decoder.h
index 2f28c4e..3d956b1 100644
--- a/http2/hpack/decoder/hpack_block_decoder.h
+++ b/http2/hpack/decoder/hpack_block_decoder.h
@@ -26,7 +26,7 @@
  public:
   explicit HpackBlockDecoder(HpackEntryDecoderListener* listener)
       : listener_(listener) {
-    DCHECK_NE(listener_, nullptr);
+    QUICHE_DCHECK_NE(listener_, nullptr);
   }
   ~HpackBlockDecoder() {}
 
diff --git a/http2/hpack/decoder/hpack_decoder.cc b/http2/hpack/decoder/hpack_decoder.cc
index d1552de..45d7a78 100644
--- a/http2/hpack/decoder/hpack_decoder.cc
+++ b/http2/hpack/decoder/hpack_decoder.cc
@@ -69,7 +69,8 @@
     return false;
   }
   // Should be positioned between entries iff decoding is complete.
-  DCHECK_EQ(block_decoder_.before_entry(), status == DecodeStatus::kDecodeDone)
+  QUICHE_DCHECK_EQ(block_decoder_.before_entry(),
+                   status == DecodeStatus::kDecodeDone)
       << status;
   if (!block_decoder_.before_entry()) {
     entry_buffer_.BufferStringsIfUnbuffered();
diff --git a/http2/hpack/decoder/hpack_decoder_state.cc b/http2/hpack/decoder/hpack_decoder_state.cc
index 6e234af..528f1b6 100644
--- a/http2/hpack/decoder/hpack_decoder_state.cc
+++ b/http2/hpack/decoder/hpack_decoder_state.cc
@@ -43,7 +43,7 @@
     uint32_t header_table_size) {
   HTTP2_DVLOG(2) << "HpackDecoderState::ApplyHeaderTableSizeSetting("
                  << header_table_size << ")";
-  DCHECK_LE(lowest_header_table_size_, final_header_table_size_);
+  QUICHE_DCHECK_LE(lowest_header_table_size_, final_header_table_size_);
   if (header_table_size < lowest_header_table_size_) {
     lowest_header_table_size_ = header_table_size;
   }
@@ -59,9 +59,9 @@
   // This instance can't be reused after an error has been detected, as we must
   // assume that the encoder and decoder compression states are no longer
   // synchronized.
-  DCHECK(error_ == HpackDecodingError::kOk)
+  QUICHE_DCHECK(error_ == HpackDecodingError::kOk)
       << HpackDecodingErrorToString(error_);
-  DCHECK_LE(lowest_header_table_size_, final_header_table_size_);
+  QUICHE_DCHECK_LE(lowest_header_table_size_, final_header_table_size_);
   allow_dynamic_table_size_update_ = true;
   saw_dynamic_table_size_update_ = false;
   // If the peer has acknowledged a HEADER_TABLE_SIZE smaller than that which
@@ -155,7 +155,7 @@
   if (error_ != HpackDecodingError::kOk) {
     return;
   }
-  DCHECK_LE(lowest_header_table_size_, final_header_table_size_);
+  QUICHE_DCHECK_LE(lowest_header_table_size_, final_header_table_size_);
   if (!allow_dynamic_table_size_update_) {
     // At most two dynamic table size updates allowed at the start, and not
     // after a header.
diff --git a/http2/hpack/decoder/hpack_decoder_string_buffer.cc b/http2/hpack/decoder/hpack_decoder_string_buffer.cc
index 3d31026..2a21846 100644
--- a/http2/hpack/decoder/hpack_decoder_string_buffer.cc
+++ b/http2/hpack/decoder/hpack_decoder_string_buffer.cc
@@ -62,7 +62,7 @@
 
 void HpackDecoderStringBuffer::Set(absl::string_view value, bool is_static) {
   HTTP2_DVLOG(2) << "HpackDecoderStringBuffer::Set";
-  DCHECK_EQ(state_, State::RESET);
+  QUICHE_DCHECK_EQ(state_, State::RESET);
   value_ = value;
   state_ = State::COMPLETE;
   backing_ = is_static ? Backing::STATIC : Backing::UNBUFFERED;
@@ -73,7 +73,7 @@
 
 void HpackDecoderStringBuffer::OnStart(bool huffman_encoded, size_t len) {
   HTTP2_DVLOG(2) << "HpackDecoderStringBuffer::OnStart";
-  DCHECK_EQ(state_, State::RESET);
+  QUICHE_DCHECK_EQ(state_, State::RESET);
 
   remaining_len_ = len;
   is_huffman_encoded_ = huffman_encoded;
@@ -107,12 +107,12 @@
 bool HpackDecoderStringBuffer::OnData(const char* data, size_t len) {
   HTTP2_DVLOG(2) << "HpackDecoderStringBuffer::OnData state=" << state_
                  << ", backing=" << backing_;
-  DCHECK_EQ(state_, State::COLLECTING);
-  DCHECK_LE(len, remaining_len_);
+  QUICHE_DCHECK_EQ(state_, State::COLLECTING);
+  QUICHE_DCHECK_LE(len, remaining_len_);
   remaining_len_ -= len;
 
   if (is_huffman_encoded_) {
-    DCHECK_EQ(backing_, Backing::BUFFERED);
+    QUICHE_DCHECK_EQ(backing_, Backing::BUFFERED);
     return decoder_.Decode(absl::string_view(data, len), &buffer_);
   }
 
@@ -136,7 +136,7 @@
 
   // This is not the first call to OnData for this string, so it should be
   // buffered.
-  DCHECK_EQ(backing_, Backing::BUFFERED);
+  QUICHE_DCHECK_EQ(backing_, Backing::BUFFERED);
 
   // Append to the current contents of the buffer.
   buffer_.append(data, len);
@@ -145,11 +145,11 @@
 
 bool HpackDecoderStringBuffer::OnEnd() {
   HTTP2_DVLOG(2) << "HpackDecoderStringBuffer::OnEnd";
-  DCHECK_EQ(state_, State::COLLECTING);
-  DCHECK_EQ(0u, remaining_len_);
+  QUICHE_DCHECK_EQ(state_, State::COLLECTING);
+  QUICHE_DCHECK_EQ(0u, remaining_len_);
 
   if (is_huffman_encoded_) {
-    DCHECK_EQ(backing_, Backing::BUFFERED);
+    QUICHE_DCHECK_EQ(backing_, Backing::BUFFERED);
     // Did the Huffman encoding of the string end properly?
     if (!decoder_.InputProperlyTerminated()) {
       return false;  // No, it didn't.
@@ -189,7 +189,7 @@
 
 absl::string_view HpackDecoderStringBuffer::str() const {
   HTTP2_DVLOG(3) << "HpackDecoderStringBuffer::str";
-  DCHECK_EQ(state_, State::COMPLETE);
+  QUICHE_DCHECK_EQ(state_, State::COMPLETE);
   return value_;
 }
 
@@ -202,8 +202,8 @@
 
 std::string HpackDecoderStringBuffer::ReleaseString() {
   HTTP2_DVLOG(3) << "HpackDecoderStringBuffer::ReleaseString";
-  DCHECK_EQ(state_, State::COMPLETE);
-  DCHECK_EQ(backing_, Backing::BUFFERED);
+  QUICHE_DCHECK_EQ(state_, State::COMPLETE);
+  QUICHE_DCHECK_EQ(backing_, Backing::BUFFERED);
   if (state_ == State::COMPLETE) {
     state_ = State::RESET;
     if (backing_ == Backing::BUFFERED) {
diff --git a/http2/hpack/decoder/hpack_decoder_tables.cc b/http2/hpack/decoder/hpack_decoder_tables.cc
index fa87b83..1b2cc11 100644
--- a/http2/hpack/decoder/hpack_decoder_tables.cc
+++ b/http2/hpack/decoder/hpack_decoder_tables.cc
@@ -15,8 +15,8 @@
   ptr->reserve(kFirstDynamicTableIndex);
   ptr->emplace_back("", "");
 
-#define STATIC_TABLE_ENTRY(name, value, index)        \
-  DCHECK_EQ(ptr->size(), static_cast<size_t>(index)); \
+#define STATIC_TABLE_ENTRY(name, value, index)               \
+  QUICHE_DCHECK_EQ(ptr->size(), static_cast<size_t>(index)); \
   ptr->emplace_back(name, value)
 
 #include "http2/hpack/hpack_static_table_entries.inc"
@@ -63,7 +63,7 @@
   HTTP2_DVLOG(3) << "HpackDecoderDynamicTable::DynamicTableSizeUpdate "
                  << size_limit;
   EnsureSizeNoMoreThan(size_limit);
-  DCHECK_LE(current_size_, size_limit);
+  QUICHE_DCHECK_LE(current_size_, size_limit);
   size_limit_ = size_limit;
 }
 
@@ -94,8 +94,8 @@
   table_.push_front(entry);
   current_size_ += entry_size;
   HTTP2_DVLOG(2) << "InsertEntry: current_size_=" << current_size_;
-  DCHECK_GE(current_size_, entry_size);
-  DCHECK_LE(current_size_, size_limit_);
+  QUICHE_DCHECK_GE(current_size_, entry_size);
+  QUICHE_DCHECK_LE(current_size_, size_limit_);
 }
 
 const HpackStringPair* HpackDecoderDynamicTable::Lookup(size_t index) const {
@@ -118,19 +118,19 @@
   while (current_size_ > limit) {
     RemoveLastEntry();
   }
-  DCHECK_LE(current_size_, limit);
+  QUICHE_DCHECK_LE(current_size_, limit);
 }
 
 void HpackDecoderDynamicTable::RemoveLastEntry() {
-  DCHECK(!table_.empty());
+  QUICHE_DCHECK(!table_.empty());
   if (!table_.empty()) {
     HTTP2_DVLOG(2) << "RemoveLastEntry current_size_=" << current_size_
                    << ", last entry size=" << table_.back().size();
-    DCHECK_GE(current_size_, table_.back().size());
+    QUICHE_DCHECK_GE(current_size_, table_.back().size());
     current_size_ -= table_.back().size();
     table_.pop_back();
     // Empty IFF current_size_ == 0.
-    DCHECK_EQ(table_.empty(), current_size_ == 0);
+    QUICHE_DCHECK_EQ(table_.empty(), current_size_ == 0);
   }
 }
 
diff --git a/http2/hpack/decoder/hpack_decoder_tables_test.cc b/http2/hpack/decoder/hpack_decoder_tables_test.cc
index 7978b7f..a3e4ee0 100644
--- a/http2/hpack/decoder/hpack_decoder_tables_test.cc
+++ b/http2/hpack/decoder/hpack_decoder_tables_test.cc
@@ -38,8 +38,8 @@
 std::vector<StaticEntry> MakeSpecStaticEntries() {
   std::vector<StaticEntry> static_entries;
 
-#define STATIC_TABLE_ENTRY(name, value, index)                      \
-  DCHECK_EQ(static_entries.size() + 1, static_cast<size_t>(index)); \
+#define STATIC_TABLE_ENTRY(name, value, index)                             \
+  QUICHE_DCHECK_EQ(static_entries.size() + 1, static_cast<size_t>(index)); \
   static_entries.push_back({name, value, index});
 
 #include "http2/hpack/hpack_static_table_entries.inc"
diff --git a/http2/hpack/decoder/hpack_entry_collector.cc b/http2/hpack/decoder/hpack_entry_collector.cc
index 97abea2..a228b6a 100644
--- a/http2/hpack/decoder/hpack_entry_collector.cc
+++ b/http2/hpack/decoder/hpack_entry_collector.cc
@@ -216,11 +216,11 @@
     case HpackEntryType::kNeverIndexedLiteralHeader:
       ASSERT_TRUE(value_.HasEnded()) << *this;
       if (index_ != 0) {
-        CHECK(name_.IsClear());
+        QUICHE_CHECK(name_.IsClear());
         hbb->AppendNameIndexAndLiteralValue(header_type_, index_,
                                             value_.huffman_encoded, value_.s);
       } else {
-        CHECK(name_.HasEnded()) << *this;
+        QUICHE_CHECK(name_.HasEnded()) << *this;
         hbb->AppendLiteralNameAndValue(header_type_, name_.huffman_encoded,
                                        name_.s, value_.huffman_encoded,
                                        value_.s);
diff --git a/http2/hpack/decoder/hpack_entry_decoder.cc b/http2/hpack/decoder/hpack_entry_decoder.cc
index 3cafde8..4e4a4da 100644
--- a/http2/hpack/decoder/hpack_entry_decoder.cc
+++ b/http2/hpack/decoder/hpack_entry_decoder.cc
@@ -57,9 +57,9 @@
 
 DecodeStatus HpackEntryDecoder::Start(DecodeBuffer* db,
                                       HpackEntryDecoderListener* listener) {
-  DCHECK(db != nullptr);
-  DCHECK(listener != nullptr);
-  DCHECK(db->HasData());
+  QUICHE_DCHECK(db != nullptr);
+  QUICHE_DCHECK(listener != nullptr);
+  QUICHE_DCHECK(db->HasData());
   DecodeStatus status = entry_type_decoder_.Start(db);
   switch (status) {
     case DecodeStatus::kDecodeDone:
@@ -76,7 +76,7 @@
     case DecodeStatus::kDecodeInProgress:
       // Hit the end of the decode buffer before fully decoding
       // the entry type and varint.
-      DCHECK_EQ(0u, db->Remaining());
+      QUICHE_DCHECK_EQ(0u, db->Remaining());
       state_ = EntryDecoderState::kResumeDecodingType;
       return status;
     case DecodeStatus::kDecodeError:
@@ -92,8 +92,8 @@
 
 DecodeStatus HpackEntryDecoder::Resume(DecodeBuffer* db,
                                        HpackEntryDecoderListener* listener) {
-  DCHECK(db != nullptr);
-  DCHECK(listener != nullptr);
+  QUICHE_DCHECK(db != nullptr);
+  QUICHE_DCHECK(listener != nullptr);
 
   DecodeStatus status;
 
diff --git a/http2/hpack/decoder/hpack_entry_type_decoder.cc b/http2/hpack/decoder/hpack_entry_type_decoder.cc
index 1cfc23a..99a0770 100644
--- a/http2/hpack/decoder/hpack_entry_type_decoder.cc
+++ b/http2/hpack/decoder/hpack_entry_type_decoder.cc
@@ -31,8 +31,8 @@
 // full HTTP/2 decoder level, but preferably still higher) to determine if the
 // alternatives that take less code/data space are preferable in that situation.
 DecodeStatus HpackEntryTypeDecoder::Start(DecodeBuffer* db) {
-  DCHECK(db != nullptr);
-  DCHECK(db->HasData());
+  QUICHE_DCHECK(db != nullptr);
+  QUICHE_DCHECK(db->HasData());
 
   // The high four bits (nibble) of first byte of the entry determine the type
   // of the entry, and may also be the initial bits of the varint that
diff --git a/http2/hpack/decoder/hpack_entry_type_decoder_test.cc b/http2/hpack/decoder/hpack_entry_type_decoder_test.cc
index c02988a..8852064 100644
--- a/http2/hpack/decoder/hpack_entry_type_decoder_test.cc
+++ b/http2/hpack/decoder/hpack_entry_type_decoder_test.cc
@@ -24,7 +24,7 @@
 class HpackEntryTypeDecoderTest : public RandomDecoderTest {
  protected:
   DecodeStatus StartDecoding(DecodeBuffer* b) override {
-    CHECK_LT(0u, b->Remaining());
+    QUICHE_CHECK_LT(0u, b->Remaining());
     return decoder_.Start(b);
   }
 
diff --git a/http2/hpack/decoder/hpack_string_decoder.h b/http2/hpack/decoder/hpack_string_decoder.h
index 252ab04..b861d23 100644
--- a/http2/hpack/decoder/hpack_string_decoder.h
+++ b/http2/hpack/decoder/hpack_string_decoder.h
@@ -154,7 +154,7 @@
   bool ResumeDecodingLength(DecodeBuffer* db,
                             Listener* cb,
                             DecodeStatus* status) {
-    DCHECK_EQ(state_, kResumeDecodingLength);
+    QUICHE_DCHECK_EQ(state_, kResumeDecodingLength);
     *status = length_decoder_.Resume(db);
     if (*status == DecodeStatus::kDecodeDone) {
       state_ = kDecodingString;
diff --git a/http2/hpack/decoder/hpack_whole_entry_buffer.cc b/http2/hpack/decoder/hpack_whole_entry_buffer.cc
index e546e23..76d1f31 100644
--- a/http2/hpack/decoder/hpack_whole_entry_buffer.cc
+++ b/http2/hpack/decoder/hpack_whole_entry_buffer.cc
@@ -55,7 +55,7 @@
 void HpackWholeEntryBuffer::OnNameStart(bool huffman_encoded, size_t len) {
   HTTP2_DVLOG(2) << "HpackWholeEntryBuffer::OnNameStart: huffman_encoded="
                  << (huffman_encoded ? "true" : "false") << ",  len=" << len;
-  DCHECK_EQ(maybe_name_index_, 0u);
+  QUICHE_DCHECK_EQ(maybe_name_index_, 0u);
   if (!error_detected_) {
     if (len > max_string_size_bytes_) {
       HTTP2_DVLOG(1) << "Name length (" << len << ") is longer than permitted ("
@@ -72,7 +72,7 @@
   HTTP2_DVLOG(2) << "HpackWholeEntryBuffer::OnNameData: len=" << len
                  << " data:\n"
                  << Http2HexDump(absl::string_view(data, len));
-  DCHECK_EQ(maybe_name_index_, 0u);
+  QUICHE_DCHECK_EQ(maybe_name_index_, 0u);
   if (!error_detected_ && !name_.OnData(data, len)) {
     ReportError(HpackDecodingError::kNameHuffmanError, "");
     HTTP2_CODE_COUNT_N(decompress_failure_3, 19, 23);
@@ -81,7 +81,7 @@
 
 void HpackWholeEntryBuffer::OnNameEnd() {
   HTTP2_DVLOG(2) << "HpackWholeEntryBuffer::OnNameEnd";
-  DCHECK_EQ(maybe_name_index_, 0u);
+  QUICHE_DCHECK_EQ(maybe_name_index_, 0u);
   if (!error_detected_ && !name_.OnEnd()) {
     ReportError(HpackDecodingError::kNameHuffmanError, "");
     HTTP2_CODE_COUNT_N(decompress_failure_3, 20, 23);
diff --git a/http2/hpack/huffman/hpack_huffman_decoder.cc b/http2/hpack/huffman/hpack_huffman_decoder.cc
index 868d4f0..2f486c6 100644
--- a/http2/hpack/huffman/hpack_huffman_decoder.cc
+++ b/http2/hpack/huffman/hpack_huffman_decoder.cc
@@ -379,7 +379,7 @@
 }
 
 void HuffmanBitBuffer::ConsumeBits(HuffmanAccumulatorBitCount code_length) {
-  DCHECK_LE(code_length, count_);
+  QUICHE_DCHECK_LE(code_length, count_);
   accumulator_ <<= code_length;
   count_ -= code_length;
 }
@@ -393,7 +393,7 @@
     HuffmanAccumulator expected = ~(~HuffmanAccumulator() >> cnt);
     // We expect all the bits below the high order |cnt| bits of accumulator_
     // to be cleared as we perform left shift operations while decoding.
-    DCHECK_EQ(accumulator_ & ~expected, 0u)
+    QUICHE_DCHECK_EQ(accumulator_ & ~expected, 0u)
         << "\n  expected: " << HuffmanAccumulatorBitSet(expected) << "\n  "
         << *this;
     return accumulator_ == expected;
@@ -425,7 +425,7 @@
       // code of 5, 6 or 7 bits.
       uint8_t short_code =
           bit_buffer_.value() >> (kHuffmanAccumulatorBitCount - 7);
-      DCHECK_LT(short_code, 128);
+      QUICHE_DCHECK_LT(short_code, 128);
       if (short_code < kShortCodeTableSize) {
         ShortCodeInfo info = kShortCodeTable[short_code];
         bit_buffer_.ConsumeBits(info.length);
@@ -449,8 +449,8 @@
 
     PrefixInfo prefix_info = PrefixToInfo(code_prefix);
     HTTP2_DVLOG(3) << "prefix_info: " << prefix_info;
-    DCHECK_LE(kMinCodeBitCount, prefix_info.code_length);
-    DCHECK_LE(prefix_info.code_length, kMaxCodeBitCount);
+    QUICHE_DCHECK_LE(kMinCodeBitCount, prefix_info.code_length);
+    QUICHE_DCHECK_LE(prefix_info.code_length, kMaxCodeBitCount);
 
     if (prefix_info.code_length <= bit_buffer_.count()) {
       // We have enough bits for one code.
@@ -471,7 +471,7 @@
     // Append to it as many bytes as are available AND fit.
     size_t byte_count = bit_buffer_.AppendBytes(input);
     if (byte_count == 0) {
-      DCHECK_EQ(input.size(), 0u);
+      QUICHE_DCHECK_EQ(input.size(), 0u);
       return true;
     }
     input.remove_prefix(byte_count);
diff --git a/http2/hpack/huffman/hpack_huffman_encoder.cc b/http2/hpack/huffman/hpack_huffman_encoder.cc
index d568641..daf85bc 100644
--- a/http2/hpack/huffman/hpack_huffman_encoder.cc
+++ b/http2/hpack/huffman/hpack_huffman_encoder.cc
@@ -20,7 +20,7 @@
 void HuffmanEncode(absl::string_view plain,
                    size_t encoded_size,
                    std::string* huffman) {
-  DCHECK(huffman != nullptr);
+  QUICHE_DCHECK(huffman != nullptr);
   huffman->reserve(huffman->size() + encoded_size);
   uint64_t bit_buffer = 0;  // High-bit is next bit to output. Not clear if that
                             // is more performant than having the low-bit be the
@@ -116,7 +116,7 @@
     *(current + 4) |= code & 0xff;
   }
 
-  DCHECK_EQ(encoded_size, (bit_counter + 7) / 8);
+  QUICHE_DCHECK_EQ(encoded_size, (bit_counter + 7) / 8);
 
   // EOF
   if (bit_counter % 8 != 0) {
diff --git a/http2/hpack/tools/hpack_block_builder.h b/http2/hpack/tools/hpack_block_builder.h
index 31a6b53..079f823 100644
--- a/http2/hpack/tools/hpack_block_builder.h
+++ b/http2/hpack/tools/hpack_block_builder.h
@@ -12,8 +12,9 @@
 // values that the decoder should reject. For now, this is only intended for
 // use in tests, and thus has EXPECT* in the code. If desired to use it in an
 // encoder, it will need optimization work, especially w.r.t memory mgmt, and
-// the EXPECT* will need to be removed or replaced with DCHECKs. And of course
-// the support for very large varints will not be needed in production code.
+// the EXPECT* will need to be removed or replaced with QUICHE_DCHECKs. And of
+// course the support for very large varints will not be needed in production
+// code.
 
 #include <stddef.h>
 
diff --git a/http2/hpack/tools/hpack_example.cc b/http2/hpack/tools/hpack_example.cc
index 9832fdc..25f44c9 100644
--- a/http2/hpack/tools/hpack_example.cc
+++ b/http2/hpack/tools/hpack_example.cc
@@ -19,9 +19,9 @@
   while (!example.empty()) {
     const char c0 = example[0];
     if (isxdigit(c0)) {
-      CHECK_GT(example.size(), 1u) << "Truncated hex byte?";
+      QUICHE_CHECK_GT(example.size(), 1u) << "Truncated hex byte?";
       const char c1 = example[1];
-      CHECK(isxdigit(c1)) << "Found half a byte?";
+      QUICHE_CHECK(isxdigit(c1)) << "Found half a byte?";
       *output += Http2HexDecode(example.substr(0, 2));
       example.remove_prefix(2);
       continue;
@@ -44,7 +44,7 @@
               << absl::StrCat(" (0x", Http2Hex(c0), ")")
               << "\nExample: " << example;
   }
-  CHECK_LT(0u, output->size()) << "Example is empty.";
+  QUICHE_CHECK_LT(0u, output->size()) << "Example is empty.";
 }
 
 }  // namespace
diff --git a/http2/hpack/varint/hpack_varint_decoder.cc b/http2/hpack/varint/hpack_varint_decoder.cc
index 705976c..5ba0b74 100644
--- a/http2/hpack/varint/hpack_varint_decoder.cc
+++ b/http2/hpack/varint/hpack_varint_decoder.cc
@@ -12,8 +12,8 @@
 DecodeStatus HpackVarintDecoder::Start(uint8_t prefix_value,
                                        uint8_t prefix_length,
                                        DecodeBuffer* db) {
-  DCHECK_LE(3u, prefix_length);
-  DCHECK_LE(prefix_length, 8u);
+  QUICHE_DCHECK_LE(3u, prefix_length);
+  QUICHE_DCHECK_LE(prefix_length, 8u);
 
   // |prefix_mask| defines the sequence of low-order bits of the first byte
   // that encode the prefix of the value. It is also the marker in those bits
@@ -34,8 +34,8 @@
 
 DecodeStatus HpackVarintDecoder::StartExtended(uint8_t prefix_length,
                                                DecodeBuffer* db) {
-  DCHECK_LE(3u, prefix_length);
-  DCHECK_LE(prefix_length, 8u);
+  QUICHE_DCHECK_LE(3u, prefix_length);
+  QUICHE_DCHECK_LE(prefix_length, 8u);
 
   value_ = (1 << prefix_length) - 1;
   offset_ = 0;
@@ -59,8 +59,8 @@
 
     // Shifting a 7 bit value to the left by at most 56 places can never
     // overflow on uint64_t.
-    DCHECK_LE(offset_, 56);
-    DCHECK_LE(summand, std::numeric_limits<uint64_t>::max() >> offset_);
+    QUICHE_DCHECK_LE(offset_, 56);
+    QUICHE_DCHECK_LE(summand, std::numeric_limits<uint64_t>::max() >> offset_);
 
     summand <<= offset_;
 
@@ -68,7 +68,7 @@
     // |value_| is at most (2^prefix_length - 1) + (2^49 - 1), and
     // |summand| is at most 255 << 56 (which is smaller than 2^63),
     // so adding them can never overflow on uint64_t.
-    DCHECK_LE(value_, std::numeric_limits<uint64_t>::max() - summand);
+    QUICHE_DCHECK_LE(value_, std::numeric_limits<uint64_t>::max() - summand);
 
     value_ += summand;
 
@@ -85,7 +85,7 @@
     return DecodeStatus::kDecodeInProgress;
   }
 
-  DCHECK_EQ(kMaxOffset, offset_);
+  QUICHE_DCHECK_EQ(kMaxOffset, offset_);
 
   uint8_t byte = db->DecodeUInt8();
   // No more extension bytes are allowed after this.
diff --git a/http2/hpack/varint/hpack_varint_decoder.h b/http2/hpack/varint/hpack_varint_decoder.h
index 4d6fb0c..7de72ba 100644
--- a/http2/hpack/varint/hpack_varint_decoder.h
+++ b/http2/hpack/varint/hpack_varint_decoder.h
@@ -102,12 +102,12 @@
   }
   void CheckNotDone() const {
 #ifndef NDEBUG
-    DCHECK_NE(kHpackVarintDecoderOffsetDone, offset_);
+    QUICHE_DCHECK_NE(kHpackVarintDecoderOffsetDone, offset_);
 #endif
   }
   void CheckDone() const {
 #ifndef NDEBUG
-    DCHECK_EQ(kHpackVarintDecoderOffsetDone, offset_);
+    QUICHE_DCHECK_EQ(kHpackVarintDecoderOffsetDone, offset_);
 #endif
   }
 
diff --git a/http2/hpack/varint/hpack_varint_decoder_test.cc b/http2/hpack/varint/hpack_varint_decoder_test.cc
index 742d277..3d73c5c 100644
--- a/http2/hpack/varint/hpack_varint_decoder_test.cc
+++ b/http2/hpack/varint/hpack_varint_decoder_test.cc
@@ -89,7 +89,7 @@
   }
 
   DecodeStatus StartDecoding(DecodeBuffer* b) override {
-    CHECK_LT(0u, b->Remaining());
+    QUICHE_CHECK_LT(0u, b->Remaining());
     uint8_t prefix = b->DecodeUInt8();
     return decoder_.Start(prefix, prefix_length_, b);
   }
diff --git a/http2/hpack/varint/hpack_varint_encoder.cc b/http2/hpack/varint/hpack_varint_encoder.cc
index 3e0e9eb..87f4981 100644
--- a/http2/hpack/varint/hpack_varint_encoder.cc
+++ b/http2/hpack/varint/hpack_varint_encoder.cc
@@ -15,14 +15,14 @@
                                 uint8_t prefix_length,
                                 uint64_t varint,
                                 std::string* output) {
-  DCHECK_LE(1u, prefix_length);
-  DCHECK_LE(prefix_length, 8u);
+  QUICHE_DCHECK_LE(1u, prefix_length);
+  QUICHE_DCHECK_LE(prefix_length, 8u);
 
   // prefix_mask defines the sequence of low-order bits of the first byte
   // that encode the prefix of the value. It is also the marker in those bits
   // of the first byte indicating that at least one extension byte is needed.
   const uint8_t prefix_mask = (1 << prefix_length) - 1;
-  DCHECK_EQ(0, high_bits & prefix_mask);
+  QUICHE_DCHECK_EQ(0, high_bits & prefix_mask);
 
   if (varint < prefix_mask) {
     // The integer fits into the prefix in its entirety.
diff --git a/http2/hpack/varint/hpack_varint_round_trip_test.cc b/http2/hpack/varint/hpack_varint_round_trip_test.cc
index 91abbba..7b73edb 100644
--- a/http2/hpack/varint/hpack_varint_round_trip_test.cc
+++ b/http2/hpack/varint/hpack_varint_round_trip_test.cc
@@ -41,7 +41,7 @@
   HpackVarintRoundTripTest() : prefix_length_(0) {}
 
   DecodeStatus StartDecoding(DecodeBuffer* b) override {
-    CHECK_LT(0u, b->Remaining());
+    QUICHE_CHECK_LT(0u, b->Remaining());
     uint8_t prefix = b->DecodeUInt8();
     return decoder_.Start(prefix, prefix_length_, b);
   }
@@ -82,8 +82,8 @@
   }
 
   void EncodeNoRandom(uint64_t value, uint8_t prefix_length) {
-    DCHECK_LE(3, prefix_length);
-    DCHECK_LE(prefix_length, 8);
+    QUICHE_DCHECK_LE(3, prefix_length);
+    QUICHE_DCHECK_LE(prefix_length, 8);
     prefix_length_ = prefix_length;
 
     HpackBlockBuilder bb;
@@ -156,7 +156,7 @@
   void EncodeAndDecodeValues(const std::set<uint64_t>& values,
                              uint8_t prefix_length,
                              size_t expected_bytes) {
-    CHECK(!values.empty());
+    QUICHE_CHECK(!values.empty());
     const uint64_t minimum = *values.begin();
     const uint64_t maximum = *values.rbegin();
     for (const uint64_t value : values) {