Replace (D)CHECK with QUICHE_(D)CHECK.
PiperOrigin-RevId: 355031711
Change-Id: Icf17b3b806e6040da8d6f6177408de4cfc2a263f
diff --git a/quic/test_tools/crypto_test_utils.cc b/quic/test_tools/crypto_test_utils.cc
index ce1c217..23f24d6 100644
--- a/quic/test_tools/crypto_test_utils.cc
+++ b/quic/test_tools/crypto_test_utils.cc
@@ -263,7 +263,7 @@
});
// The client's handshake must have been started already.
- CHECK_NE(0u, client_conn->encrypted_packets_.size());
+ QUICHE_CHECK_NE(0u, client_conn->encrypted_packets_.size());
CommunicateHandshakeMessages(client_conn, client, server_conn,
server_session.GetMutableCryptoStream());
@@ -292,7 +292,7 @@
return version.handshake_protocol != PROTOCOL_TLS1_3;
}),
supported_versions.end());
- CHECK(!options.only_quic_crypto_versions);
+ QUICHE_CHECK(!options.only_quic_crypto_versions);
} else if (options.only_quic_crypto_versions) {
supported_versions.erase(
std::remove_if(supported_versions.begin(), supported_versions.end(),
@@ -326,7 +326,7 @@
{AlpnForVersion(client_conn->version())})));
}
client_session.GetMutableCryptoStream()->CryptoConnect();
- CHECK_EQ(1u, client_conn->encrypted_packets_.size());
+ QUICHE_CHECK_EQ(1u, client_conn->encrypted_packets_.size());
CommunicateHandshakeMessages(client_conn,
client_session.GetMutableCryptoStream(),
@@ -459,7 +459,7 @@
AllSupportedVersionsWithQuicCrypto().front().transport_version, "",
std::unique_ptr<ProofSource::Callback>(new Callback(&ok, &chain)));
if (!ok || chain->certs.empty()) {
- DCHECK(false) << "Proof generation failed";
+ QUICHE_DCHECK(false) << "Proof generation failed";
return 0;
}
@@ -655,26 +655,26 @@
QuicTag ParseTag(const char* tagstr) {
const size_t len = strlen(tagstr);
- CHECK_NE(0u, len);
+ QUICHE_CHECK_NE(0u, len);
QuicTag tag = 0;
if (tagstr[0] == '#') {
- CHECK_EQ(static_cast<size_t>(1 + 2 * 4), len);
+ QUICHE_CHECK_EQ(static_cast<size_t>(1 + 2 * 4), len);
tagstr++;
for (size_t i = 0; i < 8; i++) {
tag <<= 4;
uint8_t v = 0;
- CHECK(HexChar(tagstr[i], &v));
+ QUICHE_CHECK(HexChar(tagstr[i], &v));
tag |= v;
}
return tag;
}
- CHECK_LE(len, 4u);
+ QUICHE_CHECK_LE(len, 4u);
for (size_t i = 0; i < 4; i++) {
tag >>= 8;
if (i < len) {
@@ -723,7 +723,7 @@
CryptoFramer::ConstructHandshakeMessage(msg);
std::unique_ptr<CryptoHandshakeMessage> parsed(
CryptoFramer::ParseMessage(bytes->AsStringPiece()));
- CHECK(parsed);
+ QUICHE_CHECK(parsed);
return *parsed;
}
@@ -840,7 +840,7 @@
std::unique_ptr<CryptoHandshakeMessage> msg =
crypto_config->AddConfig(primary_config, clock->WallNow());
absl::string_view orbit;
- CHECK(msg->GetStringPiece(kORBT, &orbit));
+ QUICHE_CHECK(msg->GetStringPiece(kORBT, &orbit));
std::string nonce;
CryptoUtils::GenerateNonce(clock->WallNow(), QuicRandom::GetInstance(), orbit,
&nonce);
diff --git a/quic/test_tools/fake_proof_source.cc b/quic/test_tools/fake_proof_source.cc
index 0d3da93..bc75678 100644
--- a/quic/test_tools/fake_proof_source.cc
+++ b/quic/test_tools/fake_proof_source.cc
@@ -140,7 +140,7 @@
}
void FakeProofSource::InvokePendingCallback(int n) {
- CHECK(NumPendingCallbacks() > n);
+ QUICHE_CHECK(NumPendingCallbacks() > n);
pending_ops_[n]->Run();
diff --git a/quic/test_tools/fake_proof_source_handle.cc b/quic/test_tools/fake_proof_source_handle.cc
index 437a913..673d957 100644
--- a/quic/test_tools/fake_proof_source_handle.cc
+++ b/quic/test_tools/fake_proof_source_handle.cc
@@ -22,7 +22,7 @@
explicit ResultSavingSignatureCallback(
absl::optional<ComputeSignatureResult>* result)
: result_(result) {
- DCHECK(!result_->has_value());
+ QUICHE_DCHECK(!result_->has_value());
}
void Run(bool ok,
std::string signature,
@@ -46,8 +46,9 @@
delegate->ComputeTlsSignature(
server_address, client_address, hostname, signature_algorithm, in,
std::make_unique<ResultSavingSignatureCallback>(&result));
- CHECK(result.has_value()) << "delegate->ComputeTlsSignature must computes a "
- "signature immediately";
+ QUICHE_CHECK(result.has_value())
+ << "delegate->ComputeTlsSignature must computes a "
+ "signature immediately";
return std::move(result.value());
}
} // namespace
@@ -88,7 +89,7 @@
return QUIC_FAILURE;
}
- DCHECK(select_cert_action_ == Action::DELEGATE_SYNC);
+ QUICHE_DCHECK(select_cert_action_ == Action::DELEGATE_SYNC);
QuicReferenceCountedPointer<ProofSource::Chain> chain =
delegate_->GetCertChain(server_address, client_address, hostname);
@@ -116,7 +117,7 @@
return QUIC_FAILURE;
}
- DCHECK(compute_signature_action_ == Action::DELEGATE_SYNC);
+ QUICHE_DCHECK(compute_signature_action_ == Action::DELEGATE_SYNC);
ComputeSignatureResult result =
ComputeSignatureNow(delegate_, server_address, client_address, hostname,
signature_algorithm, in);
@@ -135,7 +136,7 @@
}
void FakeProofSourceHandle::CompletePendingOperation() {
- DCHECK_LE(NumPendingOperations(), 1);
+ QUICHE_DCHECK_LE(NumPendingOperations(), 1);
if (select_cert_op_.has_value()) {
select_cert_op_->Run();
diff --git a/quic/test_tools/fuzzing/quic_framer_process_data_packet_fuzzer.cc b/quic/test_tools/fuzzing/quic_framer_process_data_packet_fuzzer.cc
index e3a9bdf..0126d4b 100644
--- a/quic/test_tools/fuzzing/quic_framer_process_data_packet_fuzzer.cc
+++ b/quic/test_tools/fuzzing/quic_framer_process_data_packet_fuzzer.cc
@@ -222,7 +222,7 @@
uint16_t payload_size = data_provider.ConsumeIntegralInRange<uint16_t>(
min_payload_size, max_payload_size);
- CHECK_NE(last_remaining_bytes, data_provider.remaining_bytes())
+ QUICHE_CHECK_NE(last_remaining_bytes, data_provider.remaining_bytes())
<< "Check fail to avoid an infinite loop. ConsumeIntegralInRange("
<< min_payload_size << ", " << max_payload_size
<< ") did not consume any bytes. remaining_bytes:"
@@ -230,28 +230,30 @@
std::vector<char> payload_buffer =
data_provider.ConsumeBytes<char>(payload_size);
- CHECK_GE(packet_buffer.size(),
- GetPacketHeaderSize(sender_framer.transport_version(), header) +
- payload_buffer.size());
+ QUICHE_CHECK_GE(
+ packet_buffer.size(),
+ GetPacketHeaderSize(sender_framer.transport_version(), header) +
+ payload_buffer.size());
// Serialize the null-encrypted packet into |packet_buffer|.
QuicDataWriter writer(packet_buffer.size(), packet_buffer.data());
size_t length_field_offset = 0;
- CHECK(sender_framer.AppendPacketHeader(header, &writer,
- &length_field_offset));
+ QUICHE_CHECK(sender_framer.AppendPacketHeader(header, &writer,
+ &length_field_offset));
- CHECK(writer.WriteBytes(payload_buffer.data(), payload_buffer.size()));
+ QUICHE_CHECK(
+ writer.WriteBytes(payload_buffer.data(), payload_buffer.size()));
EncryptionLevel encryption_level =
quic::test::HeaderToEncryptionLevel(header);
- CHECK(sender_framer.WriteIetfLongHeaderLength(
+ QUICHE_CHECK(sender_framer.WriteIetfLongHeaderLength(
header, &writer, length_field_offset, encryption_level));
size_t encrypted_length = sender_framer.EncryptInPlace(
encryption_level, header.packet_number,
GetStartOfEncryptedData(sender_framer.transport_version(), header),
writer.length(), packet_buffer.size(), packet_buffer.data());
- CHECK_NE(encrypted_length, 0u);
+ QUICHE_CHECK_NE(encrypted_length, 0u);
// Use receiver's framer to process the packet. Ensure both
// ProcessPublicHeader and DecryptPayload were called and succeeded.
@@ -265,14 +267,15 @@
receiver_framer.ProcessPacket(packet);
- DCHECK_EQ(process_public_header_success_count + 1,
- receiver_framer_visitor.process_public_header_success_count_)
+ QUICHE_DCHECK_EQ(
+ process_public_header_success_count + 1,
+ receiver_framer_visitor.process_public_header_success_count_)
<< "ProcessPublicHeader failed. error:"
<< QuicErrorCodeToString(receiver_framer.error())
<< ", error_detail:" << receiver_framer.detailed_error()
<< ". header:" << header;
- DCHECK_EQ(decrypted_packet_count + 1,
- receiver_framer_visitor.decrypted_packet_count_)
+ QUICHE_DCHECK_EQ(decrypted_packet_count + 1,
+ receiver_framer_visitor.decrypted_packet_count_)
<< "Packet was not decrypted. error:"
<< QuicErrorCodeToString(receiver_framer.error())
<< ", error_detail:" << receiver_framer.detailed_error()
diff --git a/quic/test_tools/packet_dropping_test_writer.cc b/quic/test_tools/packet_dropping_test_writer.cc
index bf763ef..35cc978 100644
--- a/quic/test_tools/packet_dropping_test_writer.cc
+++ b/quic/test_tools/packet_dropping_test_writer.cc
@@ -118,7 +118,7 @@
if (fake_blocked_socket_percentage_ > 0 &&
simple_random_.RandUint64() % 100 <
static_cast<uint64_t>(fake_blocked_socket_percentage_)) {
- CHECK(on_can_write_ != nullptr);
+ QUICHE_CHECK(on_can_write_ != nullptr);
QUIC_DVLOG(1) << "Blocking socket for packet " << num_calls_to_write_;
if (!write_unblocked_alarm_->IsSet()) {
// Set the alarm to fire immediately.
@@ -206,7 +206,7 @@
QuicPacketWriterWrapper::WritePacket(
iter->buffer.data(), iter->buffer.length(), iter->self_address,
iter->peer_address, iter->options.get());
- DCHECK_GE(cur_buffer_size_, iter->buffer.length());
+ QUICHE_DCHECK_GE(cur_buffer_size_, iter->buffer.length());
cur_buffer_size_ -= iter->buffer.length();
delayed_packets_.erase(iter);
diff --git a/quic/test_tools/packet_reordering_writer.cc b/quic/test_tools/packet_reordering_writer.cc
index 2fb5f7e..1b931eb 100644
--- a/quic/test_tools/packet_reordering_writer.cc
+++ b/quic/test_tools/packet_reordering_writer.cc
@@ -32,7 +32,8 @@
return wr;
}
// Still have packet to wait.
- DCHECK_LT(0u, num_packets_to_wait_) << "Only allow one packet to be delayed";
+ QUICHE_DCHECK_LT(0u, num_packets_to_wait_)
+ << "Only allow one packet to be delayed";
delayed_data_ = std::string(buffer, buf_len);
delayed_self_address_ = self_address;
delayed_peer_address_ = peer_address;
@@ -44,7 +45,7 @@
}
void PacketReorderingWriter::SetDelay(size_t num_packets_to_wait) {
- DCHECK_GT(num_packets_to_wait, 0u);
+ QUICHE_DCHECK_GT(num_packets_to_wait, 0u);
num_packets_to_wait_ = num_packets_to_wait;
delay_next_ = true;
}
diff --git a/quic/test_tools/qpack/qpack_decoder_test_utils.cc b/quic/test_tools/qpack/qpack_decoder_test_utils.cc
index bc1a60b..ab76c44 100644
--- a/quic/test_tools/qpack/qpack_decoder_test_utils.cc
+++ b/quic/test_tools/qpack/qpack_decoder_test_utils.cc
@@ -46,8 +46,8 @@
}
spdy::Http2HeaderBlock TestHeadersHandler::ReleaseHeaderList() {
- DCHECK(decoding_completed_);
- DCHECK(!decoding_error_detected_);
+ QUICHE_DCHECK(decoding_completed_);
+ QUICHE_DCHECK(!decoding_error_detected_);
return std::move(header_list_);
}
@@ -61,7 +61,7 @@
}
const std::string& TestHeadersHandler::error_message() const {
- DCHECK(decoding_error_detected_);
+ QUICHE_DCHECK(decoding_error_detected_);
return error_message_;
}
diff --git a/quic/test_tools/qpack/qpack_offline_decoder.cc b/quic/test_tools/qpack/qpack_offline_decoder.cc
index 025c1ed..6bad8d6 100644
--- a/quic/test_tools/qpack/qpack_offline_decoder.cc
+++ b/quic/test_tools/qpack/qpack_offline_decoder.cc
@@ -218,7 +218,7 @@
}
if (!decoders_.empty()) {
- DCHECK(!decoders_.front().headers_handler->decoding_completed());
+ QUICHE_DCHECK(!decoders_.front().headers_handler->decoding_completed());
QUIC_LOG(ERROR) << "Blocked decoding uncomplete after reading entire"
" file, on stream "
diff --git a/quic/test_tools/quic_config_peer.cc b/quic/test_tools/quic_config_peer.cc
index 928f842..9bd5dd3 100644
--- a/quic/test_tools/quic_config_peer.cc
+++ b/quic/test_tools/quic_config_peer.cc
@@ -60,7 +60,7 @@
// static
void QuicConfigPeer::SetReceivedBytesForConnectionId(QuicConfig* config,
uint32_t bytes) {
- DCHECK(bytes == 0 || bytes == 8);
+ QUICHE_DCHECK(bytes == 0 || bytes == 8);
config->bytes_for_connection_id_.SetReceivedValue(bytes);
}
diff --git a/quic/test_tools/quic_packet_creator_peer.cc b/quic/test_tools/quic_packet_creator_peer.cc
index 7098fb2..0caf263 100644
--- a/quic/test_tools/quic_packet_creator_peer.cc
+++ b/quic/test_tools/quic_packet_creator_peer.cc
@@ -30,7 +30,7 @@
creator->packet_.encryption_level = ENCRYPTION_FORWARD_SECURE;
return;
}
- DCHECK(creator->packet_.encryption_level < ENCRYPTION_FORWARD_SECURE);
+ QUICHE_DCHECK(creator->packet_.encryption_level < ENCRYPTION_FORWARD_SECURE);
}
// static
@@ -60,7 +60,7 @@
void QuicPacketCreatorPeer::SetPacketNumber(QuicPacketCreator* creator,
uint64_t s) {
- DCHECK_NE(0u, s);
+ QUICHE_DCHECK_NE(0u, s);
creator->packet_.packet_number = QuicPacketNumber(s);
}
@@ -105,15 +105,15 @@
const QuicFrames& frames,
char* buffer,
size_t buffer_len) {
- DCHECK(creator->queued_frames_.empty());
- DCHECK(!frames.empty());
+ QUICHE_DCHECK(creator->queued_frames_.empty());
+ QUICHE_DCHECK(!frames.empty());
for (const QuicFrame& frame : frames) {
bool success = creator->AddFrame(frame, NOT_RETRANSMISSION);
- DCHECK(success);
+ QUICHE_DCHECK(success);
}
const bool success = creator->SerializePacket(
QuicOwnedPacketBuffer(buffer, nullptr), buffer_len);
- DCHECK(success);
+ QUICHE_DCHECK(success);
SerializedPacket packet = std::move(creator->packet_);
// The caller takes ownership of the QuicEncryptedPacket.
creator->packet_.encrypted_buffer = nullptr;
diff --git a/quic/test_tools/quic_sent_packet_manager_peer.cc b/quic/test_tools/quic_sent_packet_manager_peer.cc
index f358783..0789946 100644
--- a/quic/test_tools/quic_sent_packet_manager_peer.cc
+++ b/quic/test_tools/quic_sent_packet_manager_peer.cc
@@ -82,7 +82,7 @@
bool QuicSentPacketManagerPeer::IsRetransmission(
QuicSentPacketManager* sent_packet_manager,
uint64_t packet_number) {
- DCHECK(HasRetransmittableFrames(sent_packet_manager, packet_number));
+ QUICHE_DCHECK(HasRetransmittableFrames(sent_packet_manager, packet_number));
if (!HasRetransmittableFrames(sent_packet_manager, packet_number)) {
return false;
}
diff --git a/quic/test_tools/quic_session_peer.cc b/quic/test_tools/quic_session_peer.cc
index 49466b5..344b1b1 100644
--- a/quic/test_tools/quic_session_peer.cc
+++ b/quic/test_tools/quic_session_peer.cc
@@ -53,7 +53,7 @@
void QuicSessionPeer::SetMaxOpenIncomingBidirectionalStreams(
QuicSession* session,
uint32_t max_streams) {
- DCHECK(VersionHasIetfQuicFrames(session->transport_version()))
+ QUICHE_DCHECK(VersionHasIetfQuicFrames(session->transport_version()))
<< "SetmaxOpenIncomingBidirectionalStreams not supported for Google "
"QUIC";
session->ietf_streamid_manager_.SetMaxOpenIncomingBidirectionalStreams(
@@ -63,7 +63,7 @@
void QuicSessionPeer::SetMaxOpenIncomingUnidirectionalStreams(
QuicSession* session,
uint32_t max_streams) {
- DCHECK(VersionHasIetfQuicFrames(session->transport_version()))
+ QUICHE_DCHECK(VersionHasIetfQuicFrames(session->transport_version()))
<< "SetmaxOpenIncomingUnidirectionalStreams not supported for Google "
"QUIC";
session->ietf_streamid_manager_.SetMaxOpenIncomingUnidirectionalStreams(
@@ -84,7 +84,7 @@
void QuicSessionPeer::SetMaxOpenOutgoingBidirectionalStreams(
QuicSession* session,
uint32_t max_streams) {
- DCHECK(VersionHasIetfQuicFrames(session->transport_version()))
+ QUICHE_DCHECK(VersionHasIetfQuicFrames(session->transport_version()))
<< "SetmaxOpenOutgoingBidirectionalStreams not supported for Google "
"QUIC";
session->ietf_streamid_manager_.MaybeAllowNewOutgoingBidirectionalStreams(
@@ -94,7 +94,7 @@
void QuicSessionPeer::SetMaxOpenOutgoingUnidirectionalStreams(
QuicSession* session,
uint32_t max_streams) {
- DCHECK(VersionHasIetfQuicFrames(session->transport_version()))
+ QUICHE_DCHECK(VersionHasIetfQuicFrames(session->transport_version()))
<< "SetmaxOpenOutgoingUnidirectionalStreams not supported for Google "
"QUIC";
session->ietf_streamid_manager_.MaybeAllowNewOutgoingUnidirectionalStreams(
diff --git a/quic/test_tools/quic_spdy_session_peer.cc b/quic/test_tools/quic_spdy_session_peer.cc
index acb66df..58eedcc 100644
--- a/quic/test_tools/quic_spdy_session_peer.cc
+++ b/quic/test_tools/quic_spdy_session_peer.cc
@@ -15,13 +15,13 @@
// static
QuicHeadersStream* QuicSpdySessionPeer::GetHeadersStream(
QuicSpdySession* session) {
- DCHECK(!VersionUsesHttp3(session->transport_version()));
+ QUICHE_DCHECK(!VersionUsesHttp3(session->transport_version()));
return session->headers_stream();
}
void QuicSpdySessionPeer::SetHeadersStream(QuicSpdySession* session,
QuicHeadersStream* headers_stream) {
- DCHECK(!VersionUsesHttp3(session->transport_version()));
+ QUICHE_DCHECK(!VersionUsesHttp3(session->transport_version()));
for (auto& it : QuicSessionPeer::stream_map(session)) {
if (it.first ==
QuicUtils::GetHeadersStreamId(session->transport_version())) {
diff --git a/quic/test_tools/quic_test_client.cc b/quic/test_tools/quic_test_client.cc
index 9dcfb42..4133950 100644
--- a/quic/test_tools/quic_test_client.cc
+++ b/quic/test_tools/quic_test_client.cc
@@ -164,12 +164,12 @@
}
void UseWriter(QuicPacketWriterWrapper* writer) {
- CHECK(test_writer_ == nullptr);
+ QUICHE_CHECK(test_writer_ == nullptr);
test_writer_ = writer;
}
void set_peer_address(const QuicSocketAddress& address) {
- CHECK(test_writer_ != nullptr);
+ QUICHE_CHECK(test_writer_ != nullptr);
test_writer_->set_peer_address(address);
}
@@ -834,24 +834,24 @@
}
void QuicTestClient::UseConnectionId(QuicConnectionId server_connection_id) {
- DCHECK(!connected());
+ QUICHE_DCHECK(!connected());
client_->UseConnectionId(server_connection_id);
}
void QuicTestClient::UseConnectionIdLength(int server_connection_id_length) {
- DCHECK(!connected());
+ QUICHE_DCHECK(!connected());
client_->UseConnectionIdLength(server_connection_id_length);
}
void QuicTestClient::UseClientConnectionId(
QuicConnectionId client_connection_id) {
- DCHECK(!connected());
+ QUICHE_DCHECK(!connected());
client_->UseClientConnectionId(client_connection_id);
}
void QuicTestClient::UseClientConnectionIdLength(
int client_connection_id_length) {
- DCHECK(!connected());
+ QUICHE_DCHECK(!connected());
client_->UseClientConnectionIdLength(client_connection_id_length);
}
diff --git a/quic/test_tools/quic_test_server.cc b/quic/test_tools/quic_test_server.cc
index 59fac5d..55170b2 100644
--- a/quic/test_tools/quic_test_server.cc
+++ b/quic/test_tools/quic_test_server.cc
@@ -127,23 +127,23 @@
void SetSessionFactory(QuicTestServer::SessionFactory* factory) {
QuicWriterMutexLock lock(&factory_lock_);
- DCHECK(session_factory_ == nullptr);
- DCHECK(stream_factory_ == nullptr);
- DCHECK(crypto_stream_factory_ == nullptr);
+ QUICHE_DCHECK(session_factory_ == nullptr);
+ QUICHE_DCHECK(stream_factory_ == nullptr);
+ QUICHE_DCHECK(crypto_stream_factory_ == nullptr);
session_factory_ = factory;
}
void SetStreamFactory(QuicTestServer::StreamFactory* factory) {
QuicWriterMutexLock lock(&factory_lock_);
- DCHECK(session_factory_ == nullptr);
- DCHECK(stream_factory_ == nullptr);
+ QUICHE_DCHECK(session_factory_ == nullptr);
+ QUICHE_DCHECK(stream_factory_ == nullptr);
stream_factory_ = factory;
}
void SetCryptoStreamFactory(QuicTestServer::CryptoStreamFactory* factory) {
QuicWriterMutexLock lock(&factory_lock_);
- DCHECK(session_factory_ == nullptr);
- DCHECK(crypto_stream_factory_ == nullptr);
+ QUICHE_DCHECK(session_factory_ == nullptr);
+ QUICHE_DCHECK(crypto_stream_factory_ == nullptr);
crypto_stream_factory_ = factory;
}
@@ -195,7 +195,7 @@
}
void QuicTestServer::SetSessionFactory(SessionFactory* factory) {
- DCHECK(dispatcher());
+ QUICHE_DCHECK(dispatcher());
static_cast<QuicTestDispatcher*>(dispatcher())->SetSessionFactory(factory);
}
diff --git a/quic/test_tools/quic_test_utils.cc b/quic/test_tools/quic_test_utils.cc
index a2aa11c..fb5d772 100644
--- a/quic/test_tools/quic_test_utils.cc
+++ b/quic/test_tools/quic_test_utils.cc
@@ -71,7 +71,7 @@
}
uint64_t TestConnectionIdToUInt64(QuicConnectionId connection_id) {
- DCHECK_EQ(connection_id.length(), kQuicDefaultConnectionIdLength);
+ QUICHE_DCHECK_EQ(connection_id.length(), kQuicDefaultConnectionIdLength);
uint64_t connection_id64_net = 0;
memcpy(&connection_id64_net, connection_id.data(),
std::min<size_t>(static_cast<size_t>(connection_id.length()),
@@ -97,13 +97,13 @@
}
QuicAckFrame InitAckFrame(const std::vector<QuicAckBlock>& ack_blocks) {
- DCHECK_GT(ack_blocks.size(), 0u);
+ QUICHE_DCHECK_GT(ack_blocks.size(), 0u);
QuicAckFrame ack;
QuicPacketNumber end_of_previous_block(1);
for (const QuicAckBlock& block : ack_blocks) {
- DCHECK_GE(block.start, end_of_previous_block);
- DCHECK_GT(block.limit, block.start);
+ QUICHE_DCHECK_GE(block.start, end_of_previous_block);
+ QUICHE_DCHECK_GT(block.limit, block.start);
ack.packets.AddRange(block.start, block.limit);
end_of_previous_block = block.limit;
}
@@ -170,13 +170,13 @@
framer->GetMaxPlaintextSize(kMaxOutgoingPacketSize);
size_t packet_size = GetPacketHeaderSize(framer->transport_version(), header);
for (size_t i = 0; i < frames.size(); ++i) {
- DCHECK_LE(packet_size, max_plaintext_size);
+ QUICHE_DCHECK_LE(packet_size, max_plaintext_size);
bool first_frame = i == 0;
bool last_frame = i == frames.size() - 1;
const size_t frame_size = framer->GetSerializedFrameLength(
frames[i], max_plaintext_size - packet_size, first_frame, last_frame,
header.packet_number_length);
- DCHECK(frame_size);
+ QUICHE_DCHECK(frame_size);
packet_size += frame_size;
}
return BuildUnsizedDataPacket(framer, header, frames, packet_size);
@@ -191,7 +191,7 @@
EncryptionLevel level = HeaderToEncryptionLevel(header);
size_t length =
framer->BuildDataPacket(header, frames, buffer, packet_size, level);
- DCHECK_NE(0u, length);
+ QUICHE_DCHECK_NE(0u, length);
// Re-construct the data packet with data ownership.
return std::make_unique<QuicPacket>(
buffer, length, /* owns_buffer */ true,
@@ -638,11 +638,11 @@
if (write_length > 0) {
auto buf = std::make_unique<char[]>(write_length);
QuicStream* stream = GetOrCreateStream(id);
- DCHECK(stream);
+ QUICHE_DCHECK(stream);
QuicDataWriter writer(write_length, buf.get(), quiche::HOST_BYTE_ORDER);
stream->WriteStreamData(offset, write_length, &writer);
} else {
- DCHECK(state != NO_FIN);
+ QUICHE_DCHECK(state != NO_FIN);
}
return QuicConsumedData(write_length, state != NO_FIN);
}
@@ -727,11 +727,11 @@
if (write_length > 0) {
auto buf = std::make_unique<char[]>(write_length);
QuicStream* stream = GetOrCreateStream(id);
- DCHECK(stream);
+ QUICHE_DCHECK(stream);
QuicDataWriter writer(write_length, buf.get(), quiche::HOST_BYTE_ORDER);
stream->WriteStreamData(offset, write_length, &writer);
} else {
- DCHECK(state != NO_FIN);
+ QUICHE_DCHECK(state != NO_FIN);
}
return QuicConsumedData(write_length, state != NO_FIN);
}
@@ -1208,10 +1208,10 @@
QuicCryptoClientConfig* crypto_client_config,
PacketSavingConnection** client_connection,
TestQuicSpdyClientSession** client_session) {
- CHECK(crypto_client_config);
- CHECK(client_connection);
- CHECK(client_session);
- CHECK(!connection_start_time.IsZero())
+ QUICHE_CHECK(crypto_client_config);
+ QUICHE_CHECK(client_connection);
+ QUICHE_CHECK(client_session);
+ QUICHE_CHECK(!connection_start_time.IsZero())
<< "Connections must start at non-zero times, otherwise the "
<< "strike-register will be unhappy.";
@@ -1234,10 +1234,10 @@
QuicCompressedCertsCache* compressed_certs_cache,
PacketSavingConnection** server_connection,
TestQuicSpdyServerSession** server_session) {
- CHECK(server_crypto_config);
- CHECK(server_connection);
- CHECK(server_session);
- CHECK(!connection_start_time.IsZero())
+ QUICHE_CHECK(server_crypto_config);
+ QUICHE_CHECK(server_connection);
+ QUICHE_CHECK(server_session);
+ QUICHE_CHECK(!connection_start_time.IsZero())
<< "Connections must start at non-zero times, otherwise the "
<< "strike-register will be unhappy.";
diff --git a/quic/test_tools/server_thread.cc b/quic/test_tools/server_thread.cc
index a744ac6..f5c9b7e 100644
--- a/quic/test_tools/server_thread.cc
+++ b/quic/test_tools/server_thread.cc
@@ -61,7 +61,7 @@
}
void ServerThread::Schedule(std::function<void()> action) {
- DCHECK(!quit_.HasBeenNotified());
+ QUICHE_DCHECK(!quit_.HasBeenNotified());
QuicWriterMutexLock lock(&scheduled_actions_lock_);
scheduled_actions_.push_back(std::move(action));
}
@@ -89,14 +89,14 @@
}
void ServerThread::Pause() {
- DCHECK(!pause_.HasBeenNotified());
+ QUICHE_DCHECK(!pause_.HasBeenNotified());
pause_.Notify();
paused_.WaitForNotification();
}
void ServerThread::Resume() {
- DCHECK(!resume_.HasBeenNotified());
- DCHECK(pause_.HasBeenNotified());
+ QUICHE_DCHECK(!resume_.HasBeenNotified());
+ QUICHE_DCHECK(pause_.HasBeenNotified());
resume_.Notify();
}
diff --git a/quic/test_tools/simple_quic_framer.cc b/quic/test_tools/simple_quic_framer.cc
index 04d44b1..96b1318 100644
--- a/quic/test_tools/simple_quic_framer.cc
+++ b/quic/test_tools/simple_quic_framer.cc
@@ -101,7 +101,7 @@
}
bool OnAckRange(QuicPacketNumber start, QuicPacketNumber end) override {
- DCHECK(!ack_frames_.empty());
+ QUICHE_DCHECK(!ack_frames_.empty());
ack_frames_[ack_frames_.size() - 1].packets.AddRange(start, end);
return true;
}
diff --git a/quic/test_tools/simple_session_notifier.cc b/quic/test_tools/simple_session_notifier.cc
index 1a75a4c..415332a 100644
--- a/quic/test_tools/simple_session_notifier.cc
+++ b/quic/test_tools/simple_session_notifier.cc
@@ -481,7 +481,7 @@
if (id == kInvalidControlFrameId) {
return false;
}
- DCHECK(id < least_unacked_ + control_frames_.size());
+ QUICHE_DCHECK(id < least_unacked_ + control_frames_.size());
if (id < least_unacked_ ||
GetControlFrameId(control_frames_.at(id - least_unacked_)) ==
kInvalidControlFrameId) {
@@ -504,7 +504,7 @@
if (id == kInvalidControlFrameId) {
return;
}
- DCHECK(id < least_unacked_ + control_frames_.size());
+ QUICHE_DCHECK(id < least_unacked_ + control_frames_.size());
if (id < least_unacked_ ||
GetControlFrameId(control_frames_.at(id - least_unacked_)) ==
kInvalidControlFrameId) {
diff --git a/quic/test_tools/simulator/alarm_factory.cc b/quic/test_tools/simulator/alarm_factory.cc
index 8ea3e58..4e1ed2e 100644
--- a/quic/test_tools/simulator/alarm_factory.cc
+++ b/quic/test_tools/simulator/alarm_factory.cc
@@ -21,7 +21,7 @@
~Alarm() override {}
void SetImpl() override {
- DCHECK(deadline().IsInitialized());
+ QUICHE_DCHECK(deadline().IsInitialized());
adapter_.Set(deadline());
}
@@ -41,7 +41,7 @@
void Cancel() { Unschedule(); }
void Act() override {
- DCHECK(clock_->Now() >= parent_->deadline());
+ QUICHE_DCHECK(clock_->Now() >= parent_->deadline());
parent_->Fire();
}
diff --git a/quic/test_tools/simulator/link.cc b/quic/test_tools/simulator/link.cc
index dcfd2dc..16850a9 100644
--- a/quic/test_tools/simulator/link.cc
+++ b/quic/test_tools/simulator/link.cc
@@ -35,7 +35,7 @@
OneWayLink::QueuedPacket::~QueuedPacket() {}
void OneWayLink::AcceptPacket(std::unique_ptr<Packet> packet) {
- DCHECK(TimeUntilAvailable().IsZero());
+ QUICHE_DCHECK(TimeUntilAvailable().IsZero());
QuicTime::Delta transfer_time = bandwidth_.TransferTime(packet->size);
next_write_at_ = clock_->Now() + transfer_time;
@@ -60,8 +60,8 @@
}
void OneWayLink::Act() {
- DCHECK(!packets_in_transit_.empty());
- DCHECK(packets_in_transit_.front().dequeue_time >= clock_->Now());
+ QUICHE_DCHECK(!packets_in_transit_.empty());
+ QUICHE_DCHECK(packets_in_transit_.front().dequeue_time >= clock_->Now());
sink_->AcceptPacket(std::move(packets_in_transit_.front().packet));
packets_in_transit_.pop_front();
diff --git a/quic/test_tools/simulator/queue.cc b/quic/test_tools/simulator/queue.cc
index fc0c320..5113cf7 100644
--- a/quic/test_tools/simulator/queue.cc
+++ b/quic/test_tools/simulator/queue.cc
@@ -59,9 +59,9 @@
}
void Queue::Act() {
- DCHECK(!queue_.empty());
+ QUICHE_DCHECK(!queue_.empty());
if (tx_port_->TimeUntilAvailable().IsZero()) {
- DCHECK(bytes_queued_ >= queue_.front().packet->size);
+ QUICHE_DCHECK(bytes_queued_ >= queue_.front().packet->size);
bytes_queued_ -= queue_.front().packet->size;
tx_port_->AcceptPacket(std::move(queue_.front().packet));
@@ -76,10 +76,10 @@
void Queue::EnableAggregation(QuicByteCount aggregation_threshold,
QuicTime::Delta aggregation_timeout) {
- DCHECK_EQ(bytes_queued_, 0u);
- DCHECK_GT(aggregation_threshold, 0u);
- DCHECK(!aggregation_timeout.IsZero());
- DCHECK(!aggregation_timeout.IsInfinite());
+ QUICHE_DCHECK_EQ(bytes_queued_, 0u);
+ QUICHE_DCHECK_GT(aggregation_threshold, 0u);
+ QUICHE_DCHECK(!aggregation_timeout.IsZero());
+ QUICHE_DCHECK(!aggregation_timeout.IsInfinite());
aggregation_threshold_ = aggregation_threshold;
aggregation_timeout_ = aggregation_timeout;
@@ -109,7 +109,7 @@
void Queue::ScheduleNextPacketDequeue() {
if (queue_.empty()) {
- DCHECK_EQ(bytes_queued_, 0u);
+ QUICHE_DCHECK_EQ(bytes_queued_, 0u);
return;
}
diff --git a/quic/test_tools/simulator/quic_endpoint.cc b/quic/test_tools/simulator/quic_endpoint.cc
index 2534b8d..cb0b58e 100644
--- a/quic/test_tools/simulator/quic_endpoint.cc
+++ b/quic/test_tools/simulator/quic_endpoint.cc
@@ -74,7 +74,8 @@
QuicErrorCode error_code = config.ProcessPeerHello(
peer_hello, perspective == Perspective::IS_CLIENT ? SERVER : CLIENT,
&error);
- DCHECK_EQ(error_code, QUIC_NO_ERROR) << "Configuration failed: " << error;
+ QUICHE_DCHECK_EQ(error_code, QUIC_NO_ERROR)
+ << "Configuration failed: " << error;
if (connection_->version().UsesTls()) {
if (connection_->perspective() == Perspective::IS_CLIENT) {
test::QuicConfigPeer::SetReceivedOriginalConnectionId(
@@ -131,7 +132,7 @@
void QuicEndpoint::OnStreamFrame(const QuicStreamFrame& frame) {
// Verify that the data received always matches the expected.
- DCHECK(frame.stream_id == kDataStream);
+ QUICHE_DCHECK(frame.stream_id == kDataStream);
for (size_t i = 0; i < frame.data_length; i++) {
if (frame.data_buffer[i] != kStreamDataContents) {
wrong_data_received_ = true;
@@ -139,7 +140,7 @@
}
offsets_received_.Add(frame.offset, frame.offset + frame.data_length);
// Sanity check against very pathological connections.
- DCHECK_LE(offsets_received_.Size(), 1000u);
+ QUICHE_DCHECK_LE(offsets_received_.Size(), 1000u);
}
void QuicEndpoint::OnCryptoFrame(const QuicCryptoFrame& /*frame*/) {}
@@ -184,18 +185,18 @@
}
void QuicEndpoint::OnFrameLost(const QuicFrame& frame) {
- DCHECK(notifier_);
+ QUICHE_DCHECK(notifier_);
notifier_->OnFrameLost(frame);
}
void QuicEndpoint::RetransmitFrames(const QuicFrames& frames,
TransmissionType type) {
- DCHECK(notifier_);
+ QUICHE_DCHECK(notifier_);
notifier_->RetransmitFrames(frames, type);
}
bool QuicEndpoint::IsFrameOutstanding(const QuicFrame& frame) const {
- DCHECK(notifier_);
+ QUICHE_DCHECK(notifier_);
return notifier_->IsFrameOutstanding(frame);
}
@@ -243,7 +244,7 @@
QuicConsumedData consumed_data = connection_->SendStreamData(
kDataStream, transmission_size, bytes_transferred_, NO_FIN);
- DCHECK(consumed_data.bytes_consumed <= transmission_size);
+ QUICHE_DCHECK(consumed_data.bytes_consumed <= transmission_size);
bytes_transferred_ += consumed_data.bytes_consumed;
bytes_to_transfer_ -= consumed_data.bytes_consumed;
if (consumed_data.bytes_consumed != transmission_size) {
diff --git a/quic/test_tools/simulator/quic_endpoint_base.cc b/quic/test_tools/simulator/quic_endpoint_base.cc
index d221888..a563a29 100644
--- a/quic/test_tools/simulator/quic_endpoint_base.cc
+++ b/quic/test_tools/simulator/quic_endpoint_base.cc
@@ -133,9 +133,9 @@
const QuicIpAddress& /*self_address*/,
const QuicSocketAddress& /*peer_address*/,
PerPacketOptions* options) {
- DCHECK(!IsWriteBlocked());
- DCHECK(options == nullptr);
- DCHECK(buf_len <= kMaxOutgoingPacketSize);
+ QUICHE_DCHECK(!IsWriteBlocked());
+ QUICHE_DCHECK(options == nullptr);
+ QUICHE_DCHECK(buf_len <= kMaxOutgoingPacketSize);
// Instead of losing a packet, become write-blocked when the egress queue is
// full.
diff --git a/quic/test_tools/simulator/simulator.cc b/quic/test_tools/simulator/simulator.cc
index 9aa10ab..8d68ee4 100644
--- a/quic/test_tools/simulator/simulator.cc
+++ b/quic/test_tools/simulator/simulator.cc
@@ -48,15 +48,15 @@
auto emplace_names_result = actor_names_.insert(actor->name());
// Ensure that the object was actually placed into the map.
- DCHECK(emplace_times_result.second);
- DCHECK(emplace_names_result.second);
+ QUICHE_DCHECK(emplace_times_result.second);
+ QUICHE_DCHECK(emplace_names_result.second);
}
void Simulator::RemoveActor(Actor* actor) {
auto scheduled_time_it = scheduled_times_.find(actor);
auto actor_names_it = actor_names_.find(actor->name());
- DCHECK(scheduled_time_it != scheduled_times_.end());
- DCHECK(actor_names_it != actor_names_.end());
+ QUICHE_DCHECK(scheduled_time_it != scheduled_times_.end());
+ QUICHE_DCHECK(actor_names_it != actor_names_.end());
QuicTime scheduled_time = scheduled_time_it->second;
if (scheduled_time != QuicTime::Infinite()) {
@@ -69,7 +69,7 @@
void Simulator::Schedule(Actor* actor, QuicTime new_time) {
auto scheduled_time_it = scheduled_times_.find(actor);
- DCHECK(scheduled_time_it != scheduled_times_.end());
+ QUICHE_DCHECK(scheduled_time_it != scheduled_times_.end());
QuicTime scheduled_time = scheduled_time_it->second;
if (scheduled_time <= new_time) {
@@ -86,10 +86,10 @@
void Simulator::Unschedule(Actor* actor) {
auto scheduled_time_it = scheduled_times_.find(actor);
- DCHECK(scheduled_time_it != scheduled_times_.end());
+ QUICHE_DCHECK(scheduled_time_it != scheduled_times_.end());
QuicTime scheduled_time = scheduled_time_it->second;
- DCHECK(scheduled_time != QuicTime::Infinite());
+ QUICHE_DCHECK(scheduled_time != QuicTime::Infinite());
auto range = schedule_.equal_range(scheduled_time);
for (auto it = range.first; it != range.second; ++it) {
if (it->second == actor) {
@@ -98,7 +98,7 @@
return;
}
}
- DCHECK(false);
+ QUICHE_DCHECK(false);
}
const QuicClock* Simulator::GetClock() const {
@@ -129,7 +129,7 @@
}
void Simulator::RunFor(QuicTime::Delta time_span) {
- DCHECK(!run_for_alarm_->IsSet());
+ QUICHE_DCHECK(!run_for_alarm_->IsSet());
// RunFor() ensures that the simulation stops at the exact time specified by
// scheduling an alarm at that point and using that alarm to abort the
@@ -141,8 +141,8 @@
run_for_should_stop_ = false;
bool simulation_result = RunUntil([this]() { return run_for_should_stop_; });
- DCHECK(simulation_result);
- DCHECK(clock_.Now() == end_time);
+ QUICHE_DCHECK(simulation_result);
+ QUICHE_DCHECK(clock_.Now() == end_time);
}
void Simulator::HandleNextScheduledActor() {
diff --git a/quic/test_tools/simulator/traffic_policer.cc b/quic/test_tools/simulator/traffic_policer.cc
index e44e67f..be62669 100644
--- a/quic/test_tools/simulator/traffic_policer.cc
+++ b/quic/test_tools/simulator/traffic_policer.cc
@@ -45,7 +45,7 @@
}
auto bucket = token_buckets_.find(packet.destination);
- DCHECK(bucket != token_buckets_.end());
+ QUICHE_DCHECK(bucket != token_buckets_.end());
// Silently drop the packet on the floor if out of tokens
if (bucket->second < packet.size) {