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);