Replace (D)CHECK with QUICHE_(D)CHECK.
PiperOrigin-RevId: 355031711
Change-Id: Icf17b3b806e6040da8d6f6177408de4cfc2a263f
diff --git a/quic/core/batch_writer/quic_batch_writer_base.cc b/quic/core/batch_writer/quic_batch_writer_base.cc
index b1cd520..b2fd80c 100644
--- a/quic/core/batch_writer/quic_batch_writer_base.cc
+++ b/quic/core/batch_writer/quic_batch_writer_base.cc
@@ -141,12 +141,12 @@
// Either flush_result.write_result.status is not WRITE_STATUS_OK, or it is
// WRITE_STATUS_OK and batch_buffer is empty.
- DCHECK(flush_result.write_result.status != WRITE_STATUS_OK ||
- buffered_writes().empty());
+ QUICHE_DCHECK(flush_result.write_result.status != WRITE_STATUS_OK ||
+ buffered_writes().empty());
// Flush should never return WRITE_STATUS_BLOCKED_DATA_BUFFERED.
- DCHECK(flush_result.write_result.status !=
- WRITE_STATUS_BLOCKED_DATA_BUFFERED);
+ QUICHE_DCHECK(flush_result.write_result.status !=
+ WRITE_STATUS_BLOCKED_DATA_BUFFERED);
return flush_result;
}
diff --git a/quic/core/batch_writer/quic_batch_writer_buffer.cc b/quic/core/batch_writer/quic_batch_writer_buffer.cc
index 7e30179..0de792d 100644
--- a/quic/core/batch_writer/quic_batch_writer_buffer.cc
+++ b/quic/core/batch_writer/quic_batch_writer_buffer.cc
@@ -60,8 +60,8 @@
const QuicSocketAddress& peer_address,
const PerPacketOptions* options,
uint64_t release_time) {
- DCHECK(Invariants());
- DCHECK_LE(buf_len, kMaxOutgoingPacketSize);
+ QUICHE_DCHECK(Invariants());
+ QUICHE_DCHECK_LE(buf_len, kMaxOutgoingPacketSize);
PushResult result = {/*succeeded=*/false, /*buffer_copied=*/false};
char* next_write_location = GetNextWriteLocation();
@@ -91,7 +91,7 @@
options ? options->Clone() : std::unique_ptr<PerPacketOptions>(),
release_time);
- DCHECK(Invariants());
+ QUICHE_DCHECK(Invariants());
result.succeeded = true;
return result;
@@ -105,9 +105,10 @@
QuicBatchWriterBuffer::PopResult QuicBatchWriterBuffer::PopBufferedWrite(
int32_t num_buffered_writes) {
- DCHECK(Invariants());
- DCHECK_GE(num_buffered_writes, 0);
- DCHECK_LE(static_cast<size_t>(num_buffered_writes), buffered_writes_.size());
+ QUICHE_DCHECK(Invariants());
+ QUICHE_DCHECK_GE(num_buffered_writes, 0);
+ QUICHE_DCHECK_LE(static_cast<size_t>(num_buffered_writes),
+ buffered_writes_.size());
PopResult result = {/*num_buffers_popped=*/0,
/*moved_remaining_buffers=*/false};
@@ -135,9 +136,9 @@
buffered_write.buffer -= distance_to_move;
}
- DCHECK_EQ(buffer_, buffered_writes_.front().buffer);
+ QUICHE_DCHECK_EQ(buffer_, buffered_writes_.front().buffer);
}
- DCHECK(Invariants());
+ QUICHE_DCHECK(Invariants());
return result;
}
diff --git a/quic/core/batch_writer/quic_gso_batch_writer.cc b/quic/core/batch_writer/quic_gso_batch_writer.cc
index 564fd84..fa26516 100644
--- a/quic/core/batch_writer/quic_gso_batch_writer.cc
+++ b/quic/core/batch_writer/quic_gso_batch_writer.cc
@@ -101,7 +101,7 @@
QuicGsoBatchWriter::ReleaseTime QuicGsoBatchWriter::GetReleaseTime(
const PerPacketOptions* options) const {
- DCHECK(SupportsReleaseTime());
+ QUICHE_DCHECK(SupportsReleaseTime());
if (options == nullptr) {
return {0, QuicTime::Delta::Zero()};
diff --git a/quic/core/batch_writer/quic_sendmmsg_batch_writer.cc b/quic/core/batch_writer/quic_sendmmsg_batch_writer.cc
index eacb611..ec8e4ae 100644
--- a/quic/core/batch_writer/quic_sendmmsg_batch_writer.cc
+++ b/quic/core/batch_writer/quic_sendmmsg_batch_writer.cc
@@ -32,8 +32,8 @@
QuicSendmmsgBatchWriter::FlushImplResult
QuicSendmmsgBatchWriter::InternalFlushImpl(size_t cmsg_space,
const CmsgBuilder& cmsg_builder) {
- DCHECK(!IsWriteBlocked());
- DCHECK(!buffered_writes().empty());
+ QUICHE_DCHECK(!IsWriteBlocked());
+ QUICHE_DCHECK(!buffered_writes().empty());
FlushImplResult result = {WriteResult(WRITE_STATUS_OK, 0),
/*num_packets_sent=*/0, /*bytes_written=*/0};
@@ -52,7 +52,7 @@
<< " packets. WriteResult=" << write_result;
if (write_result.status != WRITE_STATUS_OK) {
- DCHECK_EQ(0, num_packets_sent);
+ QUICHE_DCHECK_EQ(0, num_packets_sent);
break;
} else if (num_packets_sent == 0) {
QUIC_BUG << "WriteMultiplePackets returned OK, but no packets were sent.";
diff --git a/quic/core/congestion_control/bbr2_drain.cc b/quic/core/congestion_control/bbr2_drain.cc
index 97fa576..69befb5 100644
--- a/quic/core/congestion_control/bbr2_drain.cc
+++ b/quic/core/congestion_control/bbr2_drain.cc
@@ -18,7 +18,7 @@
model_->set_pacing_gain(Params().drain_pacing_gain);
// Only STARTUP can transition to DRAIN, both of them use the same cwnd gain.
- DCHECK_EQ(model_->cwnd_gain(), Params().drain_cwnd_gain);
+ QUICHE_DCHECK_EQ(model_->cwnd_gain(), Params().drain_cwnd_gain);
model_->set_cwnd_gain(Params().drain_cwnd_gain);
QuicByteCount drain_target = DrainTarget();
diff --git a/quic/core/congestion_control/bbr2_misc.cc b/quic/core/congestion_control/bbr2_misc.cc
index 4413ba3..dfb834c 100644
--- a/quic/core/congestion_control/bbr2_misc.cc
+++ b/quic/core/congestion_control/bbr2_misc.cc
@@ -16,8 +16,8 @@
RoundTripCounter::RoundTripCounter() : round_trip_count_(0) {}
void RoundTripCounter::OnPacketSent(QuicPacketNumber packet_number) {
- DCHECK(!last_sent_packet_.IsInitialized() ||
- last_sent_packet_ < packet_number);
+ QUICHE_DCHECK(!last_sent_packet_.IsInitialized() ||
+ last_sent_packet_ < packet_number);
last_sent_packet_ = packet_number;
}
@@ -188,7 +188,7 @@
void Bbr2NetworkModel::AdaptLowerBounds(
const Bbr2CongestionEvent& congestion_event) {
if (Params().bw_lo_mode_ != Bbr2Params::DEFAULT) {
- DCHECK(Params().bw_startup);
+ QUICHE_DCHECK(Params().bw_startup);
if (congestion_event.bytes_lost == 0) {
return;
}
@@ -366,7 +366,7 @@
}
void Bbr2NetworkModel::OnNewRound() {
- DCHECK(reset_max_bytes_delivered_);
+ QUICHE_DCHECK(reset_max_bytes_delivered_);
bytes_lost_in_round_ = 0;
loss_events_in_round_ = 0;
max_bytes_delivered_in_round_ = 0;
@@ -389,8 +389,8 @@
Bbr2NetworkModel::BandwidthGrowth Bbr2NetworkModel::CheckBandwidthGrowth(
const Bbr2CongestionEvent& congestion_event) {
- DCHECK(!full_bandwidth_reached_);
- DCHECK(congestion_event.end_of_round_trip);
+ QUICHE_DCHECK(!full_bandwidth_reached_);
+ QUICHE_DCHECK(congestion_event.end_of_round_trip);
if (congestion_event.last_sample_is_app_limited) {
return APP_LIMITED;
}
diff --git a/quic/core/congestion_control/bbr2_probe_bw.cc b/quic/core/congestion_control/bbr2_probe_bw.cc
index 031e5a1..78bd06d 100644
--- a/quic/core/congestion_control/bbr2_probe_bw.cc
+++ b/quic/core/congestion_control/bbr2_probe_bw.cc
@@ -24,8 +24,8 @@
} else {
// Transitioning from PROBE_RTT to PROBE_BW. Re-enter the last phase before
// PROBE_RTT.
- DCHECK(cycle_.phase == CyclePhase::PROBE_CRUISE ||
- cycle_.phase == CyclePhase::PROBE_REFILL);
+ QUICHE_DCHECK(cycle_.phase == CyclePhase::PROBE_CRUISE ||
+ cycle_.phase == CyclePhase::PROBE_REFILL);
cycle_.cycle_start_time = now;
if (cycle_.phase == CyclePhase::PROBE_CRUISE) {
EnterProbeCruise(now);
@@ -41,7 +41,7 @@
const AckedPacketVector& /*acked_packets*/,
const LostPacketVector& /*lost_packets*/,
const Bbr2CongestionEvent& congestion_event) {
- DCHECK_NE(cycle_.phase, CyclePhase::PROBE_NOT_STARTED);
+ QUICHE_DCHECK_NE(cycle_.phase, CyclePhase::PROBE_NOT_STARTED);
if (congestion_event.end_of_round_trip) {
if (cycle_.cycle_start_time != event_time) {
@@ -130,7 +130,7 @@
void Bbr2ProbeBwMode::UpdateProbeDown(
QuicByteCount prior_in_flight,
const Bbr2CongestionEvent& congestion_event) {
- DCHECK_EQ(cycle_.phase, CyclePhase::PROBE_DOWN);
+ QUICHE_DCHECK_EQ(cycle_.phase, CyclePhase::PROBE_DOWN);
if (cycle_.rounds_in_phase == 1 && congestion_event.end_of_round_trip) {
cycle_.is_sample_from_probing = false;
@@ -346,7 +346,7 @@
}
void Bbr2ProbeBwMode::RaiseInflightHighSlope() {
- DCHECK_EQ(cycle_.phase, CyclePhase::PROBE_UP);
+ QUICHE_DCHECK_EQ(cycle_.phase, CyclePhase::PROBE_UP);
uint64_t growth_this_round = 1 << cycle_.probe_up_rounds;
// The number 30 below means |growth_this_round| is capped at 1G and the lower
// bound of |probe_up_bytes| is (practically) 1 mss, at this speed inflight_hi
@@ -362,7 +362,7 @@
void Bbr2ProbeBwMode::ProbeInflightHighUpward(
const Bbr2CongestionEvent& congestion_event) {
- DCHECK_EQ(cycle_.phase, CyclePhase::PROBE_UP);
+ QUICHE_DCHECK_EQ(cycle_.phase, CyclePhase::PROBE_UP);
if (!model_->IsCongestionWindowLimited(congestion_event)) {
QUIC_DVLOG(3) << sender_
<< " Raising inflight_hi early return: Not cwnd limited.";
@@ -406,9 +406,9 @@
void Bbr2ProbeBwMode::UpdateProbeCruise(
const Bbr2CongestionEvent& congestion_event) {
- DCHECK_EQ(cycle_.phase, CyclePhase::PROBE_CRUISE);
+ QUICHE_DCHECK_EQ(cycle_.phase, CyclePhase::PROBE_CRUISE);
MaybeAdaptUpperBounds(congestion_event);
- DCHECK(!cycle_.is_sample_from_probing);
+ QUICHE_DCHECK(!cycle_.is_sample_from_probing);
if (IsTimeToProbeBandwidth(congestion_event)) {
EnterProbeRefill(/*probe_up_rounds=*/0, congestion_event.event_time);
@@ -418,9 +418,9 @@
void Bbr2ProbeBwMode::UpdateProbeRefill(
const Bbr2CongestionEvent& congestion_event) {
- DCHECK_EQ(cycle_.phase, CyclePhase::PROBE_REFILL);
+ QUICHE_DCHECK_EQ(cycle_.phase, CyclePhase::PROBE_REFILL);
MaybeAdaptUpperBounds(congestion_event);
- DCHECK(!cycle_.is_sample_from_probing);
+ QUICHE_DCHECK(!cycle_.is_sample_from_probing);
if (cycle_.rounds_in_phase > 0 && congestion_event.end_of_round_trip) {
EnterProbeUp(congestion_event.event_time);
@@ -431,7 +431,7 @@
void Bbr2ProbeBwMode::UpdateProbeUp(
QuicByteCount prior_in_flight,
const Bbr2CongestionEvent& congestion_event) {
- DCHECK_EQ(cycle_.phase, CyclePhase::PROBE_UP);
+ QUICHE_DCHECK_EQ(cycle_.phase, CyclePhase::PROBE_UP);
if (MaybeAdaptUpperBounds(congestion_event) == ADAPTED_PROBED_TOO_HIGH) {
EnterProbeDown(/*probed_too_high=*/true, /*stopped_risky_probe=*/false,
congestion_event.event_time);
@@ -553,7 +553,7 @@
}
void Bbr2ProbeBwMode::EnterProbeUp(QuicTime now) {
- DCHECK_EQ(cycle_.phase, CyclePhase::PROBE_REFILL);
+ QUICHE_DCHECK_EQ(cycle_.phase, CyclePhase::PROBE_REFILL);
QUIC_DVLOG(2) << sender_ << " Phase change: " << cycle_.phase << " ==> "
<< CyclePhase::PROBE_UP << " after "
<< now - cycle_.phase_start_time << ", or "
@@ -568,7 +568,7 @@
}
void Bbr2ProbeBwMode::ExitProbeDown() {
- DCHECK_EQ(cycle_.phase, CyclePhase::PROBE_DOWN);
+ QUICHE_DCHECK_EQ(cycle_.phase, CyclePhase::PROBE_DOWN);
if (!cycle_.has_advanced_max_bw) {
QUIC_DVLOG(2) << sender_ << " Advancing max bw filter at end of cycle.";
model_->AdvanceMaxBandwidthFilter();
diff --git a/quic/core/congestion_control/bbr2_sender.cc b/quic/core/congestion_control/bbr2_sender.cc
index 0d6b3f1..e8ef762 100644
--- a/quic/core/congestion_control/bbr2_sender.cc
+++ b/quic/core/congestion_control/bbr2_sender.cc
@@ -90,7 +90,7 @@
QUIC_DVLOG(2) << this << " Initializing Bbr2Sender. mode:" << mode_
<< ", PacingRate:" << pacing_rate_ << ", Cwnd:" << cwnd_
<< ", CwndLimits:" << cwnd_limits() << " @ " << now;
- DCHECK_EQ(mode_, Bbr2Mode::STARTUP);
+ QUICHE_DCHECK_EQ(mode_, Bbr2Mode::STARTUP);
}
void Bbr2Sender::SetFromConfig(const QuicConfig& config,
diff --git a/quic/core/congestion_control/bbr2_simulator_test.cc b/quic/core/congestion_control/bbr2_simulator_test.cc
index 489a958..9cd5966 100644
--- a/quic/core/congestion_control/bbr2_simulator_test.cc
+++ b/quic/core/congestion_control/bbr2_simulator_test.cc
@@ -1286,7 +1286,7 @@
QuicBandwidth BottleneckBandwidth() const {
// Make sure all local links have a higher bandwidth than the test link.
for (size_t i = 0; i < local_links.size(); ++i) {
- CHECK_GT(local_links[i].bandwidth, test_link.bandwidth);
+ QUICHE_CHECK_GT(local_links[i].bandwidth, test_link.bandwidth);
}
return test_link.bandwidth;
}
diff --git a/quic/core/congestion_control/bbr2_startup.cc b/quic/core/congestion_control/bbr2_startup.cc
index 7904eb3..0f6b80f 100644
--- a/quic/core/congestion_control/bbr2_startup.cc
+++ b/quic/core/congestion_control/bbr2_startup.cc
@@ -62,8 +62,8 @@
}
if (Params().decrease_startup_pacing_at_end_of_round) {
- DCHECK_GT(model_->pacing_gain(), 0);
- DCHECK(Params().bw_startup);
+ QUICHE_DCHECK_GT(model_->pacing_gain(), 0);
+ QUICHE_DCHECK(Params().bw_startup);
if (congestion_event.end_of_round_trip &&
!congestion_event.last_sample_is_app_limited) {
// Multiply by startup_pacing_gain, so if the bandwidth doubles,
@@ -104,7 +104,7 @@
void Bbr2StartupMode::CheckExcessiveLosses(
const Bbr2CongestionEvent& congestion_event) {
- DCHECK(congestion_event.end_of_round_trip);
+ QUICHE_DCHECK(congestion_event.end_of_round_trip);
if (model_->full_bandwidth_reached()) {
return;
diff --git a/quic/core/congestion_control/cubic_bytes.cc b/quic/core/congestion_control/cubic_bytes.cc
index 482704e..854d6a7 100644
--- a/quic/core/congestion_control/cubic_bytes.cc
+++ b/quic/core/congestion_control/cubic_bytes.cc
@@ -153,8 +153,8 @@
kCubeScale;
const bool add_delta = elapsed_time > time_to_origin_point_;
- DCHECK(add_delta ||
- (origin_point_congestion_window_ > delta_congestion_window));
+ QUICHE_DCHECK(add_delta ||
+ (origin_point_congestion_window_ > delta_congestion_window));
QuicByteCount target_congestion_window =
add_delta ? origin_point_congestion_window_ + delta_congestion_window
: origin_point_congestion_window_ - delta_congestion_window;
@@ -163,7 +163,7 @@
std::min(target_congestion_window,
current_congestion_window + acked_bytes_count_ / 2);
- DCHECK_LT(0u, estimated_tcp_congestion_window_);
+ QUICHE_DCHECK_LT(0u, estimated_tcp_congestion_window_);
// Increase the window by approximately Alpha * 1 MSS of bytes every
// time we ack an estimated tcp window of bytes. For small
// congestion windows (less than 25), the formula below will
diff --git a/quic/core/congestion_control/general_loss_algorithm.cc b/quic/core/congestion_control/general_loss_algorithm.cc
index 478ab7d..521aa4a 100644
--- a/quic/core/congestion_control/general_loss_algorithm.cc
+++ b/quic/core/congestion_control/general_loss_algorithm.cc
@@ -79,8 +79,8 @@
}
// Clear least_in_flight_.
least_in_flight_.Clear();
- DCHECK_EQ(packet_number_space_,
- unacked_packets.GetPacketNumberSpace(largest_newly_acked));
+ QUICHE_DCHECK_EQ(packet_number_space_,
+ unacked_packets.GetPacketNumberSpace(largest_newly_acked));
for (; it != unacked_packets.end() && packet_number <= largest_newly_acked;
++it, ++packet_number) {
if (unacked_packets.GetPacketNumberSpace(it->encryption_level) !=
@@ -169,7 +169,7 @@
}
if (use_adaptive_reordering_threshold_) {
- DCHECK_LT(packet_number, previous_largest_acked);
+ QUICHE_DCHECK_LT(packet_number, previous_largest_acked);
// Increase reordering_threshold_ such that packet_number would not have
// been declared lost.
reordering_threshold_ = std::max(
diff --git a/quic/core/congestion_control/pacing_sender.cc b/quic/core/congestion_control/pacing_sender.cc
index 7389a46..a43601e 100644
--- a/quic/core/congestion_control/pacing_sender.cc
+++ b/quic/core/congestion_control/pacing_sender.cc
@@ -35,7 +35,7 @@
PacingSender::~PacingSender() {}
void PacingSender::set_sender(SendAlgorithmInterface* sender) {
- DCHECK(sender != nullptr);
+ QUICHE_DCHECK(sender != nullptr);
sender_ = sender;
}
@@ -44,7 +44,7 @@
QuicTime event_time,
const AckedPacketVector& acked_packets,
const LostPacketVector& lost_packets) {
- DCHECK(sender_ != nullptr);
+ QUICHE_DCHECK(sender_ != nullptr);
if (!lost_packets.empty()) {
// Clear any burst tokens when entering recovery.
burst_tokens_ = 0;
@@ -59,7 +59,7 @@
QuicPacketNumber packet_number,
QuicByteCount bytes,
HasRetransmittableData has_retransmittable_data) {
- DCHECK(sender_ != nullptr);
+ QUICHE_DCHECK(sender_ != nullptr);
sender_->OnPacketSent(sent_time, bytes_in_flight, packet_number, bytes,
has_retransmittable_data);
if (has_retransmittable_data != HAS_RETRANSMITTABLE_DATA) {
@@ -130,7 +130,7 @@
QuicTime::Delta PacingSender::TimeUntilSend(
QuicTime now,
QuicByteCount bytes_in_flight) const {
- DCHECK(sender_ != nullptr);
+ QUICHE_DCHECK(sender_ != nullptr);
if (!sender_->CanSend(bytes_in_flight)) {
// The underlying sender prevents sending.
@@ -158,7 +158,7 @@
}
QuicBandwidth PacingSender::PacingRate(QuicByteCount bytes_in_flight) const {
- DCHECK(sender_ != nullptr);
+ QUICHE_DCHECK(sender_ != nullptr);
if (!max_pacing_rate_.IsZero()) {
return QuicBandwidth::FromBitsPerSecond(
std::min(max_pacing_rate_.ToBitsPerSecond(),
diff --git a/quic/core/congestion_control/rtt_stats.cc b/quic/core/congestion_control/rtt_stats.cc
index 8754966..2be6fa4 100644
--- a/quic/core/congestion_control/rtt_stats.cc
+++ b/quic/core/congestion_control/rtt_stats.cc
@@ -103,7 +103,7 @@
}
QuicTime::Delta RttStats::GetStandardOrMeanDeviation() const {
- DCHECK(calculate_standard_deviation_);
+ QUICHE_DCHECK(calculate_standard_deviation_);
if (!standard_deviation_calculator_.has_valid_standard_deviation) {
return mean_deviation_;
}
@@ -124,7 +124,7 @@
QuicTime::Delta
RttStats::StandardDeviationCaculator::CalculateStandardDeviation() const {
- DCHECK(has_valid_standard_deviation);
+ QUICHE_DCHECK(has_valid_standard_deviation);
return QuicTime::Delta::FromMicroseconds(sqrt(m2));
}
diff --git a/quic/core/congestion_control/tcp_cubic_sender_bytes.cc b/quic/core/congestion_control/tcp_cubic_sender_bytes.cc
index 73b4c8a..77691fd 100644
--- a/quic/core/congestion_control/tcp_cubic_sender_bytes.cc
+++ b/quic/core/congestion_control/tcp_cubic_sender_bytes.cc
@@ -178,8 +178,8 @@
// PRR is used when in recovery.
prr_.OnPacketSent(bytes);
}
- DCHECK(!largest_sent_packet_number_.IsInitialized() ||
- largest_sent_packet_number_ < packet_number);
+ QUICHE_DCHECK(!largest_sent_packet_number_.IsInitialized() ||
+ largest_sent_packet_number_ < packet_number);
largest_sent_packet_number_ = packet_number;
hybrid_slow_start_.OnPacketSent(packet_number);
}
@@ -323,7 +323,7 @@
// TODO(b/77268641): Separate out all of slow start into a separate class.
if (slow_start_large_reduction_ && InSlowStart()) {
- DCHECK_LT(kDefaultTCPMSS, congestion_window_);
+ QUICHE_DCHECK_LT(kDefaultTCPMSS, congestion_window_);
if (congestion_window_ >= 2 * initial_tcp_congestion_window_) {
min_slow_start_exit_window_ = congestion_window_ / 2;
}
diff --git a/quic/core/crypto/aead_base_decrypter.cc b/quic/core/crypto/aead_base_decrypter.cc
index a40d1b5..32a2ebf 100644
--- a/quic/core/crypto/aead_base_decrypter.cc
+++ b/quic/core/crypto/aead_base_decrypter.cc
@@ -60,17 +60,17 @@
nonce_size_(nonce_size),
use_ietf_nonce_construction_(use_ietf_nonce_construction),
have_preliminary_key_(false) {
- DCHECK_GT(256u, key_size);
- DCHECK_GT(256u, auth_tag_size);
- DCHECK_GT(256u, nonce_size);
- DCHECK_LE(key_size_, sizeof(key_));
- DCHECK_LE(nonce_size_, sizeof(iv_));
+ QUICHE_DCHECK_GT(256u, key_size);
+ QUICHE_DCHECK_GT(256u, auth_tag_size);
+ QUICHE_DCHECK_GT(256u, nonce_size);
+ QUICHE_DCHECK_LE(key_size_, sizeof(key_));
+ QUICHE_DCHECK_LE(nonce_size_, sizeof(iv_));
}
AeadBaseDecrypter::~AeadBaseDecrypter() {}
bool AeadBaseDecrypter::SetKey(absl::string_view key) {
- DCHECK_EQ(key.size(), key_size_);
+ QUICHE_DCHECK_EQ(key.size(), key_size_);
if (key.size() != key_size_) {
return false;
}
@@ -91,7 +91,7 @@
QUIC_BUG << "Attempted to set nonce prefix on IETF QUIC crypter";
return false;
}
- DCHECK_EQ(nonce_prefix.size(), nonce_size_ - sizeof(QuicPacketNumber));
+ QUICHE_DCHECK_EQ(nonce_prefix.size(), nonce_size_ - sizeof(QuicPacketNumber));
if (nonce_prefix.size() != nonce_size_ - sizeof(QuicPacketNumber)) {
return false;
}
@@ -104,7 +104,7 @@
QUIC_BUG << "Attempted to set IV on Google QUIC crypter";
return false;
}
- DCHECK_EQ(iv.size(), nonce_size_);
+ QUICHE_DCHECK_EQ(iv.size(), nonce_size_);
if (iv.size() != nonce_size_) {
return false;
}
@@ -113,7 +113,7 @@
}
bool AeadBaseDecrypter::SetPreliminaryKey(absl::string_view key) {
- DCHECK(!have_preliminary_key_);
+ QUICHE_DCHECK(!have_preliminary_key_);
SetKey(key);
have_preliminary_key_ = true;
@@ -139,7 +139,7 @@
if (!SetKey(key) ||
(!use_ietf_nonce_construction_ && !SetNoncePrefix(nonce_prefix)) ||
(use_ietf_nonce_construction_ && !SetIV(nonce_prefix))) {
- DCHECK(false);
+ QUICHE_DCHECK(false);
return false;
}
diff --git a/quic/core/crypto/aead_base_encrypter.cc b/quic/core/crypto/aead_base_encrypter.cc
index c4a0ddd..a7100c5 100644
--- a/quic/core/crypto/aead_base_encrypter.cc
+++ b/quic/core/crypto/aead_base_encrypter.cc
@@ -51,15 +51,15 @@
auth_tag_size_(auth_tag_size),
nonce_size_(nonce_size),
use_ietf_nonce_construction_(use_ietf_nonce_construction) {
- DCHECK_LE(key_size_, sizeof(key_));
- DCHECK_LE(nonce_size_, sizeof(iv_));
- DCHECK_GE(kMaxNonceSize, nonce_size_);
+ QUICHE_DCHECK_LE(key_size_, sizeof(key_));
+ QUICHE_DCHECK_LE(nonce_size_, sizeof(iv_));
+ QUICHE_DCHECK_GE(kMaxNonceSize, nonce_size_);
}
AeadBaseEncrypter::~AeadBaseEncrypter() {}
bool AeadBaseEncrypter::SetKey(absl::string_view key) {
- DCHECK_EQ(key.size(), key_size_);
+ QUICHE_DCHECK_EQ(key.size(), key_size_);
if (key.size() != key_size_) {
return false;
}
@@ -81,7 +81,7 @@
QUIC_BUG << "Attempted to set nonce prefix on IETF QUIC crypter";
return false;
}
- DCHECK_EQ(nonce_prefix.size(), nonce_size_ - sizeof(QuicPacketNumber));
+ QUICHE_DCHECK_EQ(nonce_prefix.size(), nonce_size_ - sizeof(QuicPacketNumber));
if (nonce_prefix.size() != nonce_size_ - sizeof(QuicPacketNumber)) {
return false;
}
@@ -94,7 +94,7 @@
QUIC_BUG << "Attempted to set IV on Google QUIC crypter";
return false;
}
- DCHECK_EQ(iv.size(), nonce_size_);
+ QUICHE_DCHECK_EQ(iv.size(), nonce_size_);
if (iv.size() != nonce_size_) {
return false;
}
@@ -106,7 +106,7 @@
absl::string_view associated_data,
absl::string_view plaintext,
unsigned char* output) {
- DCHECK_EQ(nonce.size(), nonce_size_);
+ QUICHE_DCHECK_EQ(nonce.size(), nonce_size_);
size_t ciphertext_len;
if (!EVP_AEAD_CTX_seal(
diff --git a/quic/core/crypto/cert_compressor.cc b/quic/core/crypto/cert_compressor.cc
index 5e2cf83..e2a352d 100644
--- a/quic/core/crypto/cert_compressor.cc
+++ b/quic/core/crypto/cert_compressor.cc
@@ -308,7 +308,7 @@
zlib_dict += std::string(reinterpret_cast<const char*>(kCommonCertSubstrings),
sizeof(kCommonCertSubstrings));
- DCHECK_EQ(zlib_dict.size(), zlib_dict_size);
+ QUICHE_DCHECK_EQ(zlib_dict.size(), zlib_dict_size);
return zlib_dict;
}
@@ -456,7 +456,7 @@
const CommonCertSets* common_sets) {
const std::vector<CertEntry> entries = MatchCerts(
certs, client_common_set_hashes, client_cached_cert_hashes, common_sets);
- DCHECK_EQ(entries.size(), certs.size());
+ QUICHE_DCHECK_EQ(entries.size(), certs.size());
size_t uncompressed_size = 0;
for (size_t i = 0; i < entries.size(); i++) {
@@ -472,7 +472,7 @@
if (uncompressed_size > 0) {
memset(&z, 0, sizeof(z));
int rv = deflateInit(&z, Z_DEFAULT_COMPRESSION);
- DCHECK_EQ(Z_OK, rv);
+ QUICHE_DCHECK_EQ(Z_OK, rv);
if (rv != Z_OK) {
return "";
}
@@ -482,7 +482,7 @@
rv = deflateSetDictionary(
&z, reinterpret_cast<const uint8_t*>(&zlib_dict[0]), zlib_dict.size());
- DCHECK_EQ(Z_OK, rv);
+ QUICHE_DCHECK_EQ(Z_OK, rv);
if (rv != Z_OK) {
return "";
}
@@ -522,8 +522,8 @@
z.next_in = reinterpret_cast<uint8_t*>(&length32);
z.avail_in = sizeof(length32);
rv = deflate(&z, Z_NO_FLUSH);
- DCHECK_EQ(Z_OK, rv);
- DCHECK_EQ(0u, z.avail_in);
+ QUICHE_DCHECK_EQ(Z_OK, rv);
+ QUICHE_DCHECK_EQ(0u, z.avail_in);
if (rv != Z_OK || z.avail_in) {
return "";
}
@@ -532,8 +532,8 @@
const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(certs[i].data()));
z.avail_in = certs[i].size();
rv = deflate(&z, Z_NO_FLUSH);
- DCHECK_EQ(Z_OK, rv);
- DCHECK_EQ(0u, z.avail_in);
+ QUICHE_DCHECK_EQ(Z_OK, rv);
+ QUICHE_DCHECK_EQ(0u, z.avail_in);
if (rv != Z_OK || z.avail_in) {
return "";
}
@@ -541,7 +541,7 @@
z.avail_in = 0;
rv = deflate(&z, Z_FINISH);
- DCHECK_EQ(Z_STREAM_END, rv);
+ QUICHE_DCHECK_EQ(Z_STREAM_END, rv);
if (rv != Z_STREAM_END) {
return "";
}
@@ -560,7 +560,7 @@
if (!ParseEntries(&in, cached_certs, common_sets, &entries, out_certs)) {
return false;
}
- DCHECK_EQ(entries.size(), out_certs->size());
+ QUICHE_DCHECK_EQ(entries.size(), out_certs->size());
std::unique_ptr<uint8_t[]> uncompressed_data;
absl::string_view uncompressed;
diff --git a/quic/core/crypto/certificate_view.cc b/quic/core/crypto/certificate_view.cc
index 629373d..7a20602 100644
--- a/quic/core/crypto/certificate_view.cc
+++ b/quic/core/crypto/certificate_view.cc
@@ -196,7 +196,7 @@
}
if (tag == CBS_ASN1_UTCTIME) {
- DCHECK_LE(year, 100u);
+ QUICHE_DCHECK_LE(year, 100u);
year += (year >= 50) ? 1900 : 2000;
}
diff --git a/quic/core/crypto/crypto_framer.cc b/quic/core/crypto/crypto_framer.cc
index 8dd3679..cf6e123 100644
--- a/quic/core/crypto/crypto_framer.cc
+++ b/quic/core/crypto/crypto_framer.cc
@@ -87,13 +87,13 @@
}
bool CryptoFramer::ProcessInput(absl::string_view input) {
- DCHECK_EQ(QUIC_NO_ERROR, error_);
+ QUICHE_DCHECK_EQ(QUIC_NO_ERROR, error_);
if (error_ != QUIC_NO_ERROR) {
return false;
}
error_ = Process(input);
if (error_ != QUIC_NO_ERROR) {
- DCHECK(!error_detail_.empty());
+ QUICHE_DCHECK(!error_detail_.empty());
visitor_->OnError(this);
return false;
}
@@ -160,15 +160,15 @@
std::unique_ptr<char[]> buffer(new char[len]);
QuicDataWriter writer(len, buffer.get(), quiche::HOST_BYTE_ORDER);
if (!writer.WriteTag(message.tag())) {
- DCHECK(false) << "Failed to write message tag.";
+ QUICHE_DCHECK(false) << "Failed to write message tag.";
return nullptr;
}
if (!writer.WriteUInt16(static_cast<uint16_t>(num_entries))) {
- DCHECK(false) << "Failed to write size.";
+ QUICHE_DCHECK(false) << "Failed to write size.";
return nullptr;
}
if (!writer.WriteUInt16(0)) {
- DCHECK(false) << "Failed to write padding.";
+ QUICHE_DCHECK(false) << "Failed to write padding.";
return nullptr;
}
@@ -180,7 +180,8 @@
// Existing PAD tags are only checked when padding needs to be added
// because parts of the code may need to reserialize received messages
// and those messages may, legitimately include padding.
- DCHECK(false) << "Message needed padding but already contained a PAD tag";
+ QUICHE_DCHECK(false)
+ << "Message needed padding but already contained a PAD tag";
return nullptr;
}
@@ -192,12 +193,12 @@
}
if (!writer.WriteTag(it->first)) {
- DCHECK(false) << "Failed to write tag.";
+ QUICHE_DCHECK(false) << "Failed to write tag.";
return nullptr;
}
end_offset += it->second.length();
if (!writer.WriteUInt32(end_offset)) {
- DCHECK(false) << "Failed to write end offset.";
+ QUICHE_DCHECK(false) << "Failed to write end offset.";
return nullptr;
}
}
@@ -214,20 +215,20 @@
if (it->first > kPAD && need_pad_value) {
need_pad_value = false;
if (!writer.WriteRepeatedByte('-', pad_length)) {
- DCHECK(false) << "Failed to write padding.";
+ QUICHE_DCHECK(false) << "Failed to write padding.";
return nullptr;
}
}
if (!writer.WriteBytes(it->second.data(), it->second.length())) {
- DCHECK(false) << "Failed to write value.";
+ QUICHE_DCHECK(false) << "Failed to write value.";
return nullptr;
}
}
if (need_pad_value) {
if (!writer.WriteRepeatedByte('-', pad_length)) {
- DCHECK(false) << "Failed to write padding.";
+ QUICHE_DCHECK(false) << "Failed to write padding.";
return nullptr;
}
}
@@ -321,7 +322,7 @@
for (const std::pair<QuicTag, size_t>& item : tags_and_lengths_) {
absl::string_view value;
if (!reader.ReadStringPiece(&value, item.second)) {
- DCHECK(process_truncated_messages_);
+ QUICHE_DCHECK(process_truncated_messages_);
// Store an empty value.
message_.SetStringPiece(item.first, "");
continue;
@@ -343,12 +344,12 @@
size_t pad_length,
uint32_t* end_offset) {
if (!writer->WriteTag(kPAD)) {
- DCHECK(false) << "Failed to write tag.";
+ QUICHE_DCHECK(false) << "Failed to write tag.";
return false;
}
*end_offset += pad_length;
if (!writer->WriteUInt32(*end_offset)) {
- DCHECK(false) << "Failed to write end offset.";
+ QUICHE_DCHECK(false) << "Failed to write end offset.";
return false;
}
return true;
diff --git a/quic/core/crypto/crypto_secret_boxer.cc b/quic/core/crypto/crypto_secret_boxer.cc
index 0c24c2c..1826212 100644
--- a/quic/core/crypto/crypto_secret_boxer.cc
+++ b/quic/core/crypto/crypto_secret_boxer.cc
@@ -45,12 +45,12 @@
static const EVP_AEAD* (*const kAEAD)() = EVP_aead_aes_256_gcm_siv;
void CryptoSecretBoxer::SetKeys(const std::vector<std::string>& keys) {
- DCHECK(!keys.empty());
+ QUICHE_DCHECK(!keys.empty());
const EVP_AEAD* const aead = kAEAD();
std::unique_ptr<State> new_state(new State);
for (const std::string& key : keys) {
- DCHECK_EQ(kBoxKeySize, key.size());
+ QUICHE_DCHECK_EQ(kBoxKeySize, key.size());
bssl::UniquePtr<EVP_AEAD_CTX> ctx(
EVP_AEAD_CTX_new(aead, reinterpret_cast<const uint8_t*>(key.data()),
key.size(), EVP_AEAD_DEFAULT_TAG_LENGTH));
@@ -100,7 +100,7 @@
}
}
- DCHECK_EQ(out_len, bytes_written);
+ QUICHE_DCHECK_EQ(out_len, bytes_written);
return ret;
}
diff --git a/quic/core/crypto/crypto_server_test.cc b/quic/core/crypto/crypto_server_test.cc
index a6ab228..323aec1 100644
--- a/quic/core/crypto/crypto_server_test.cc
+++ b/quic/core/crypto/crypto_server_test.cc
@@ -48,7 +48,7 @@
void Run(bool /*ok*/,
const std::string& /*error_details*/,
std::unique_ptr<ProofVerifyDetails>* /*details*/) override {
- DCHECK(false);
+ QUICHE_DCHECK(false);
}
};
@@ -129,8 +129,8 @@
config_.AddConfig(primary_config, clock_.WallNow()));
absl::string_view orbit;
- CHECK(msg->GetStringPiece(kORBT, &orbit));
- CHECK_EQ(sizeof(orbit_), orbit.size());
+ QUICHE_CHECK(msg->GetStringPiece(kORBT, &orbit));
+ QUICHE_CHECK_EQ(sizeof(orbit_), orbit.size());
memcpy(orbit_, orbit.data(), orbit.size());
char public_value[32];
@@ -171,7 +171,7 @@
signed_config_ = QuicReferenceCountedPointer<QuicSignedServerConfig>(
new QuicSignedServerConfig());
- DCHECK(signed_config_->chain.get() == nullptr);
+ QUICHE_DCHECK(signed_config_->chain.get() == nullptr);
}
// Helper used to accept the result of ValidateClientHello and pass
diff --git a/quic/core/crypto/crypto_utils.cc b/quic/core/crypto/crypto_utils.cc
index ed63e3c..113d9cf 100644
--- a/quic/core/crypto/crypto_utils.cc
+++ b/quic/core/crypto/crypto_utils.cc
@@ -504,7 +504,7 @@
break;
}
default:
- DCHECK(false);
+ QUICHE_DCHECK(false);
}
if (subkey_secret != nullptr) {
@@ -552,7 +552,7 @@
const CryptoHandshakeMessage& server_hello,
const ParsedQuicVersionVector& negotiated_versions,
std::string* error_details) {
- DCHECK(error_details != nullptr);
+ QUICHE_DCHECK(error_details != nullptr);
if (server_hello.tag() != kSHLO) {
*error_details = "Bad tag";
diff --git a/quic/core/crypto/proof_source_x509_test.cc b/quic/core/crypto/proof_source_x509_test.cc
index f72e2f5..75a6099 100644
--- a/quic/core/crypto/proof_source_x509_test.cc
+++ b/quic/core/crypto/proof_source_x509_test.cc
@@ -36,8 +36,8 @@
CertificatePrivateKey::LoadFromDer(kTestCertificatePrivateKey)),
wildcard_key_(CertificatePrivateKey::LoadFromDer(
kWildcardCertificatePrivateKey)) {
- CHECK(test_key_ != nullptr);
- CHECK(wildcard_key_ != nullptr);
+ QUICHE_CHECK(test_key_ != nullptr);
+ QUICHE_CHECK(wildcard_key_ != nullptr);
}
protected:
diff --git a/quic/core/crypto/quic_crypto_client_config.cc b/quic/core/crypto/quic_crypto_client_config.cc
index aabff94..45db92b 100644
--- a/quic/core/crypto/quic_crypto_client_config.cc
+++ b/quic/core/crypto/quic_crypto_client_config.cc
@@ -70,7 +70,7 @@
session_cache_(std::move(session_cache)),
ssl_ctx_(TlsClientConnection::CreateSslCtx(
!GetQuicFlag(FLAGS_quic_disable_client_tls_zero_rtt))) {
- DCHECK(proof_verifier_.get());
+ QUICHE_DCHECK(proof_verifier_.get());
SetDefaults();
}
@@ -98,7 +98,7 @@
if (!scfg) {
// Should be impossible short of cache corruption.
RecordInchoateClientHelloReason(SERVER_CONFIG_CORRUPTED);
- DCHECK(false);
+ QUICHE_DCHECK(false);
return false;
}
@@ -129,7 +129,7 @@
if (!scfg_) {
scfg_ = CryptoFramer::ParseMessage(server_config_);
- DCHECK(scfg_.get());
+ QUICHE_DCHECK(scfg_.get());
}
return scfg_.get();
}
@@ -266,7 +266,7 @@
absl::string_view signature,
QuicWallTime now,
QuicWallTime expiration_time) {
- DCHECK(server_config_.empty());
+ QUICHE_DCHECK(server_config_.empty());
if (server_config.empty()) {
RecordDiskCacheServerConfigState(SERVER_CONFIG_EMPTY);
@@ -347,8 +347,8 @@
void QuicCryptoClientConfig::CachedState::InitializeFrom(
const QuicCryptoClientConfig::CachedState& other) {
- DCHECK(server_config_.empty());
- DCHECK(!server_config_valid_);
+ QUICHE_DCHECK(server_config_.empty());
+ QUICHE_DCHECK(!server_config_valid_);
server_config_ = other.server_config_;
source_address_token_ = other.source_address_token_;
certs_ = other.certs_;
@@ -494,7 +494,7 @@
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
CryptoHandshakeMessage* out,
std::string* error_details) const {
- DCHECK(error_details != nullptr);
+ QUICHE_DCHECK(error_details != nullptr);
QUIC_BUG_IF(!QuicUtils::IsConnectionIdValidForVersion(
connection_id, preferred_version.transport_version))
<< "FillClientHello: attempted to use connection ID " << connection_id
@@ -574,7 +574,7 @@
P256KeyExchange::New(P256KeyExchange::NewPrivateKey());
break;
default:
- DCHECK(false);
+ QUICHE_DCHECK(false);
*error_details = "Configured to support an unknown key exchange";
return QUIC_CRYPTO_INTERNAL_ERROR;
}
@@ -639,7 +639,7 @@
const std::vector<std::string>& cached_certs,
CachedState* cached,
std::string* error_details) {
- DCHECK(error_details != nullptr);
+ QUICHE_DCHECK(error_details != nullptr);
absl::string_view scfg;
if (!message.GetStringPiece(kSCFG, &scfg)) {
@@ -711,7 +711,7 @@
CachedState* cached,
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
std::string* error_details) {
- DCHECK(error_details != nullptr);
+ QUICHE_DCHECK(error_details != nullptr);
if (rej.tag() != kREJ) {
*error_details = "Message is not REJ";
@@ -741,7 +741,7 @@
CachedState* cached,
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
std::string* error_details) {
- DCHECK(error_details != nullptr);
+ QUICHE_DCHECK(error_details != nullptr);
QuicErrorCode valid = CryptoUtils::ValidateServerHello(
server_hello, negotiated_versions, error_details);
@@ -804,7 +804,7 @@
CachedState* cached,
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> out_params,
std::string* error_details) {
- DCHECK(error_details != nullptr);
+ QUICHE_DCHECK(error_details != nullptr);
if (server_config_update.tag() != kSCUP) {
*error_details = "ServerConfigUpdate must have kSCUP tag.";
@@ -855,7 +855,7 @@
bool QuicCryptoClientConfig::PopulateFromCanonicalConfig(
const QuicServerId& server_id,
CachedState* server_state) {
- DCHECK(server_state->IsEmpty());
+ QUICHE_DCHECK(server_state->IsEmpty());
size_t i = 0;
for (; i < canonical_suffixes_.size(); ++i) {
if (absl::EndsWithIgnoreCase(server_id.host(), canonical_suffixes_[i])) {
diff --git a/quic/core/crypto/quic_crypto_server_config.cc b/quic/core/crypto/quic_crypto_server_config.cc
index 0e9bca8..da04f4f 100644
--- a/quic/core/crypto/quic_crypto_server_config.cc
+++ b/quic/core/crypto/quic_crypto_server_config.cc
@@ -255,7 +255,7 @@
pad_shlo_(true),
validate_chlo_size_(true),
validate_source_address_token_(true) {
- DCHECK(proof_source_.get());
+ QUICHE_DCHECK(proof_source_.get());
source_address_token_boxer_.SetKeys(
{DeriveSourceAddressTokenKey(source_address_token_secret)});
@@ -287,7 +287,7 @@
std::string encoded_public_values;
// First three bytes encode the length of the public value.
- DCHECK_LT(curve25519_public_value.size(), (1U << 24));
+ QUICHE_DCHECK_LT(curve25519_public_value.size(), (1U << 24));
encoded_public_values.push_back(
static_cast<char>(curve25519_public_value.size()));
encoded_public_values.push_back(
@@ -304,7 +304,7 @@
P256KeyExchange::New(p256_private_key));
absl::string_view p256_public_value = p256->public_value();
- DCHECK_LT(p256_public_value.size(), (1U << 24));
+ QUICHE_DCHECK_LT(p256_public_value.size(), (1U << 24));
encoded_public_values.push_back(
static_cast<char>(p256_public_value.size()));
encoded_public_values.push_back(
@@ -338,7 +338,7 @@
if (options.orbit.size() == sizeof(orbit_bytes)) {
memcpy(orbit_bytes, options.orbit.data(), sizeof(orbit_bytes));
} else {
- DCHECK(options.orbit.empty());
+ QUICHE_DCHECK(options.orbit.empty());
rand->RandBytes(orbit_bytes, sizeof(orbit_bytes));
}
msg.SetStringPiece(kORBT,
@@ -416,9 +416,9 @@
configs_[config->id] = config;
SelectNewPrimaryConfig(now);
- DCHECK(primary_config_.get());
- DCHECK_EQ(configs_.find(primary_config_->id)->second.get(),
- primary_config_.get());
+ QUICHE_DCHECK(primary_config_.get());
+ QUICHE_DCHECK_EQ(configs_.find(primary_config_->id)->second.get(),
+ primary_config_.get());
}
return msg;
@@ -506,9 +506,9 @@
configs_ = std::move(new_configs);
fallback_config_ = fallback_config;
SelectNewPrimaryConfig(now);
- DCHECK(primary_config_.get());
- DCHECK_EQ(configs_.find(primary_config_->id)->second.get(),
- primary_config_.get());
+ QUICHE_DCHECK(primary_config_.get());
+ QUICHE_DCHECK_EQ(configs_.find(primary_config_->id)->second.get(),
+ primary_config_.get());
return true;
}
@@ -672,7 +672,7 @@
QuicByteCount total_framing_overhead,
QuicByteCount chlo_packet_size,
std::unique_ptr<ProcessClientHelloResultCallback> done_cb) const {
- DCHECK(done_cb);
+ QUICHE_DCHECK(done_cb);
auto context = std::make_unique<ProcessClientHelloContext>(
validate_chlo_result, reject_only, connection_id, server_address,
client_address, version, supported_versions, clock, rand,
@@ -720,7 +720,7 @@
auto cb = std::make_unique<ProcessClientHelloCallback>(
this, std::move(context), configs);
- DCHECK(proof_source_.get());
+ QUICHE_DCHECK(proof_source_.get());
proof_source_->GetProof(server_address, client_address, sni,
configs.primary->serialized, transport_version,
chlo_hash, std::move(cb));
@@ -862,7 +862,7 @@
hkdf_suffix.append(client_hello_serialized.data(),
client_hello_serialized.length());
hkdf_suffix.append(configs.requested->serialized);
- DCHECK(proof_source_.get());
+ QUICHE_DCHECK(proof_source_.get());
if (context->signed_config()->chain->certs.empty()) {
context->Fail(QUIC_CRYPTO_INTERNAL_ERROR, "Failed to get certs");
return;
@@ -1085,9 +1085,9 @@
configs_lock_.ReaderUnlock();
configs_lock_.WriterLock();
SelectNewPrimaryConfig(now);
- DCHECK(primary_config_.get());
- DCHECK_EQ(configs_.find(primary_config_->id)->second.get(),
- primary_config_.get());
+ QUICHE_DCHECK(primary_config_.get());
+ QUICHE_DCHECK_EQ(configs_.find(primary_config_->id)->second.get(),
+ primary_config_.get());
configs_lock_.WriterUnlock();
configs_lock_.ReaderLock();
}
@@ -1450,7 +1450,7 @@
}
// Send client the reject reason for debugging purposes.
- DCHECK_LT(0u, reject_reasons.size());
+ QUICHE_DCHECK_LT(0u, reject_reasons.size());
out->SetVector(kRREJ, reject_reasons);
// The client may have requested a certificate chain.
@@ -1479,7 +1479,7 @@
context.params()->client_common_set_hashes,
context.params()->client_cached_cert_hashes, config.common_cert_sets);
- DCHECK_GT(context.chlo_packet_size(), context.client_hello().size());
+ QUICHE_DCHECK_GT(context.chlo_packet_size(), context.client_hello().size());
// kREJOverheadBytes is a very rough estimate of how much of a REJ
// message is taken up by things other than the certificates.
// STK: 56 bytes
@@ -1549,7 +1549,7 @@
const std::string& client_cached_cert_hashes,
const CommonCertSets* common_sets) {
// Check whether the compressed certs is available in the cache.
- DCHECK(compressed_certs_cache);
+ QUICHE_DCHECK(compressed_certs_cache);
const std::string* cached_value = compressed_certs_cache->GetCompressedCert(
chain, client_common_set_hashes, client_cached_cert_hashes);
if (cached_value) {
diff --git a/quic/core/crypto/quic_hkdf.cc b/quic/core/crypto/quic_hkdf.cc
index 9cfac5f..8dcf104 100644
--- a/quic/core/crypto/quic_hkdf.cc
+++ b/quic/core/crypto/quic_hkdf.cc
@@ -43,7 +43,7 @@
2 * client_key_bytes_to_generate + client_iv_bytes_to_generate +
2 * server_key_bytes_to_generate + server_iv_bytes_to_generate +
subkey_secret_bytes_to_generate;
- DCHECK_LT(material_length, kMaxKeyMaterialSize);
+ QUICHE_DCHECK_LT(material_length, kMaxKeyMaterialSize);
output_.resize(material_length);
// On Windows, when the size of output_ is zero, dereference of 0'th element
diff --git a/quic/core/crypto/tls_connection.cc b/quic/core/crypto/tls_connection.cc
index 4a39a4e..9b5636c 100644
--- a/quic/core/crypto/tls_connection.cc
+++ b/quic/core/crypto/tls_connection.cc
@@ -36,7 +36,7 @@
CRYPTO_library_init();
ssl_ex_data_index_connection_ =
SSL_get_ex_new_index(0, nullptr, nullptr, nullptr, nullptr);
- CHECK_LE(0, ssl_ex_data_index_connection_);
+ QUICHE_CHECK_LE(0, ssl_ex_data_index_connection_);
}
SslIndexSingleton(const SslIndexSingleton&) = delete;
diff --git a/quic/core/crypto/transport_parameters.cc b/quic/core/crypto/transport_parameters.cc
index a948990..8cbd06e 100644
--- a/quic/core/crypto/transport_parameters.cc
+++ b/quic/core/crypto/transport_parameters.cc
@@ -179,9 +179,9 @@
min_value_(min_value),
max_value_(max_value),
has_been_read_(false) {
- DCHECK_LE(min_value, default_value);
- DCHECK_LE(default_value, max_value);
- DCHECK_LE(max_value, kVarInt62MaxValue);
+ QUICHE_DCHECK_LE(min_value, default_value);
+ QUICHE_DCHECK_LE(default_value, max_value);
+ QUICHE_DCHECK_LE(max_value, kVarInt62MaxValue);
}
TransportParameters::IntegerParameter::IntegerParameter(
@@ -206,7 +206,7 @@
bool TransportParameters::IntegerParameter::Write(
QuicDataWriter* writer) const {
- DCHECK(IsValid());
+ QUICHE_DCHECK(IsValid());
if (value_ == default_value_) {
// Do not write if the value is default.
return true;
@@ -532,8 +532,8 @@
}
bool TransportParameters::AreValid(std::string* error_details) const {
- DCHECK(perspective == Perspective::IS_CLIENT ||
- perspective == Perspective::IS_SERVER);
+ QUICHE_DCHECK(perspective == Perspective::IS_CLIENT ||
+ perspective == Perspective::IS_SERVER);
if (perspective == Perspective::IS_CLIENT && !stateless_reset_token.empty()) {
*error_details = "Client cannot send stateless reset token";
return false;
@@ -693,7 +693,7 @@
// original_destination_connection_id
if (in.original_destination_connection_id.has_value()) {
- DCHECK_EQ(Perspective::IS_SERVER, in.perspective);
+ QUICHE_DCHECK_EQ(Perspective::IS_SERVER, in.perspective);
QuicConnectionId original_destination_connection_id =
in.original_destination_connection_id.value();
if (!writer.WriteVarInt62(
@@ -714,8 +714,9 @@
// stateless_reset_token
if (!in.stateless_reset_token.empty()) {
- DCHECK_EQ(kStatelessResetTokenLength, in.stateless_reset_token.size());
- DCHECK_EQ(Perspective::IS_SERVER, in.perspective);
+ QUICHE_DCHECK_EQ(kStatelessResetTokenLength,
+ in.stateless_reset_token.size());
+ QUICHE_DCHECK_EQ(Perspective::IS_SERVER, in.perspective);
if (!writer.WriteVarInt62(TransportParameters::kStatelessResetToken) ||
!writer.WriteStringPieceVarInt62(absl::string_view(
reinterpret_cast<const char*>(in.stateless_reset_token.data()),
@@ -804,7 +805,7 @@
// retry_source_connection_id
if (in.retry_source_connection_id.has_value()) {
- DCHECK_EQ(Perspective::IS_SERVER, in.perspective);
+ QUICHE_DCHECK_EQ(Perspective::IS_SERVER, in.perspective);
QuicConnectionId retry_source_connection_id =
in.retry_source_connection_id.value();
if (!writer.WriteVarInt62(TransportParameters::kRetrySourceConnectionId) ||
@@ -921,7 +922,7 @@
TransportParameters::TransportParameterId grease_id =
static_cast<TransportParameters::TransportParameterId>(grease_id64);
const size_t grease_length = random->RandUint64() % kMaxGreaseLength;
- DCHECK_GE(kMaxGreaseLength, grease_length);
+ QUICHE_DCHECK_GE(kMaxGreaseLength, grease_length);
char grease_contents[kMaxGreaseLength];
random->RandBytes(grease_contents, grease_length);
if (!writer.WriteVarInt62(grease_id) ||
@@ -1213,7 +1214,7 @@
break;
}
if (!parse_success) {
- DCHECK(!error_details->empty());
+ QUICHE_DCHECK(!error_details->empty());
return false;
}
if (!value_reader.IsDoneReading()) {
@@ -1225,7 +1226,7 @@
}
if (!out->AreValid(error_details)) {
- DCHECK(!error_details->empty());
+ QUICHE_DCHECK(!error_details->empty());
return false;
}
diff --git a/quic/core/frames/quic_ack_frame.cc b/quic/core/frames/quic_ack_frame.cc
index 4a578b1..7c112c2 100644
--- a/quic/core/frames/quic_ack_frame.cc
+++ b/quic/core/frames/quic_ack_frame.cc
@@ -20,7 +20,7 @@
bool IsAwaitingPacket(const QuicAckFrame& ack_frame,
QuicPacketNumber packet_number,
QuicPacketNumber peer_least_packet_awaiting_ack) {
- DCHECK(packet_number.IsInitialized());
+ QUICHE_DCHECK(packet_number.IsInitialized());
return (!peer_least_packet_awaiting_ack.IsInitialized() ||
packet_number >= peer_least_packet_awaiting_ack) &&
!ack_frame.packets.Contains(packet_number);
@@ -118,12 +118,12 @@
}
QuicPacketNumber PacketNumberQueue::Min() const {
- DCHECK(!Empty());
+ QUICHE_DCHECK(!Empty());
return packet_number_intervals_.begin()->min();
}
QuicPacketNumber PacketNumberQueue::Max() const {
- DCHECK(!Empty());
+ QUICHE_DCHECK(!Empty());
return packet_number_intervals_.rbegin()->max() - 1;
}
@@ -156,7 +156,7 @@
}
QuicPacketCount PacketNumberQueue::LastIntervalLength() const {
- DCHECK(!Empty());
+ QUICHE_DCHECK(!Empty());
return packet_number_intervals_.rbegin()->Length();
}
diff --git a/quic/core/frames/quic_frame.cc b/quic/core/frames/quic_frame.cc
index dd1163f..e54e254 100644
--- a/quic/core/frames/quic_frame.cc
+++ b/quic/core/frames/quic_frame.cc
@@ -96,7 +96,7 @@
frame->type != STOP_WAITING_FRAME &&
frame->type != STREAMS_BLOCKED_FRAME && frame->type != STREAM_FRAME &&
frame->type != HANDSHAKE_DONE_FRAME) {
- CHECK(!frame->delete_forbidden) << *frame;
+ QUICHE_CHECK(!frame->delete_forbidden) << *frame;
}
#endif // QUIC_FRAME_DEBUG
switch (frame->type) {
@@ -156,7 +156,7 @@
delete frame->ack_frequency_frame;
break;
case NUM_FRAME_TYPES:
- DCHECK(false) << "Cannot delete type: " << frame->type;
+ QUICHE_DCHECK(false) << "Cannot delete type: " << frame->type;
}
}
diff --git a/quic/core/frames/quic_new_connection_id_frame.cc b/quic/core/frames/quic_new_connection_id_frame.cc
index cea43aa..fa99dfe 100644
--- a/quic/core/frames/quic_new_connection_id_frame.cc
+++ b/quic/core/frames/quic_new_connection_id_frame.cc
@@ -17,7 +17,7 @@
sequence_number(sequence_number),
stateless_reset_token(stateless_reset_token),
retire_prior_to(retire_prior_to) {
- DCHECK(retire_prior_to <= sequence_number);
+ QUICHE_DCHECK(retire_prior_to <= sequence_number);
}
std::ostream& operator<<(std::ostream& os,
diff --git a/quic/core/http/end_to_end_test.cc b/quic/core/http/end_to_end_test.cc
index c017b16..887e0eb 100644
--- a/quic/core/http/end_to_end_test.cc
+++ b/quic/core/http/end_to_end_test.cc
@@ -4543,7 +4543,8 @@
}
void HoldNextPacket() {
- DCHECK(packet_content_.empty()) << "There is already one packet on hold.";
+ QUICHE_DCHECK(packet_content_.empty())
+ << "There is already one packet on hold.";
hold_next_packet_ = true;
}
diff --git a/quic/core/http/http_decoder.cc b/quic/core/http/http_decoder.cc
index 1aee09c..fe33a81 100644
--- a/quic/core/http/http_decoder.cc
+++ b/quic/core/http/http_decoder.cc
@@ -34,7 +34,7 @@
remaining_push_id_length_(0),
error_(QUIC_NO_ERROR),
error_detail_("") {
- DCHECK(visitor_);
+ QUICHE_DCHECK(visitor_);
}
HttpDecoder::~HttpDecoder() {}
@@ -84,16 +84,16 @@
}
QuicByteCount HttpDecoder::ProcessInput(const char* data, QuicByteCount len) {
- DCHECK_EQ(QUIC_NO_ERROR, error_);
- DCHECK_NE(STATE_ERROR, state_);
+ QUICHE_DCHECK_EQ(QUIC_NO_ERROR, error_);
+ QUICHE_DCHECK_NE(STATE_ERROR, state_);
QuicDataReader reader(data, len);
bool continue_processing = true;
while (continue_processing &&
(reader.BytesRemaining() != 0 || state_ == STATE_FINISH_PARSING)) {
// |continue_processing| must have been set to false upon error.
- DCHECK_EQ(QUIC_NO_ERROR, error_);
- DCHECK_NE(STATE_ERROR, state_);
+ QUICHE_DCHECK_EQ(QUIC_NO_ERROR, error_);
+ QUICHE_DCHECK_NE(STATE_ERROR, state_);
switch (state_) {
case STATE_READING_FRAME_TYPE:
@@ -119,11 +119,11 @@
}
bool HttpDecoder::ReadFrameType(QuicDataReader* reader) {
- DCHECK_NE(0u, reader->BytesRemaining());
+ QUICHE_DCHECK_NE(0u, reader->BytesRemaining());
if (current_type_field_length_ == 0) {
// A new frame is coming.
current_type_field_length_ = reader->PeekVarInt62Length();
- DCHECK_NE(0u, current_type_field_length_);
+ QUICHE_DCHECK_NE(0u, current_type_field_length_);
if (current_type_field_length_ > reader->BytesRemaining()) {
// Buffer a new type field.
remaining_type_field_length_ = current_type_field_length_;
@@ -132,7 +132,7 @@
}
// The reader has all type data needed, so no need to buffer.
bool success = reader->ReadVarInt62(¤t_frame_type_);
- DCHECK(success);
+ QUICHE_DCHECK(success);
} else {
// Buffer the existing type field.
BufferFrameType(reader);
@@ -142,7 +142,7 @@
}
QuicDataReader type_reader(type_buffer_.data(), current_type_field_length_);
bool success = type_reader.ReadVarInt62(¤t_frame_type_);
- DCHECK(success);
+ QUICHE_DCHECK(success);
}
// https://tools.ietf.org/html/draft-ietf-quic-http-31#section-7.2.8
@@ -165,11 +165,11 @@
}
bool HttpDecoder::ReadFrameLength(QuicDataReader* reader) {
- DCHECK_NE(0u, reader->BytesRemaining());
+ QUICHE_DCHECK_NE(0u, reader->BytesRemaining());
if (current_length_field_length_ == 0) {
// A new frame is coming.
current_length_field_length_ = reader->PeekVarInt62Length();
- DCHECK_NE(0u, current_length_field_length_);
+ QUICHE_DCHECK_NE(0u, current_length_field_length_);
if (current_length_field_length_ > reader->BytesRemaining()) {
// Buffer a new length field.
remaining_length_field_length_ = current_length_field_length_;
@@ -178,7 +178,7 @@
}
// The reader has all length data needed, so no need to buffer.
bool success = reader->ReadVarInt62(¤t_frame_length_);
- DCHECK(success);
+ QUICHE_DCHECK(success);
} else {
// Buffer the existing length field.
BufferFrameLength(reader);
@@ -189,7 +189,7 @@
QuicDataReader length_reader(length_buffer_.data(),
current_length_field_length_);
bool success = length_reader.ReadVarInt62(¤t_frame_length_);
- DCHECK(success);
+ QUICHE_DCHECK(success);
}
if (current_frame_length_ > MaxFrameLength(current_frame_type_)) {
@@ -259,8 +259,8 @@
}
bool HttpDecoder::ReadFramePayload(QuicDataReader* reader) {
- DCHECK_NE(0u, reader->BytesRemaining());
- DCHECK_NE(0u, remaining_frame_length_);
+ QUICHE_DCHECK_NE(0u, reader->BytesRemaining());
+ QUICHE_DCHECK_NE(0u, remaining_frame_length_);
bool continue_processing = true;
@@ -270,8 +270,8 @@
remaining_frame_length_, reader->BytesRemaining());
absl::string_view payload;
bool success = reader->ReadStringPiece(&payload, bytes_to_read);
- DCHECK(success);
- DCHECK(!payload.empty());
+ QUICHE_DCHECK(success);
+ QUICHE_DCHECK(!payload.empty());
continue_processing = visitor_->OnDataFramePayload(payload);
remaining_frame_length_ -= payload.length();
break;
@@ -281,8 +281,8 @@
remaining_frame_length_, reader->BytesRemaining());
absl::string_view payload;
bool success = reader->ReadStringPiece(&payload, bytes_to_read);
- DCHECK(success);
- DCHECK(!payload.empty());
+ QUICHE_DCHECK(success);
+ QUICHE_DCHECK(!payload.empty());
continue_processing = visitor_->OnHeadersFramePayload(payload);
remaining_frame_length_ -= payload.length();
break;
@@ -299,7 +299,7 @@
PushId push_id;
if (current_frame_length_ == remaining_frame_length_) {
// A new Push Promise frame just arrived.
- DCHECK_EQ(0u, current_push_id_length_);
+ QUICHE_DCHECK_EQ(0u, current_push_id_length_);
current_push_id_length_ = reader->PeekVarInt62Length();
if (current_push_id_length_ > remaining_frame_length_) {
RaiseError(QUIC_HTTP_FRAME_ERROR,
@@ -308,13 +308,13 @@
}
if (current_push_id_length_ > reader->BytesRemaining()) {
// Not all bytes of push id is present yet, buffer push id.
- DCHECK_EQ(0u, remaining_push_id_length_);
+ QUICHE_DCHECK_EQ(0u, remaining_push_id_length_);
remaining_push_id_length_ = current_push_id_length_;
BufferPushId(reader);
break;
}
bool success = reader->ReadVarInt62(&push_id);
- DCHECK(success);
+ QUICHE_DCHECK(success);
remaining_frame_length_ -= current_push_id_length_;
if (!visitor_->OnPushPromiseFramePushId(
push_id, current_push_id_length_,
@@ -334,7 +334,7 @@
current_push_id_length_);
bool success = push_id_reader.ReadVarInt62(&push_id);
- DCHECK(success);
+ QUICHE_DCHECK(success);
if (!visitor_->OnPushPromiseFramePushId(
push_id, current_push_id_length_,
current_frame_length_ - current_push_id_length_)) {
@@ -346,7 +346,7 @@
}
// Read Push Promise headers.
- DCHECK_LT(remaining_frame_length_, current_frame_length_);
+ QUICHE_DCHECK_LT(remaining_frame_length_, current_frame_length_);
QuicByteCount bytes_to_read = std::min<QuicByteCount>(
remaining_frame_length_, reader->BytesRemaining());
if (bytes_to_read == 0) {
@@ -354,8 +354,8 @@
}
absl::string_view payload;
bool success = reader->ReadStringPiece(&payload, bytes_to_read);
- DCHECK(success);
- DCHECK(!payload.empty());
+ QUICHE_DCHECK(success);
+ QUICHE_DCHECK(!payload.empty());
continue_processing = visitor_->OnPushPromiseFramePayload(payload);
remaining_frame_length_ -= payload.length();
break;
@@ -404,7 +404,7 @@
}
bool HttpDecoder::FinishParsing() {
- DCHECK_EQ(0u, remaining_frame_length_);
+ QUICHE_DCHECK_EQ(0u, remaining_frame_length_);
bool continue_processing = true;
@@ -528,8 +528,8 @@
remaining_frame_length_, reader->BytesRemaining());
absl::string_view payload;
bool success = reader->ReadStringPiece(&payload, bytes_to_read);
- DCHECK(success);
- DCHECK(!payload.empty());
+ QUICHE_DCHECK(success);
+ QUICHE_DCHECK(!payload.empty());
remaining_frame_length_ -= payload.length();
return visitor_->OnUnknownFramePayload(payload);
}
@@ -539,7 +539,7 @@
remaining_frame_length_, reader->BytesRemaining());
absl::string_view payload;
bool success = reader->ReadStringPiece(&payload, bytes_to_read);
- DCHECK(success);
+ QUICHE_DCHECK(success);
remaining_frame_length_ -= payload.length();
if (remaining_frame_length_ == 0) {
state_ = STATE_READING_FRAME_TYPE;
@@ -558,7 +558,7 @@
bool success = reader->ReadBytes(
&(buffer_[0]) + current_frame_length_ - remaining_frame_length_,
bytes_to_read);
- DCHECK(success);
+ QUICHE_DCHECK(success);
remaining_frame_length_ -= bytes_to_read;
}
@@ -569,7 +569,7 @@
reader->ReadBytes(length_buffer_.data() + current_length_field_length_ -
remaining_length_field_length_,
bytes_to_read);
- DCHECK(success);
+ QUICHE_DCHECK(success);
remaining_length_field_length_ -= bytes_to_read;
}
@@ -580,19 +580,19 @@
reader->ReadBytes(type_buffer_.data() + current_type_field_length_ -
remaining_type_field_length_,
bytes_to_read);
- DCHECK(success);
+ QUICHE_DCHECK(success);
remaining_type_field_length_ -= bytes_to_read;
}
void HttpDecoder::BufferPushId(QuicDataReader* reader) {
- DCHECK_LE(remaining_push_id_length_, current_frame_length_);
+ QUICHE_DCHECK_LE(remaining_push_id_length_, current_frame_length_);
QuicByteCount bytes_to_read = std::min<QuicByteCount>(
reader->BytesRemaining(), remaining_push_id_length_);
bool success =
reader->ReadBytes(push_id_buffer_.data() + current_push_id_length_ -
remaining_push_id_length_,
bytes_to_read);
- DCHECK(success);
+ QUICHE_DCHECK(success);
remaining_push_id_length_ -= bytes_to_read;
remaining_frame_length_ -= bytes_to_read;
}
diff --git a/quic/core/http/http_decoder_test.cc b/quic/core/http/http_decoder_test.cc
index 791d43c..1be5084 100644
--- a/quic/core/http/http_decoder_test.cc
+++ b/quic/core/http/http_decoder_test.cc
@@ -177,7 +177,7 @@
QuicByteCount processed_bytes = ProcessInput(input_with_garbage_appended);
// Guaranteed by HttpDecoder::ProcessInput() contract.
- DCHECK_LE(processed_bytes, input_with_garbage_appended.size());
+ QUICHE_DCHECK_LE(processed_bytes, input_with_garbage_appended.size());
// Caller should set up visitor to pause decoding
// before HttpDecoder would read garbage.
diff --git a/quic/core/http/http_encoder.cc b/quic/core/http/http_encoder.cc
index 573bfad..fafe3b8 100644
--- a/quic/core/http/http_encoder.cc
+++ b/quic/core/http/http_encoder.cc
@@ -37,7 +37,7 @@
QuicByteCount HttpEncoder::SerializeDataFrameHeader(
QuicByteCount payload_length,
std::unique_ptr<char[]>* output) {
- DCHECK_NE(0u, payload_length);
+ QUICHE_DCHECK_NE(0u, payload_length);
QuicByteCount header_length = QuicDataWriter::GetVarInt62Len(payload_length) +
QuicDataWriter::GetVarInt62Len(
static_cast<uint64_t>(HttpFrameType::DATA));
@@ -57,7 +57,7 @@
QuicByteCount HttpEncoder::SerializeHeadersFrameHeader(
QuicByteCount payload_length,
std::unique_ptr<char[]>* output) {
- DCHECK_NE(0u, payload_length);
+ QUICHE_DCHECK_NE(0u, payload_length);
QuicByteCount header_length =
QuicDataWriter::GetVarInt62Len(payload_length) +
QuicDataWriter::GetVarInt62Len(
diff --git a/quic/core/http/quic_receive_control_stream.cc b/quic/core/http/quic_receive_control_stream.cc
index c87faa2..70e7f4a 100644
--- a/quic/core/http/quic_receive_control_stream.cc
+++ b/quic/core/http/quic_receive_control_stream.cc
@@ -45,7 +45,7 @@
iovec iov;
while (!reading_stopped() && decoder_.error() == QUIC_NO_ERROR &&
sequencer()->GetReadableRegion(&iov)) {
- DCHECK(!sequencer()->IsClosed());
+ QUICHE_DCHECK(!sequencer()->IsClosed());
QuicByteCount processed_bytes = decoder_.ProcessInput(
reinterpret_cast<const char*>(iov.iov_base), iov.iov_len);
@@ -57,7 +57,7 @@
// The only reason QuicReceiveControlStream pauses HttpDecoder is an error,
// in which case the connection would have already been closed.
- DCHECK_EQ(iov.iov_len, processed_bytes);
+ QUICHE_DCHECK_EQ(iov.iov_len, processed_bytes);
}
}
@@ -270,7 +270,7 @@
}
bool QuicReceiveControlStream::OnAcceptChFrame(const AcceptChFrame& frame) {
- DCHECK_EQ(Perspective::IS_CLIENT, spdy_session()->perspective());
+ QUICHE_DCHECK_EQ(Perspective::IS_CLIENT, spdy_session()->perspective());
if (spdy_session()->debug_visitor()) {
spdy_session()->debug_visitor()->OnAcceptChFrameReceived(frame);
diff --git a/quic/core/http/quic_send_control_stream.cc b/quic/core/http/quic_send_control_stream.cc
index 949b2bf..8334130 100644
--- a/quic/core/http/quic_send_control_stream.cc
+++ b/quic/core/http/quic_send_control_stream.cc
@@ -104,7 +104,7 @@
}
void QuicSendControlStream::SendMaxPushIdFrame(PushId max_push_id) {
- DCHECK_EQ(Perspective::IS_CLIENT, session()->perspective());
+ QUICHE_DCHECK_EQ(Perspective::IS_CLIENT, session()->perspective());
QuicConnection::ScopedPacketFlusher flusher(session()->connection());
MaybeSendSettingsFrame();
diff --git a/quic/core/http/quic_server_session_base_test.cc b/quic/core/http/quic_server_session_base_test.cc
index 1cb42aa..f9483fe 100644
--- a/quic/core/http/quic_server_session_base_test.cc
+++ b/quic/core/http/quic_server_session_base_test.cc
@@ -95,7 +95,7 @@
}
QuicSpdyStream* CreateOutgoingBidirectionalStream() override {
- DCHECK(false);
+ QUICHE_DCHECK(false);
return nullptr;
}
diff --git a/quic/core/http/quic_spdy_client_session.cc b/quic/core/http/quic_spdy_client_session.cc
index e165de0..ba5b457 100644
--- a/quic/core/http/quic_spdy_client_session.cc
+++ b/quic/core/http/quic_spdy_client_session.cc
@@ -103,7 +103,7 @@
}
void QuicSpdyClientSession::CryptoConnect() {
- DCHECK(flow_controller());
+ QUICHE_DCHECK(flow_controller());
crypto_stream_->CryptoConnect();
}
diff --git a/quic/core/http/quic_spdy_client_session_base.cc b/quic/core/http/quic_spdy_client_session_base.cc
index 996af35..49f0198 100644
--- a/quic/core/http/quic_spdy_client_session_base.cc
+++ b/quic/core/http/quic_spdy_client_session_base.cc
@@ -155,7 +155,7 @@
promised_by_id_[promised_id] = std::move(promised_owner);
bool result = promised->OnPromiseHeaders(headers);
if (result) {
- DCHECK(promised_by_id_.find(promised_id) != promised_by_id_.end());
+ QUICHE_DCHECK(promised_by_id_.find(promised_id) != promised_by_id_.end());
}
return result;
}
@@ -206,7 +206,7 @@
void QuicSpdyClientSessionBase::ResetPromised(
QuicStreamId id,
QuicRstStreamErrorCode error_code) {
- DCHECK(QuicUtils::IsServerInitiatedStreamId(transport_version(), id));
+ QUICHE_DCHECK(QuicUtils::IsServerInitiatedStreamId(transport_version(), id));
ResetStream(id, error_code);
if (!IsOpenStream(id) && !IsClosedStream(id)) {
MaybeIncreaseLargestPeerStreamId(id);
diff --git a/quic/core/http/quic_spdy_client_stream.cc b/quic/core/http/quic_spdy_client_stream.cc
index 0d95dd3..931bfb3 100644
--- a/quic/core/http/quic_spdy_client_stream.cc
+++ b/quic/core/http/quic_spdy_client_stream.cc
@@ -48,7 +48,7 @@
const QuicHeaderList& header_list) {
QuicSpdyStream::OnInitialHeadersComplete(fin, frame_len, header_list);
- DCHECK(headers_decompressed());
+ QUICHE_DCHECK(headers_decompressed());
header_bytes_read_ += frame_len;
if (!SpdyUtils::CopyAndValidateHeaders(header_list, &content_length_,
&response_headers_)) {
diff --git a/quic/core/http/quic_spdy_server_stream_base.cc b/quic/core/http/quic_spdy_server_stream_base.cc
index efe730a..d6cbddf 100644
--- a/quic/core/http/quic_spdy_server_stream_base.cc
+++ b/quic/core/http/quic_spdy_server_stream_base.cc
@@ -25,7 +25,7 @@
!rst_sent()) {
// Early cancel the stream if it has stopped reading before receiving FIN
// or RST.
- DCHECK(fin_sent() || !session()->connection()->connected());
+ QUICHE_DCHECK(fin_sent() || !session()->connection()->connected());
// Tell the peer to stop sending further data.
QUIC_DVLOG(1) << " Server: Send QUIC_STREAM_NO_ERROR on stream " << id();
if (session()->split_up_send_rst()) {
@@ -41,7 +41,7 @@
void QuicSpdyServerStreamBase::StopReading() {
if (!fin_received() && !rst_received() && write_side_closed() &&
!rst_sent()) {
- DCHECK(fin_sent());
+ QUICHE_DCHECK(fin_sent());
// Tell the peer to stop sending further data.
QUIC_DVLOG(1) << " Server: Send QUIC_STREAM_NO_ERROR on stream " << id();
if (session()->split_up_send_rst()) {
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc
index 8026ac2..5374044 100644
--- a/quic/core/http/quic_spdy_session.cc
+++ b/quic/core/http/quic_spdy_session.cc
@@ -180,12 +180,12 @@
SpdyHeadersHandlerInterface* OnHeaderFrameStart(
SpdyStreamId /* stream_id */) override {
- DCHECK(!VersionUsesHttp3(session_->transport_version()));
+ QUICHE_DCHECK(!VersionUsesHttp3(session_->transport_version()));
return &header_list_;
}
void OnHeaderFrameEnd(SpdyStreamId /* stream_id */) override {
- DCHECK(!VersionUsesHttp3(session_->transport_version()));
+ QUICHE_DCHECK(!VersionUsesHttp3(session_->transport_version()));
LogHeaderCompressionRatioHistogram(
/* using_qpack = */ false,
@@ -201,7 +201,7 @@
void OnStreamFrameData(SpdyStreamId /*stream_id*/,
const char* /*data*/,
size_t /*len*/) override {
- DCHECK(!VersionUsesHttp3(session_->transport_version()));
+ QUICHE_DCHECK(!VersionUsesHttp3(session_->transport_version()));
CloseConnection("SPDY DATA frame received.",
QUIC_INVALID_HEADERS_STREAM_DATA);
}
@@ -290,7 +290,7 @@
void OnDataFrameHeader(SpdyStreamId /*stream_id*/,
size_t /*length*/,
bool /*fin*/) override {
- DCHECK(!VersionUsesHttp3(session_->transport_version()));
+ QUICHE_DCHECK(!VersionUsesHttp3(session_->transport_version()));
CloseConnection("SPDY DATA frame received.",
QUIC_INVALID_HEADERS_STREAM_DATA);
}
@@ -302,12 +302,12 @@
}
void OnSetting(SpdySettingsId id, uint32_t value) override {
- DCHECK(!VersionUsesHttp3(session_->transport_version()));
+ QUICHE_DCHECK(!VersionUsesHttp3(session_->transport_version()));
session_->OnSetting(id, value);
}
void OnSettingsEnd() override {
- DCHECK(!VersionUsesHttp3(session_->transport_version()));
+ QUICHE_DCHECK(!VersionUsesHttp3(session_->transport_version()));
}
void OnPing(SpdyPingId /*unique_id*/, bool /*is_ack*/) override {
@@ -357,7 +357,7 @@
void OnPushPromise(SpdyStreamId stream_id,
SpdyStreamId promised_stream_id,
bool /*end*/) override {
- DCHECK(!VersionUsesHttp3(session_->transport_version()));
+ QUICHE_DCHECK(!VersionUsesHttp3(session_->transport_version()));
if (session_->perspective() != Perspective::IS_CLIENT) {
CloseConnection("PUSH_PROMISE not supported.",
QUIC_INVALID_HEADERS_STREAM_DATA);
@@ -375,7 +375,7 @@
SpdyStreamId /* parent_id */,
int weight,
bool /* exclusive */) override {
- DCHECK(!VersionUsesHttp3(session_->transport_version()));
+ QUICHE_DCHECK(!VersionUsesHttp3(session_->transport_version()));
if (!session_->IsConnected()) {
return;
}
@@ -507,12 +507,12 @@
QuicUtils::GetHeadersStreamId(transport_version()));
} else {
QuicStreamId headers_stream_id = GetNextOutgoingBidirectionalStreamId();
- DCHECK_EQ(headers_stream_id,
- QuicUtils::GetHeadersStreamId(transport_version()));
+ QUICHE_DCHECK_EQ(headers_stream_id,
+ QuicUtils::GetHeadersStreamId(transport_version()));
}
auto headers_stream = std::make_unique<QuicHeadersStream>((this));
- DCHECK_EQ(QuicUtils::GetHeadersStreamId(transport_version()),
- headers_stream->id());
+ QUICHE_DCHECK_EQ(QuicUtils::GetHeadersStreamId(transport_version()),
+ headers_stream->id());
headers_stream_ = headers_stream.get();
ActivateStream(std::move(headers_stream));
@@ -542,7 +542,7 @@
void QuicSpdySession::OnDecoderStreamError(QuicErrorCode error_code,
absl::string_view error_message) {
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
CloseConnectionWithDetails(
error_code, absl::StrCat("Decoder stream error: ", error_message));
@@ -550,7 +550,7 @@
void QuicSpdySession::OnEncoderStreamError(QuicErrorCode error_code,
absl::string_view error_message) {
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
CloseConnectionWithDetails(
error_code, absl::StrCat("Encoder stream error: ", error_message));
@@ -690,7 +690,7 @@
bool fin,
const spdy::SpdyStreamPrecedence& precedence,
QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) {
- DCHECK(!VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(!VersionUsesHttp3(transport_version()));
return WriteHeadersOnHeadersStreamImpl(
id, std::move(headers), fin,
@@ -703,7 +703,7 @@
QuicStreamId parent_stream_id,
int weight,
bool exclusive) {
- DCHECK(!VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(!VersionUsesHttp3(transport_version()));
SpdyPriorityIR priority_frame(id, parent_stream_id, weight, exclusive);
SpdySerializedFrame frame(spdy_framer_.SerializeFrame(priority_frame));
headers_stream()->WriteOrBufferData(
@@ -713,7 +713,7 @@
void QuicSpdySession::WriteHttp3PriorityUpdate(
const PriorityUpdateFrame& priority_update) {
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
send_control_stream_->WritePriorityUpdate(priority_update);
}
@@ -765,7 +765,7 @@
// goaway.
if (perspective() == Perspective::IS_SERVER &&
frame.stream_count >= QuicUtils::GetMaxStreamCount()) {
- DCHECK_EQ(frame.stream_count, QuicUtils::GetMaxStreamCount());
+ QUICHE_DCHECK_EQ(frame.stream_count, QuicUtils::GetMaxStreamCount());
SendHttp3GoAway(QUIC_PEER_GOING_AWAY, "stream count too large");
}
return true;
@@ -773,8 +773,8 @@
void QuicSpdySession::SendHttp3GoAway(QuicErrorCode error_code,
const std::string& reason) {
- DCHECK_EQ(perspective(), Perspective::IS_SERVER);
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK_EQ(perspective(), Perspective::IS_SERVER);
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
if (GetQuicReloadableFlag(quic_encrypted_goaway)) {
QUIC_RELOADABLE_FLAG_COUNT_N(quic_encrypted_goaway, 2, 2);
if (!IsEncryptionEstablished()) {
@@ -835,8 +835,8 @@
return;
}
- DCHECK_EQ(perspective(), Perspective::IS_SERVER);
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK_EQ(perspective(), Perspective::IS_SERVER);
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
QuicStreamCount advertised_max_incoming_bidirectional_streams =
GetAdvertisedMaxIncomingBidirectionalStreams();
const QuicStreamId stream_id =
@@ -915,13 +915,13 @@
}
QpackEncoder* QuicSpdySession::qpack_encoder() {
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
return qpack_encoder_.get();
}
QpackDecoder* QuicSpdySession::qpack_decoder() {
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
return qpack_decoder_.get();
}
@@ -964,7 +964,8 @@
// True if there are open HTTP requests.
bool QuicSpdySession::ShouldKeepConnectionAlive() const {
- DCHECK(VersionUsesHttp3(transport_version()) || 0u == pending_streams_size());
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()) ||
+ 0u == pending_streams_size());
return GetNumActiveStreams() + pending_streams_size() > 0;
}
@@ -983,7 +984,7 @@
int weight,
bool exclusive,
QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) {
- DCHECK(!VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(!VersionUsesHttp3(transport_version()));
const QuicByteCount uncompressed_size = headers.TotalBytesUsed();
SpdyHeadersIR headers_frame(id, std::move(headers));
@@ -1027,8 +1028,8 @@
}
bool QuicSpdySession::ResumeApplicationState(ApplicationState* cached_state) {
- DCHECK_EQ(perspective(), Perspective::IS_CLIENT);
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK_EQ(perspective(), Perspective::IS_CLIENT);
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
SettingsFrame out;
if (!HttpDecoder::DecodeSettings(
@@ -1067,7 +1068,7 @@
}
bool QuicSpdySession::OnSettingsFrame(const SettingsFrame& frame) {
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
if (debug_visitor_ != nullptr) {
debug_visitor_->OnSettingsFrameReceived(frame);
}
@@ -1251,18 +1252,20 @@
return;
}
}
- DCHECK_EQ(QuicUtils::GetInvalidStreamId(transport_version()), stream_id_);
- DCHECK_EQ(QuicUtils::GetInvalidStreamId(transport_version()),
- promised_stream_id_);
+ QUICHE_DCHECK_EQ(QuicUtils::GetInvalidStreamId(transport_version()),
+ stream_id_);
+ QUICHE_DCHECK_EQ(QuicUtils::GetInvalidStreamId(transport_version()),
+ promised_stream_id_);
stream_id_ = stream_id;
fin_ = fin;
}
void QuicSpdySession::OnPushPromise(SpdyStreamId stream_id,
SpdyStreamId promised_stream_id) {
- DCHECK_EQ(QuicUtils::GetInvalidStreamId(transport_version()), stream_id_);
- DCHECK_EQ(QuicUtils::GetInvalidStreamId(transport_version()),
- promised_stream_id_);
+ QUICHE_DCHECK_EQ(QuicUtils::GetInvalidStreamId(transport_version()),
+ stream_id_);
+ QUICHE_DCHECK_EQ(QuicUtils::GetInvalidStreamId(transport_version()),
+ promised_stream_id_);
stream_id_ = stream_id;
promised_stream_id_ = promised_stream_id;
}
@@ -1284,8 +1287,8 @@
<< ": " << header_list.DebugString();
// This code path is only executed for push promise in IETF QUIC.
if (VersionUsesHttp3(transport_version())) {
- DCHECK(promised_stream_id_ !=
- QuicUtils::GetInvalidStreamId(transport_version()));
+ QUICHE_DCHECK(promised_stream_id_ !=
+ QuicUtils::GetInvalidStreamId(transport_version()));
}
if (promised_stream_id_ ==
QuicUtils::GetInvalidStreamId(transport_version())) {
@@ -1330,8 +1333,8 @@
}
bool QuicSpdySession::ProcessPendingStream(PendingStream* pending) {
- DCHECK(VersionUsesHttp3(transport_version()));
- DCHECK(connection()->connected());
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(connection()->connected());
struct iovec iov;
if (!pending->sequencer()->GetReadableRegion(&iov)) {
// The first byte hasn't been received yet.
@@ -1417,7 +1420,7 @@
}
void QuicSpdySession::MaybeInitializeHttp3UnidirectionalStreams() {
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
if (!send_control_stream_ && CanOpenNextOutgoingUnidirectionalStream()) {
auto send_control = std::make_unique<QuicSendControlStream>(
GetNextOutgoingUnidirectionalStreamId(), this, settings_);
@@ -1463,7 +1466,7 @@
return;
}
- DCHECK_EQ(perspective(), Perspective::IS_SERVER);
+ QUICHE_DCHECK_EQ(perspective(), Perspective::IS_SERVER);
QUIC_CODE_COUNT(quic_send_goaway_with_connection_close);
@@ -1505,10 +1508,10 @@
}
void QuicSpdySession::SetMaxPushId(PushId max_push_id) {
- DCHECK(VersionUsesHttp3(transport_version()));
- DCHECK_EQ(Perspective::IS_CLIENT, perspective());
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK_EQ(Perspective::IS_CLIENT, perspective());
if (max_push_id_.has_value()) {
- DCHECK_GE(max_push_id, max_push_id_.value());
+ QUICHE_DCHECK_GE(max_push_id, max_push_id_.value());
}
if (!max_push_id_.has_value() && max_push_id == 0) {
@@ -1537,8 +1540,8 @@
}
bool QuicSpdySession::OnMaxPushIdFrame(PushId max_push_id) {
- DCHECK(VersionUsesHttp3(transport_version()));
- DCHECK_EQ(Perspective::IS_SERVER, perspective());
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK_EQ(Perspective::IS_SERVER, perspective());
if (max_push_id_.has_value()) {
QUIC_DVLOG(1) << "Setting max_push_id to: " << max_push_id
@@ -1569,16 +1572,16 @@
}
void QuicSpdySession::SendMaxPushId() {
- DCHECK(VersionUsesHttp3(transport_version()));
- DCHECK_EQ(Perspective::IS_CLIENT, perspective());
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK_EQ(Perspective::IS_CLIENT, perspective());
send_control_stream_->SendMaxPushIdFrame(max_push_id_.value());
http3_max_push_id_sent_ = true;
}
void QuicSpdySession::EnableServerPush() {
- DCHECK(VersionUsesHttp3(transport_version()));
- DCHECK_EQ(perspective(), Perspective::IS_SERVER);
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK_EQ(perspective(), Perspective::IS_SERVER);
ietf_server_push_enabled_ = true;
}
@@ -1596,7 +1599,7 @@
}
bool QuicSpdySession::CanCreatePushStreamWithId(PushId push_id) {
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
return ietf_server_push_enabled_ && max_push_id_.has_value() &&
max_push_id_.value() >= push_id;
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc
index 89d06d4..db263b0 100644
--- a/quic/core/http/quic_spdy_session_test.cc
+++ b/quic/core/http/quic_spdy_session_test.cc
@@ -346,7 +346,7 @@
}
QuicConsumedData SendLargeFakeData(QuicStream* stream, int bytes) {
- DCHECK(writev_consumes_all_data_);
+ QUICHE_DCHECK(writev_consumes_all_data_);
return WritevData(stream->id(), bytes, 0, FIN, NOT_RETRANSMISSION,
GetEncryptionLevelToSendApplicationData());
}
diff --git a/quic/core/http/quic_spdy_stream.cc b/quic/core/http/quic_spdy_stream.cc
index 4e84d9b..aa5f7bf 100644
--- a/quic/core/http/quic_spdy_stream.cc
+++ b/quic/core/http/quic_spdy_stream.cc
@@ -76,7 +76,7 @@
}
bool OnDataFramePayload(absl::string_view payload) override {
- DCHECK(!payload.empty());
+ QUICHE_DCHECK(!payload.empty());
return stream_->OnDataFramePayload(payload);
}
@@ -92,7 +92,7 @@
}
bool OnHeadersFramePayload(absl::string_view payload) override {
- DCHECK(!payload.empty());
+ QUICHE_DCHECK(!payload.empty());
if (!VersionUsesHttp3(stream_->transport_version())) {
CloseConnectionOnWrongFrame("Headers");
return false;
@@ -128,7 +128,7 @@
}
bool OnPushPromiseFramePayload(absl::string_view payload) override {
- DCHECK(!payload.empty());
+ QUICHE_DCHECK(!payload.empty());
if (!VersionUsesHttp3(stream_->transport_version())) {
CloseConnectionOnWrongFrame("Push Promise");
return false;
@@ -211,10 +211,10 @@
is_decoder_processing_input_(false),
ack_listener_(nullptr),
last_sent_urgency_(kDefaultUrgency) {
- DCHECK_EQ(session()->connection(), spdy_session->connection());
- DCHECK_EQ(transport_version(), spdy_session->transport_version());
- DCHECK(!QuicUtils::IsCryptoStreamId(transport_version(), id));
- DCHECK_EQ(0u, sequencer()->NumBytesConsumed());
+ QUICHE_DCHECK_EQ(session()->connection(), spdy_session->connection());
+ QUICHE_DCHECK_EQ(transport_version(), spdy_session->transport_version());
+ QUICHE_DCHECK(!QuicUtils::IsCryptoStreamId(transport_version(), id));
+ QUICHE_DCHECK_EQ(0u, sequencer()->NumBytesConsumed());
// If headers are sent on the headers stream, then do not receive any
// callbacks from the sequencer until headers are complete.
if (!VersionUsesHttp3(transport_version())) {
@@ -247,9 +247,9 @@
is_decoder_processing_input_(false),
ack_listener_(nullptr),
last_sent_urgency_(kDefaultUrgency) {
- DCHECK_EQ(session()->connection(), spdy_session->connection());
- DCHECK_EQ(transport_version(), spdy_session->transport_version());
- DCHECK(!QuicUtils::IsCryptoStreamId(transport_version(), id()));
+ QUICHE_DCHECK_EQ(session()->connection(), spdy_session->connection());
+ QUICHE_DCHECK_EQ(transport_version(), spdy_session->transport_version());
+ QUICHE_DCHECK(!QuicUtils::IsCryptoStreamId(transport_version(), id()));
// If headers are sent on the headers stream, then do not receive any
// callbacks from the sequencer until headers are complete.
if (!VersionUsesHttp3(transport_version())) {
@@ -373,7 +373,7 @@
}
void QuicSpdyStream::WritePushPromise(const PushPromiseFrame& frame) {
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
std::unique_ptr<char[]> push_promise_frame_with_id;
const size_t push_promise_frame_length =
HttpEncoder::SerializePushPromiseFrameWithOnlyPushId(
@@ -453,7 +453,7 @@
}
size_t QuicSpdyStream::Readv(const struct iovec* iov, size_t iov_len) {
- DCHECK(FinishedReadingHeaders());
+ QUICHE_DCHECK(FinishedReadingHeaders());
if (!VersionUsesHttp3(transport_version())) {
return sequencer()->Readv(iov, iov_len);
}
@@ -464,7 +464,7 @@
}
int QuicSpdyStream::GetReadableRegions(iovec* iov, size_t iov_len) const {
- DCHECK(FinishedReadingHeaders());
+ QUICHE_DCHECK(FinishedReadingHeaders());
if (!VersionUsesHttp3(transport_version())) {
return sequencer()->GetReadableRegions(iov, iov_len);
}
@@ -472,7 +472,7 @@
}
void QuicSpdyStream::MarkConsumed(size_t num_bytes) {
- DCHECK(FinishedReadingHeaders());
+ QUICHE_DCHECK(FinishedReadingHeaders());
if (!VersionUsesHttp3(transport_version())) {
sequencer()->MarkConsumed(num_bytes);
return;
@@ -532,7 +532,8 @@
void QuicSpdyStream::OnStreamHeadersPriority(
const spdy::SpdyStreamPrecedence& precedence) {
- DCHECK_EQ(Perspective::IS_SERVER, session()->connection()->perspective());
+ QUICHE_DCHECK_EQ(Perspective::IS_SERVER,
+ session()->connection()->perspective());
SetPriority(precedence);
}
@@ -679,7 +680,7 @@
size_t /*frame_len*/,
const QuicHeaderList& header_list) {
// TODO(b/134706391): remove |fin| argument.
- DCHECK(!trailers_decompressed_);
+ QUICHE_DCHECK(!trailers_decompressed_);
if (!VersionUsesHttp3(transport_version()) && fin_received()) {
QUIC_DLOG(INFO) << ENDPOINT
<< "Received Trailers after FIN, on stream: " << id();
@@ -718,7 +719,8 @@
void QuicSpdyStream::OnPriorityFrame(
const spdy::SpdyStreamPrecedence& precedence) {
- DCHECK_EQ(Perspective::IS_SERVER, session()->connection()->perspective());
+ QUICHE_DCHECK_EQ(Perspective::IS_SERVER,
+ session()->connection()->perspective());
SetPriority(precedence);
}
@@ -761,7 +763,7 @@
void QuicSpdyStream::OnDataAvailable() {
if (!VersionUsesHttp3(transport_version())) {
// Sequencer must be blocked until headers are consumed.
- DCHECK(FinishedReadingHeaders());
+ QUICHE_DCHECK(FinishedReadingHeaders());
}
if (!VersionUsesHttp3(transport_version())) {
@@ -781,12 +783,12 @@
iovec iov;
while (session()->connection()->connected() && !reading_stopped() &&
decoder_.error() == QUIC_NO_ERROR) {
- DCHECK_GE(sequencer_offset_, sequencer()->NumBytesConsumed());
+ QUICHE_DCHECK_GE(sequencer_offset_, sequencer()->NumBytesConsumed());
if (!sequencer()->PeekRegion(sequencer_offset_, &iov)) {
break;
}
- DCHECK(!sequencer()->IsClosed());
+ QUICHE_DCHECK(!sequencer()->IsClosed());
is_decoder_processing_input_ = true;
QuicByteCount processed_bytes = decoder_.ProcessInput(
reinterpret_cast<const char*>(iov.iov_base), iov.iov_len);
@@ -877,7 +879,7 @@
bool QuicSpdyStream::OnDataFrameStart(QuicByteCount header_length,
QuicByteCount payload_length) {
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
if (spdy_session_->debug_visitor()) {
spdy_session_->debug_visitor()->OnDataFrameReceived(id(), payload_length);
@@ -896,7 +898,7 @@
}
bool QuicSpdyStream::OnDataFramePayload(absl::string_view payload) {
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
body_manager_.OnBody(payload);
@@ -904,7 +906,7 @@
}
bool QuicSpdyStream::OnDataFrameEnd() {
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
QUIC_DVLOG(1) << ENDPOINT
<< "Reaches the end of a data frame. Total bytes received are "
@@ -924,7 +926,7 @@
const QuicByteCount newly_acked_header_length =
GetNumFrameHeadersInInterval(offset, data_length);
- DCHECK_LE(newly_acked_header_length, *newly_acked_length);
+ QUICHE_DCHECK_LE(newly_acked_header_length, *newly_acked_length);
unacked_frame_headers_offsets_.Difference(offset, offset + data_length);
if (ack_listener_ != nullptr && new_data_acked) {
ack_listener_->OnPacketAcked(
@@ -941,7 +943,7 @@
const QuicByteCount retransmitted_header_length =
GetNumFrameHeadersInInterval(offset, data_length);
- DCHECK_LE(retransmitted_header_length, data_length);
+ QUICHE_DCHECK_LE(retransmitted_header_length, data_length);
if (ack_listener_ != nullptr) {
ack_listener_->OnPacketRetransmitted(data_length -
@@ -963,8 +965,8 @@
bool QuicSpdyStream::OnHeadersFrameStart(QuicByteCount header_length,
QuicByteCount payload_length) {
- DCHECK(VersionUsesHttp3(transport_version()));
- DCHECK(!qpack_decoded_headers_accumulator_);
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(!qpack_decoded_headers_accumulator_);
if (spdy_session_->debug_visitor()) {
spdy_session_->debug_visitor()->OnHeadersFrameReceived(id(),
@@ -991,8 +993,8 @@
}
bool QuicSpdyStream::OnHeadersFramePayload(absl::string_view payload) {
- DCHECK(VersionUsesHttp3(transport_version()));
- DCHECK(qpack_decoded_headers_accumulator_);
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(qpack_decoded_headers_accumulator_);
qpack_decoded_headers_accumulator_->Decode(payload);
@@ -1006,8 +1008,8 @@
}
bool QuicSpdyStream::OnHeadersFrameEnd() {
- DCHECK(VersionUsesHttp3(transport_version()));
- DCHECK(qpack_decoded_headers_accumulator_);
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(qpack_decoded_headers_accumulator_);
qpack_decoded_headers_accumulator_->EndHeaderBlock();
@@ -1022,8 +1024,8 @@
}
bool QuicSpdyStream::OnPushPromiseFrameStart(QuicByteCount header_length) {
- DCHECK(VersionUsesHttp3(transport_version()));
- DCHECK(!qpack_decoded_headers_accumulator_);
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(!qpack_decoded_headers_accumulator_);
sequencer()->MarkConsumed(body_manager_.OnNonBody(header_length));
@@ -1034,8 +1036,8 @@
PushId push_id,
QuicByteCount push_id_length,
QuicByteCount header_block_length) {
- DCHECK(VersionUsesHttp3(transport_version()));
- DCHECK(!qpack_decoded_headers_accumulator_);
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(!qpack_decoded_headers_accumulator_);
if (spdy_session_->debug_visitor()) {
spdy_session_->debug_visitor()->OnPushPromiseFrameReceived(
@@ -1060,7 +1062,7 @@
}
bool QuicSpdyStream::OnPushPromiseFrameEnd() {
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
return OnHeadersFrameEnd();
}
diff --git a/quic/core/http/quic_spdy_stream_body_manager.cc b/quic/core/http/quic_spdy_stream_body_manager.cc
index efecca5..1d40e03 100644
--- a/quic/core/http/quic_spdy_stream_body_manager.cc
+++ b/quic/core/http/quic_spdy_stream_body_manager.cc
@@ -15,7 +15,7 @@
: total_body_bytes_received_(0) {}
size_t QuicSpdyStreamBodyManager::OnNonBody(QuicByteCount length) {
- DCHECK_NE(0u, length);
+ QUICHE_DCHECK_NE(0u, length);
if (fragments_.empty()) {
// Non-body bytes can be consumed immediately, because all previously
@@ -29,7 +29,7 @@
}
void QuicSpdyStreamBodyManager::OnBody(absl::string_view body) {
- DCHECK(!body.empty());
+ QUICHE_DCHECK(!body.empty());
fragments_.push_back({body, 0});
total_body_bytes_received_ += body.length();
@@ -66,8 +66,8 @@
}
int QuicSpdyStreamBodyManager::PeekBody(iovec* iov, size_t iov_len) const {
- DCHECK(iov);
- DCHECK_GT(iov_len, 0u);
+ QUICHE_DCHECK(iov);
+ QUICHE_DCHECK_GT(iov_len, 0u);
// TODO(bnc): Is this really necessary?
if (fragments_.empty()) {
diff --git a/quic/core/http/quic_spdy_stream_body_manager_test.cc b/quic/core/http/quic_spdy_stream_body_manager_test.cc
index 096982f..90e50d4 100644
--- a/quic/core/http/quic_spdy_stream_body_manager_test.cc
+++ b/quic/core/http/quic_spdy_stream_body_manager_test.cc
@@ -260,7 +260,7 @@
std::vector<iovec> iovecs;
size_t offset = 0;
for (size_t iov_length : iov_lengths[call_index]) {
- CHECK(offset + iov_length <= buffer.size());
+ QUICHE_CHECK(offset + iov_length <= buffer.size());
iovecs.push_back({&buffer[offset], iov_length});
offset += iov_length;
}
diff --git a/quic/core/http/quic_spdy_stream_test.cc b/quic/core/http/quic_spdy_stream_test.cc
index d7aa6e7..14f3eab 100644
--- a/quic/core/http/quic_spdy_stream_test.cc
+++ b/quic/core/http/quic_spdy_stream_test.cc
@@ -479,7 +479,7 @@
// Even though integers can be encoded with different lengths,
// QuicDataWriter is expected to produce an encoding in Write*() of length
// promised in GetVarInt62Len().
- DCHECK_EQ(length, writer.length());
+ QUICHE_DCHECK_EQ(length, writer.length());
return frame;
}
diff --git a/quic/core/legacy_quic_stream_id_manager.cc b/quic/core/legacy_quic_stream_id_manager.cc
index c9a0f9b..36974af 100644
--- a/quic/core/legacy_quic_stream_id_manager.cc
+++ b/quic/core/legacy_quic_stream_id_manager.cc
@@ -36,7 +36,7 @@
LegacyQuicStreamIdManager::~LegacyQuicStreamIdManager() {}
bool LegacyQuicStreamIdManager::CanOpenNextOutgoingStream() const {
- DCHECK_LE(num_open_outgoing_streams_, max_open_outgoing_streams_);
+ QUICHE_DCHECK_LE(num_open_outgoing_streams_, max_open_outgoing_streams_);
QUIC_DLOG_IF(INFO, num_open_outgoing_streams_ == max_open_outgoing_streams_)
<< "Failed to create a new outgoing stream. "
<< "Already " << num_open_outgoing_streams_ << " open.";
diff --git a/quic/core/qpack/fuzzer/qpack_decoder_fuzzer.cc b/quic/core/qpack/fuzzer/qpack_decoder_fuzzer.cc
index 23e0523..9c51f61 100644
--- a/quic/core/qpack/fuzzer/qpack_decoder_fuzzer.cc
+++ b/quic/core/qpack/fuzzer/qpack_decoder_fuzzer.cc
@@ -58,7 +58,7 @@
void OnDecodingCompleted() override {
// Will delete |this|.
size_t result = processing_decoders_->erase(stream_id_);
- CHECK_EQ(1u, result);
+ QUICHE_CHECK_EQ(1u, result);
}
void OnDecodingErrorDetected(absl::string_view /*error_message*/) override {
diff --git a/quic/core/qpack/fuzzer/qpack_round_trip_fuzzer.cc b/quic/core/qpack/fuzzer/qpack_round_trip_fuzzer.cc
index ab11210..4e4ebc4 100644
--- a/quic/core/qpack/fuzzer/qpack_round_trip_fuzzer.cc
+++ b/quic/core/qpack/fuzzer/qpack_round_trip_fuzzer.cc
@@ -37,8 +37,8 @@
~EncodingEndpoint() {
// Every reference should be acknowledged.
- CHECK_EQ(std::numeric_limits<uint64_t>::max(),
- QpackEncoderPeer::smallest_blocking_index(&encoder_));
+ QUICHE_CHECK_EQ(std::numeric_limits<uint64_t>::max(),
+ QpackEncoderPeer::smallest_blocking_index(&encoder_));
}
void set_qpack_stream_sender_delegate(QpackStreamSenderDelegate* delegate) {
@@ -67,7 +67,8 @@
void OnDecoderStreamError(QuicErrorCode error_code,
absl::string_view error_message) override {
- CHECK(false) << QuicErrorCodeToString(error_code) << " " << error_message;
+ QUICHE_CHECK(false) << QuicErrorCodeToString(error_code) << " "
+ << error_message;
}
};
@@ -102,7 +103,7 @@
QuicFuzzedDataProvider* provider)
: visitor_(visitor), provider_(provider) {}
- ~DelayedHeaderBlockTransmitter() { CHECK(header_blocks_.empty()); }
+ ~DelayedHeaderBlockTransmitter() { QUICHE_CHECK(header_blocks_.empty()); }
// Enqueues |encoded_header_block| for delayed transmission.
void SendEncodedHeaderBlock(QuicStreamId stream_id,
@@ -111,7 +112,7 @@
if (it == header_blocks_.end() || it->first != stream_id) {
it = header_blocks_.insert(it, {stream_id, {}});
}
- CHECK_EQ(stream_id, it->first);
+ QUICHE_CHECK_EQ(stream_id, it->first);
it->second.push(HeaderBlock(std::move(encoded_header_block)));
}
@@ -140,13 +141,13 @@
visitor_->OnHeaderBlockStart(stream_id);
}
- DCHECK_NE(0u, header_block.RemainingLength());
+ QUICHE_DCHECK_NE(0u, header_block.RemainingLength());
size_t length = provider_->ConsumeIntegralInRange<size_t>(
1, header_block.RemainingLength());
visitor_->OnHeaderBlockFragment(stream_id, header_block.Consume(length));
- DCHECK_NE(0u, header_block.ConsumedLength());
+ QUICHE_DCHECK_NE(0u, header_block.ConsumedLength());
if (header_block.RemainingLength() == 0) {
visitor_->OnHeaderBlockEnd(stream_id);
@@ -170,20 +171,20 @@
HeaderBlock& header_block = header_block_queue.front();
if (header_block.ConsumedLength() == 0) {
- CHECK(!visitor_->IsDecodingInProgressOnStream(stream_id));
+ QUICHE_CHECK(!visitor_->IsDecodingInProgressOnStream(stream_id));
visitor_->OnHeaderBlockStart(stream_id);
}
- DCHECK_NE(0u, header_block.RemainingLength());
+ QUICHE_DCHECK_NE(0u, header_block.RemainingLength());
visitor_->OnHeaderBlockFragment(stream_id,
header_block.ConsumeRemaining());
- DCHECK_NE(0u, header_block.ConsumedLength());
- DCHECK_EQ(0u, header_block.RemainingLength());
+ QUICHE_DCHECK_NE(0u, header_block.ConsumedLength());
+ QUICHE_DCHECK_EQ(0u, header_block.RemainingLength());
visitor_->OnHeaderBlockEnd(stream_id);
- CHECK(!visitor_->IsDecodingInProgressOnStream(stream_id));
+ QUICHE_CHECK(!visitor_->IsDecodingInProgressOnStream(stream_id));
header_block_queue.pop();
if (header_block_queue.empty()) {
@@ -199,7 +200,7 @@
explicit HeaderBlock(std::string data)
: data_(std::move(data)), offset_(0) {
// Valid QPACK header block cannot be empty.
- DCHECK(!data_.empty());
+ QUICHE_DCHECK(!data_.empty());
}
size_t ConsumedLength() const { return offset_; }
@@ -207,8 +208,8 @@
size_t RemainingLength() const { return data_.length() - offset_; }
absl::string_view Consume(size_t length) {
- DCHECK_NE(0u, length);
- DCHECK_LE(length, RemainingLength());
+ QUICHE_DCHECK_NE(0u, length);
+ QUICHE_DCHECK_LE(length, RemainingLength());
absl::string_view consumed = absl::string_view(&data_[offset_], length);
offset_ += length;
@@ -270,15 +271,15 @@
void OnHeadersDecoded(QuicHeaderList headers,
bool header_list_size_limit_exceeded) override {
// Verify headers.
- CHECK(!header_list_size_limit_exceeded);
- CHECK(expected_header_list_ == headers);
+ QUICHE_CHECK(!header_list_size_limit_exceeded);
+ QUICHE_CHECK(expected_header_list_ == headers);
// Might destroy |this|.
visitor_->OnHeaderBlockDecoded(stream_id_);
}
void OnHeaderDecodingError(absl::string_view error_message) override {
- CHECK(false) << error_message;
+ QUICHE_CHECK(false) << error_message;
}
void Decode(absl::string_view data) { accumulator_.Decode(data); }
@@ -306,8 +307,8 @@
~DecodingEndpoint() override {
// All decoding must have been completed.
- CHECK(expected_header_lists_.empty());
- CHECK(verifying_decoders_.empty());
+ QUICHE_CHECK(expected_header_lists_.empty());
+ QUICHE_CHECK(verifying_decoders_.empty());
}
void set_qpack_stream_sender_delegate(QpackStreamSenderDelegate* delegate) {
@@ -324,14 +325,14 @@
if (it == expected_header_lists_.end() || it->first != stream_id) {
it = expected_header_lists_.insert(it, {stream_id, {}});
}
- CHECK_EQ(stream_id, it->first);
+ QUICHE_CHECK_EQ(stream_id, it->first);
it->second.push(std::move(expected_header_list));
}
// VerifyingDecoder::Visitor implementation.
void OnHeaderBlockDecoded(QuicStreamId stream_id) override {
auto result = verifying_decoders_.erase(stream_id);
- CHECK_EQ(1u, result);
+ QUICHE_CHECK_EQ(1u, result);
}
// DelayedHeaderBlockTransmitter::Visitor implementation.
@@ -340,9 +341,9 @@
}
void OnHeaderBlockStart(QuicStreamId stream_id) override {
- CHECK(!IsDecodingInProgressOnStream(stream_id));
+ QUICHE_CHECK(!IsDecodingInProgressOnStream(stream_id));
auto it = expected_header_lists_.find(stream_id);
- CHECK(it != expected_header_lists_.end());
+ QUICHE_CHECK(it != expected_header_lists_.end());
auto& header_list_queue = it->second;
QuicHeaderList expected_header_list = std::move(header_list_queue.front());
@@ -356,19 +357,19 @@
stream_id, this, &decoder_, std::move(expected_header_list));
auto result =
verifying_decoders_.insert({stream_id, std::move(verifying_decoder)});
- CHECK(result.second);
+ QUICHE_CHECK(result.second);
}
void OnHeaderBlockFragment(QuicStreamId stream_id,
absl::string_view data) override {
auto it = verifying_decoders_.find(stream_id);
- CHECK(it != verifying_decoders_.end());
+ QUICHE_CHECK(it != verifying_decoders_.end());
it->second->Decode(data);
}
void OnHeaderBlockEnd(QuicStreamId stream_id) override {
auto it = verifying_decoders_.find(stream_id);
- CHECK(it != verifying_decoders_.end());
+ QUICHE_CHECK(it != verifying_decoders_.end());
it->second->EndHeaderBlock();
}
@@ -381,7 +382,8 @@
void OnEncoderStreamError(QuicErrorCode error_code,
absl::string_view error_message) override {
- CHECK(false) << QuicErrorCodeToString(error_code) << " " << error_message;
+ QUICHE_CHECK(false) << QuicErrorCodeToString(error_code) << " "
+ << error_message;
}
};
@@ -407,7 +409,7 @@
QuicFuzzedDataProvider* provider)
: receiver_(receiver), provider_(provider) {}
- ~DelayedStreamDataTransmitter() { CHECK(stream_data.empty()); }
+ ~DelayedStreamDataTransmitter() { QUICHE_CHECK(stream_data.empty()); }
// QpackStreamSenderDelegate implementation.
void WriteStreamData(absl::string_view data) override {
diff --git a/quic/core/qpack/qpack_blocking_manager.cc b/quic/core/qpack/qpack_blocking_manager.cc
index 21f604e..3b03710 100644
--- a/quic/core/qpack/qpack_blocking_manager.cc
+++ b/quic/core/qpack/qpack_blocking_manager.cc
@@ -17,10 +17,10 @@
return false;
}
- DCHECK(!it->second.empty());
+ QUICHE_DCHECK(!it->second.empty());
const IndexSet& indices = it->second.front();
- DCHECK(!indices.empty());
+ QUICHE_DCHECK(!indices.empty());
const uint64_t required_index_count = RequiredInsertCount(indices);
if (known_received_count_ < required_index_count) {
@@ -62,7 +62,7 @@
void QpackBlockingManager::OnHeaderBlockSent(QuicStreamId stream_id,
IndexSet indices) {
- DCHECK(!indices.empty());
+ QUICHE_DCHECK(!indices.empty());
IncreaseReferenceCounts(indices);
header_blocks_[stream_id].push_back(std::move(indices));
@@ -145,8 +145,8 @@
void QpackBlockingManager::DecreaseReferenceCounts(const IndexSet& indices) {
for (const uint64_t index : indices) {
auto it = entry_reference_counts_.find(index);
- DCHECK(it != entry_reference_counts_.end());
- DCHECK_NE(0u, it->second);
+ QUICHE_DCHECK(it != entry_reference_counts_.end());
+ QUICHE_DCHECK_NE(0u, it->second);
if (it->second == 1) {
entry_reference_counts_.erase(it);
diff --git a/quic/core/qpack/qpack_decoded_headers_accumulator.cc b/quic/core/qpack/qpack_decoded_headers_accumulator.cc
index 60be426..f5ddeee 100644
--- a/quic/core/qpack/qpack_decoded_headers_accumulator.cc
+++ b/quic/core/qpack/qpack_decoded_headers_accumulator.cc
@@ -29,7 +29,7 @@
void QpackDecodedHeadersAccumulator::OnHeaderDecoded(absl::string_view name,
absl::string_view value) {
- DCHECK(!error_detected_);
+ QUICHE_DCHECK(!error_detected_);
uncompressed_header_bytes_without_overhead_ += name.size() + value.size();
@@ -49,8 +49,8 @@
}
void QpackDecodedHeadersAccumulator::OnDecodingCompleted() {
- DCHECK(!headers_decoded_);
- DCHECK(!error_detected_);
+ QUICHE_DCHECK(!headers_decoded_);
+ QUICHE_DCHECK(!error_detected_);
headers_decoded_ = true;
@@ -64,8 +64,8 @@
void QpackDecodedHeadersAccumulator::OnDecodingErrorDetected(
absl::string_view error_message) {
- DCHECK(!error_detected_);
- DCHECK(!headers_decoded_);
+ QUICHE_DCHECK(!error_detected_);
+ QUICHE_DCHECK(!headers_decoded_);
error_detected_ = true;
// Might destroy |this|.
@@ -73,7 +73,7 @@
}
void QpackDecodedHeadersAccumulator::Decode(absl::string_view data) {
- DCHECK(!error_detected_);
+ QUICHE_DCHECK(!error_detected_);
compressed_header_bytes_ += data.size();
// Might destroy |this|.
@@ -81,8 +81,8 @@
}
void QpackDecodedHeadersAccumulator::EndHeaderBlock() {
- DCHECK(!error_detected_);
- DCHECK(!headers_decoded_);
+ QUICHE_DCHECK(!error_detected_);
+ QUICHE_DCHECK(!headers_decoded_);
// Might destroy |this|.
decoder_->EndHeaderBlock();
diff --git a/quic/core/qpack/qpack_decoder.cc b/quic/core/qpack/qpack_decoder.cc
index 35c64a0..c1ac28c 100644
--- a/quic/core/qpack/qpack_decoder.cc
+++ b/quic/core/qpack/qpack_decoder.cc
@@ -22,7 +22,7 @@
encoder_stream_receiver_(this),
maximum_blocked_streams_(maximum_blocked_streams),
known_received_count_(0) {
- DCHECK(encoder_stream_error_delegate_);
+ QUICHE_DCHECK(encoder_stream_error_delegate_);
header_table_.SetMaximumDynamicTableCapacity(maximum_dynamic_table_capacity);
}
@@ -38,13 +38,13 @@
bool QpackDecoder::OnStreamBlocked(QuicStreamId stream_id) {
auto result = blocked_streams_.insert(stream_id);
- DCHECK(result.second);
+ QUICHE_DCHECK(result.second);
return blocked_streams_.size() <= maximum_blocked_streams_;
}
void QpackDecoder::OnStreamUnblocked(QuicStreamId stream_id) {
size_t result = blocked_streams_.erase(stream_id);
- DCHECK_EQ(1u, result);
+ QUICHE_DCHECK_EQ(1u, result);
}
void QpackDecoder::OnDecodingCompleted(QuicStreamId stream_id,
diff --git a/quic/core/qpack/qpack_decoder_stream_receiver.cc b/quic/core/qpack/qpack_decoder_stream_receiver.cc
index b43d6a0..aed660e 100644
--- a/quic/core/qpack/qpack_decoder_stream_receiver.cc
+++ b/quic/core/qpack/qpack_decoder_stream_receiver.cc
@@ -15,7 +15,7 @@
: instruction_decoder_(QpackDecoderStreamLanguage(), this),
delegate_(delegate),
error_detected_(false) {
- DCHECK(delegate_);
+ QUICHE_DCHECK(delegate_);
}
void QpackDecoderStreamReceiver::Decode(absl::string_view data) {
@@ -38,7 +38,7 @@
return true;
}
- DCHECK_EQ(instruction, StreamCancellationInstruction());
+ QUICHE_DCHECK_EQ(instruction, StreamCancellationInstruction());
delegate_->OnStreamCancellation(instruction_decoder_.varint());
return true;
}
@@ -46,7 +46,7 @@
void QpackDecoderStreamReceiver::OnInstructionDecodingError(
QpackInstructionDecoder::ErrorCode error_code,
absl::string_view error_message) {
- DCHECK(!error_detected_);
+ QUICHE_DCHECK(!error_detected_);
error_detected_ = true;
diff --git a/quic/core/qpack/qpack_encoder.cc b/quic/core/qpack/qpack_encoder.cc
index 6ad432b..8138266 100644
--- a/quic/core/qpack/qpack_encoder.cc
+++ b/quic/core/qpack/qpack_encoder.cc
@@ -38,7 +38,7 @@
decoder_stream_receiver_(this),
maximum_blocked_streams_(0),
header_list_count_(0) {
- DCHECK(decoder_stream_error_delegate_);
+ QUICHE_DCHECK(decoder_stream_error_delegate_);
}
QpackEncoder::~QpackEncoder() {}
@@ -275,8 +275,8 @@
const QuicByteCount encoder_stream_buffered_byte_count =
encoder_stream_sender_.BufferedByteCount();
- DCHECK_GE(encoder_stream_buffered_byte_count,
- initial_encoder_stream_buffered_byte_count);
+ QUICHE_DCHECK_GE(encoder_stream_buffered_byte_count,
+ initial_encoder_stream_buffered_byte_count);
if (encoder_stream_sent_byte_count) {
*encoder_stream_sent_byte_count =
encoder_stream_buffered_byte_count -
@@ -392,7 +392,7 @@
// instructions are written.
bool success = header_table_.SetDynamicTableCapacity(dynamic_table_capacity);
- DCHECK(success);
+ QUICHE_DCHECK(success);
}
bool QpackEncoder::SetMaximumBlockedStreams(uint64_t maximum_blocked_streams) {
diff --git a/quic/core/qpack/qpack_encoder_stream_receiver.cc b/quic/core/qpack/qpack_encoder_stream_receiver.cc
index 3e6c21c..bf71faf 100644
--- a/quic/core/qpack/qpack_encoder_stream_receiver.cc
+++ b/quic/core/qpack/qpack_encoder_stream_receiver.cc
@@ -8,6 +8,7 @@
#include "http2/decoder/decode_buffer.h"
#include "http2/decoder/decode_status.h"
#include "quic/core/qpack/qpack_instructions.h"
+#include "quic/platform/api/quic_logging.h"
namespace quic {
@@ -15,7 +16,7 @@
: instruction_decoder_(QpackEncoderStreamLanguage(), this),
delegate_(delegate),
error_detected_(false) {
- DCHECK(delegate_);
+ QUICHE_DCHECK(delegate_);
}
void QpackEncoderStreamReceiver::Decode(absl::string_view data) {
@@ -46,7 +47,7 @@
return true;
}
- DCHECK_EQ(instruction, SetDynamicTableCapacityInstruction());
+ QUICHE_DCHECK_EQ(instruction, SetDynamicTableCapacityInstruction());
delegate_->OnSetDynamicTableCapacity(instruction_decoder_.varint());
return true;
}
@@ -54,7 +55,7 @@
void QpackEncoderStreamReceiver::OnInstructionDecodingError(
QpackInstructionDecoder::ErrorCode error_code,
absl::string_view error_message) {
- DCHECK(!error_detected_);
+ QUICHE_DCHECK(!error_detected_);
error_detected_ = true;
diff --git a/quic/core/qpack/qpack_header_table.cc b/quic/core/qpack/qpack_header_table.cc
index 24edc98..6171d84 100644
--- a/quic/core/qpack/qpack_header_table.cc
+++ b/quic/core/qpack/qpack_header_table.cc
@@ -60,7 +60,7 @@
// Look for exact match in static table.
auto index_it = static_index_.find(&query);
if (index_it != static_index_.end()) {
- DCHECK((*index_it)->IsStatic());
+ QUICHE_DCHECK((*index_it)->IsStatic());
*index = (*index_it)->InsertionIndex();
*is_static = true;
return MatchType::kNameAndValue;
@@ -69,7 +69,7 @@
// Look for exact match in dynamic table.
index_it = dynamic_index_.find(&query);
if (index_it != dynamic_index_.end()) {
- DCHECK(!(*index_it)->IsStatic());
+ QUICHE_DCHECK(!(*index_it)->IsStatic());
*index = (*index_it)->InsertionIndex();
*is_static = false;
return MatchType::kNameAndValue;
@@ -78,7 +78,7 @@
// Look for name match in static table.
auto name_index_it = static_name_index_.find(name);
if (name_index_it != static_name_index_.end()) {
- DCHECK(name_index_it->second->IsStatic());
+ QUICHE_DCHECK(name_index_it->second->IsStatic());
*index = name_index_it->second->InsertionIndex();
*is_static = true;
return MatchType::kName;
@@ -87,7 +87,7 @@
// Look for name match in dynamic table.
name_index_it = dynamic_name_index_.find(name);
if (name_index_it != dynamic_name_index_.end()) {
- DCHECK(!name_index_it->second->IsStatic());
+ QUICHE_DCHECK(!name_index_it->second->IsStatic());
*index = name_index_it->second->InsertionIndex();
*is_static = false;
return MatchType::kName;
@@ -117,11 +117,11 @@
// An entry with the same name and value already exists. It needs to be
// replaced, because |dynamic_index_| tracks the most recent entry for a
// given name and value.
- DCHECK_GT(new_entry->InsertionIndex(),
- (*index_result.first)->InsertionIndex());
+ QUICHE_DCHECK_GT(new_entry->InsertionIndex(),
+ (*index_result.first)->InsertionIndex());
dynamic_index_.erase(index_result.first);
auto result = dynamic_index_.insert(new_entry);
- CHECK(result.second);
+ QUICHE_CHECK(result.second);
}
auto name_result = dynamic_name_index_.insert({new_entry->name(), new_entry});
@@ -129,11 +129,11 @@
// An entry with the same name already exists. It needs to be replaced,
// because |dynamic_name_index_| tracks the most recent entry for a given
// name.
- DCHECK_GT(new_entry->InsertionIndex(),
- name_result.first->second->InsertionIndex());
+ QUICHE_DCHECK_GT(new_entry->InsertionIndex(),
+ name_result.first->second->InsertionIndex());
dynamic_name_index_.erase(name_result.first);
auto result = dynamic_name_index_.insert({new_entry->name(), new_entry});
- CHECK(result.second);
+ QUICHE_CHECK(result.second);
}
// Notify and deregister observers whose threshold is met, if any.
@@ -152,7 +152,7 @@
uint64_t QpackHeaderTable::MaxInsertSizeWithoutEvictingGivenEntry(
uint64_t index) const {
- DCHECK_LE(dropped_entry_count_, index);
+ QUICHE_DCHECK_LE(dropped_entry_count_, index);
if (index > inserted_entry_count()) {
// All entries are allowed to be evicted.
@@ -180,7 +180,7 @@
dynamic_table_capacity_ = capacity;
EvictDownToCurrentCapacity();
- DCHECK_LE(dynamic_table_size_, dynamic_table_capacity_);
+ QUICHE_DCHECK_LE(dynamic_table_size_, dynamic_table_capacity_);
return true;
}
@@ -198,7 +198,7 @@
void QpackHeaderTable::RegisterObserver(uint64_t required_insert_count,
Observer* observer) {
- DCHECK_GT(required_insert_count, 0u);
+ QUICHE_DCHECK_GT(required_insert_count, 0u);
observers_.insert({required_insert_count, observer});
}
@@ -218,8 +218,8 @@
}
uint64_t QpackHeaderTable::draining_index(float draining_fraction) const {
- DCHECK_LE(0.0, draining_fraction);
- DCHECK_LE(draining_fraction, 1.0);
+ QUICHE_DCHECK_LE(0.0, draining_fraction);
+ QUICHE_DCHECK_LE(draining_fraction, 1.0);
const uint64_t required_space = draining_fraction * dynamic_table_capacity_;
uint64_t space_above_draining_index =
@@ -244,12 +244,12 @@
void QpackHeaderTable::EvictDownToCurrentCapacity() {
while (dynamic_table_size_ > dynamic_table_capacity_) {
- DCHECK(!dynamic_entries_.empty());
+ QUICHE_DCHECK(!dynamic_entries_.empty());
QpackEntry* const entry = &dynamic_entries_.front();
const uint64_t entry_size = entry->Size();
- DCHECK_GE(dynamic_table_size_, entry_size);
+ QUICHE_DCHECK_GE(dynamic_table_size_, entry_size);
dynamic_table_size_ -= entry_size;
auto index_it = dynamic_index_.find(entry);
diff --git a/quic/core/qpack/qpack_index_conversions.cc b/quic/core/qpack/qpack_index_conversions.cc
index c38668f..66f2ea3 100644
--- a/quic/core/qpack/qpack_index_conversions.cc
+++ b/quic/core/qpack/qpack_index_conversions.cc
@@ -13,14 +13,14 @@
uint64_t QpackAbsoluteIndexToEncoderStreamRelativeIndex(
uint64_t absolute_index,
uint64_t inserted_entry_count) {
- DCHECK_LT(absolute_index, inserted_entry_count);
+ QUICHE_DCHECK_LT(absolute_index, inserted_entry_count);
return inserted_entry_count - absolute_index - 1;
}
uint64_t QpackAbsoluteIndexToRequestStreamRelativeIndex(uint64_t absolute_index,
uint64_t base) {
- DCHECK_LT(absolute_index, base);
+ QUICHE_DCHECK_LT(absolute_index, base);
return base - absolute_index - 1;
}
diff --git a/quic/core/qpack/qpack_instruction_decoder.cc b/quic/core/qpack/qpack_instruction_decoder.cc
index b836ff7..bf786a4 100644
--- a/quic/core/qpack/qpack_instruction_decoder.cc
+++ b/quic/core/qpack/qpack_instruction_decoder.cc
@@ -34,8 +34,8 @@
state_(State::kStartInstruction) {}
bool QpackInstructionDecoder::Decode(absl::string_view data) {
- DCHECK(!data.empty());
- DCHECK(!error_detected_);
+ QUICHE_DCHECK(!data.empty());
+ QUICHE_DCHECK(!error_detected_);
while (true) {
bool success = true;
@@ -73,9 +73,9 @@
}
// |success| must be false if an error is detected.
- DCHECK(!error_detected_);
+ QUICHE_DCHECK(!error_detected_);
- DCHECK_LE(bytes_consumed, data.size());
+ QUICHE_DCHECK_LE(bytes_consumed, data.size());
data = absl::string_view(data.data() + bytes_consumed,
data.size() - bytes_consumed);
@@ -95,7 +95,7 @@
}
bool QpackInstructionDecoder::DoStartInstruction(absl::string_view data) {
- DCHECK(!data.empty());
+ QUICHE_DCHECK(!data.empty());
instruction_ = LookupOpcode(data[0]);
field_ = instruction_->fields.begin();
@@ -133,7 +133,7 @@
}
bool QpackInstructionDecoder::DoReadBit(absl::string_view data) {
- DCHECK(!data.empty());
+ QUICHE_DCHECK(!data.empty());
switch (field_->type) {
case QpackInstructionFieldType::kSbit: {
@@ -148,7 +148,7 @@
case QpackInstructionFieldType::kName:
case QpackInstructionFieldType::kValue: {
const uint8_t prefix_length = field_->param;
- DCHECK_GE(7, prefix_length);
+ QUICHE_DCHECK_GE(7, prefix_length);
const uint8_t bitmask = 1 << prefix_length;
is_huffman_encoded_ = (data[0] & bitmask) == bitmask;
@@ -164,11 +164,11 @@
bool QpackInstructionDecoder::DoVarintStart(absl::string_view data,
size_t* bytes_consumed) {
- DCHECK(!data.empty());
- DCHECK(field_->type == QpackInstructionFieldType::kVarint ||
- field_->type == QpackInstructionFieldType::kVarint2 ||
- field_->type == QpackInstructionFieldType::kName ||
- field_->type == QpackInstructionFieldType::kValue);
+ QUICHE_DCHECK(!data.empty());
+ QUICHE_DCHECK(field_->type == QpackInstructionFieldType::kVarint ||
+ field_->type == QpackInstructionFieldType::kVarint2 ||
+ field_->type == QpackInstructionFieldType::kName ||
+ field_->type == QpackInstructionFieldType::kValue);
http2::DecodeBuffer buffer(data.data() + 1, data.size() - 1);
http2::DecodeStatus status =
@@ -193,11 +193,11 @@
bool QpackInstructionDecoder::DoVarintResume(absl::string_view data,
size_t* bytes_consumed) {
- DCHECK(!data.empty());
- DCHECK(field_->type == QpackInstructionFieldType::kVarint ||
- field_->type == QpackInstructionFieldType::kVarint2 ||
- field_->type == QpackInstructionFieldType::kName ||
- field_->type == QpackInstructionFieldType::kValue);
+ QUICHE_DCHECK(!data.empty());
+ QUICHE_DCHECK(field_->type == QpackInstructionFieldType::kVarint ||
+ field_->type == QpackInstructionFieldType::kVarint2 ||
+ field_->type == QpackInstructionFieldType::kName ||
+ field_->type == QpackInstructionFieldType::kValue);
http2::DecodeBuffer buffer(data);
http2::DecodeStatus status = varint_decoder_.Resume(&buffer);
@@ -208,8 +208,8 @@
state_ = State::kVarintDone;
return true;
case http2::DecodeStatus::kDecodeInProgress:
- DCHECK_EQ(*bytes_consumed, data.size());
- DCHECK(buffer.Empty());
+ QUICHE_DCHECK_EQ(*bytes_consumed, data.size());
+ QUICHE_DCHECK(buffer.Empty());
return true;
case http2::DecodeStatus::kDecodeError:
OnError(ErrorCode::INTEGER_TOO_LARGE, "Encoded integer too large.");
@@ -221,10 +221,10 @@
}
bool QpackInstructionDecoder::DoVarintDone() {
- DCHECK(field_->type == QpackInstructionFieldType::kVarint ||
- field_->type == QpackInstructionFieldType::kVarint2 ||
- field_->type == QpackInstructionFieldType::kName ||
- field_->type == QpackInstructionFieldType::kValue);
+ QUICHE_DCHECK(field_->type == QpackInstructionFieldType::kVarint ||
+ field_->type == QpackInstructionFieldType::kVarint2 ||
+ field_->type == QpackInstructionFieldType::kName ||
+ field_->type == QpackInstructionFieldType::kValue);
if (field_->type == QpackInstructionFieldType::kVarint) {
varint_ = varint_decoder_.value();
@@ -266,18 +266,18 @@
bool QpackInstructionDecoder::DoReadString(absl::string_view data,
size_t* bytes_consumed) {
- DCHECK(!data.empty());
- DCHECK(field_->type == QpackInstructionFieldType::kName ||
- field_->type == QpackInstructionFieldType::kValue);
+ QUICHE_DCHECK(!data.empty());
+ QUICHE_DCHECK(field_->type == QpackInstructionFieldType::kName ||
+ field_->type == QpackInstructionFieldType::kValue);
std::string* const string =
(field_->type == QpackInstructionFieldType::kName) ? &name_ : &value_;
- DCHECK_LT(string->size(), string_length_);
+ QUICHE_DCHECK_LT(string->size(), string_length_);
*bytes_consumed = std::min(string_length_ - string->size(), data.size());
string->append(data.data(), *bytes_consumed);
- DCHECK_LE(string->size(), string_length_);
+ QUICHE_DCHECK_LE(string->size(), string_length_);
if (string->size() == string_length_) {
state_ = State::kReadStringDone;
}
@@ -285,12 +285,12 @@
}
bool QpackInstructionDecoder::DoReadStringDone() {
- DCHECK(field_->type == QpackInstructionFieldType::kName ||
- field_->type == QpackInstructionFieldType::kValue);
+ QUICHE_DCHECK(field_->type == QpackInstructionFieldType::kName ||
+ field_->type == QpackInstructionFieldType::kValue);
std::string* const string =
(field_->type == QpackInstructionFieldType::kName) ? &name_ : &value_;
- DCHECK_EQ(string->size(), string_length_);
+ QUICHE_DCHECK_EQ(string->size(), string_length_);
if (is_huffman_encoded_) {
huffman_decoder_.Reset();
@@ -319,13 +319,13 @@
}
// |language_| should be defined such that instruction opcodes cover every
// possible input.
- DCHECK(false);
+ QUICHE_DCHECK(false);
return nullptr;
}
void QpackInstructionDecoder::OnError(ErrorCode error_code,
absl::string_view error_message) {
- DCHECK(!error_detected_);
+ QUICHE_DCHECK(!error_detected_);
error_detected_ = true;
delegate_->OnInstructionDecodingError(error_code, error_message);
diff --git a/quic/core/qpack/qpack_instruction_encoder.cc b/quic/core/qpack/qpack_instruction_encoder.cc
index 72d92dd..527c43c 100644
--- a/quic/core/qpack/qpack_instruction_encoder.cc
+++ b/quic/core/qpack/qpack_instruction_encoder.cc
@@ -25,14 +25,14 @@
void QpackInstructionEncoder::Encode(
const QpackInstructionWithValues& instruction_with_values,
std::string* output) {
- DCHECK(instruction_with_values.instruction());
+ QUICHE_DCHECK(instruction_with_values.instruction());
state_ = State::kOpcode;
instruction_ = instruction_with_values.instruction();
field_ = instruction_->fields.begin();
// Field list must not be empty.
- DCHECK(field_ != instruction_->fields.end());
+ QUICHE_DCHECK(field_ != instruction_->fields.end());
do {
switch (state_) {
@@ -60,11 +60,11 @@
}
} while (field_ != instruction_->fields.end());
- DCHECK(state_ == State::kStartField);
+ QUICHE_DCHECK(state_ == State::kStartField);
}
void QpackInstructionEncoder::DoOpcode() {
- DCHECK_EQ(0u, byte_);
+ QUICHE_DCHECK_EQ(0u, byte_);
byte_ = instruction_->opcode.value;
@@ -88,10 +88,10 @@
}
void QpackInstructionEncoder::DoSBit(bool s_bit) {
- DCHECK(field_->type == QpackInstructionFieldType::kSbit);
+ QUICHE_DCHECK(field_->type == QpackInstructionFieldType::kSbit);
if (s_bit) {
- DCHECK_EQ(0, byte_ & field_->param);
+ QUICHE_DCHECK_EQ(0, byte_ & field_->param);
byte_ |= field_->param;
}
@@ -103,10 +103,10 @@
void QpackInstructionEncoder::DoVarintEncode(uint64_t varint,
uint64_t varint2,
std::string* output) {
- DCHECK(field_->type == QpackInstructionFieldType::kVarint ||
- field_->type == QpackInstructionFieldType::kVarint2 ||
- field_->type == QpackInstructionFieldType::kName ||
- field_->type == QpackInstructionFieldType::kValue);
+ QUICHE_DCHECK(field_->type == QpackInstructionFieldType::kVarint ||
+ field_->type == QpackInstructionFieldType::kVarint2 ||
+ field_->type == QpackInstructionFieldType::kName ||
+ field_->type == QpackInstructionFieldType::kValue);
uint64_t integer_to_encode;
switch (field_->type) {
case QpackInstructionFieldType::kVarint:
@@ -136,8 +136,8 @@
void QpackInstructionEncoder::DoStartString(absl::string_view name,
absl::string_view value) {
- DCHECK(field_->type == QpackInstructionFieldType::kName ||
- field_->type == QpackInstructionFieldType::kValue);
+ QUICHE_DCHECK(field_->type == QpackInstructionFieldType::kName ||
+ field_->type == QpackInstructionFieldType::kValue);
absl::string_view string_to_write =
(field_->type == QpackInstructionFieldType::kName) ? name : value;
@@ -147,7 +147,7 @@
use_huffman_ = encoded_size < string_length_;
if (use_huffman_) {
- DCHECK_EQ(0, byte_ & (1 << field_->param));
+ QUICHE_DCHECK_EQ(0, byte_ & (1 << field_->param));
byte_ |= (1 << field_->param);
string_length_ = encoded_size;
@@ -159,8 +159,8 @@
void QpackInstructionEncoder::DoWriteString(absl::string_view name,
absl::string_view value,
std::string* output) {
- DCHECK(field_->type == QpackInstructionFieldType::kName ||
- field_->type == QpackInstructionFieldType::kValue);
+ QUICHE_DCHECK(field_->type == QpackInstructionFieldType::kName ||
+ field_->type == QpackInstructionFieldType::kValue);
absl::string_view string_to_write =
(field_->type == QpackInstructionFieldType::kName) ? name : value;
diff --git a/quic/core/qpack/qpack_instructions.cc b/quic/core/qpack/qpack_instructions.cc
index e3f37a7..7f95762 100644
--- a/quic/core/qpack/qpack_instructions.cc
+++ b/quic/core/qpack/qpack_instructions.cc
@@ -19,7 +19,7 @@
void ValidateLangague(const QpackLanguage* language) {
#ifndef NDEBUG
for (const auto* instruction : *language) {
- DCHECK_EQ(0, instruction->opcode.value & ~instruction->opcode.mask);
+ QUICHE_DCHECK_EQ(0, instruction->opcode.value & ~instruction->opcode.mask);
}
for (uint8_t byte = 0; byte < std::numeric_limits<uint8_t>::max(); ++byte) {
@@ -29,7 +29,7 @@
++match_count;
}
}
- DCHECK_EQ(1u, match_count) << static_cast<int>(byte);
+ QUICHE_DCHECK_EQ(1u, match_count) << static_cast<int>(byte);
}
#else
(void)language;
diff --git a/quic/core/qpack/qpack_progressive_decoder.cc b/quic/core/qpack/qpack_progressive_decoder.cc
index 87af1b7..ac07fed 100644
--- a/quic/core/qpack/qpack_progressive_decoder.cc
+++ b/quic/core/qpack/qpack_progressive_decoder.cc
@@ -47,7 +47,7 @@
}
void QpackProgressiveDecoder::Decode(absl::string_view data) {
- DCHECK(decoding_);
+ QUICHE_DCHECK(decoding_);
if (data.empty() || error_detected_) {
return;
@@ -56,14 +56,14 @@
// Decode prefix byte by byte until the first (and only) instruction is
// decoded.
while (!prefix_decoded_) {
- DCHECK(!blocked_);
+ QUICHE_DCHECK(!blocked_);
if (!prefix_decoder_->Decode(data.substr(0, 1))) {
return;
}
// |prefix_decoder_->Decode()| must return false if an error is detected.
- DCHECK(!error_detected_);
+ QUICHE_DCHECK(!error_detected_);
data = data.substr(1);
if (data.empty()) {
@@ -74,14 +74,14 @@
if (blocked_) {
buffer_.append(data.data(), data.size());
} else {
- DCHECK(buffer_.empty());
+ QUICHE_DCHECK(buffer_.empty());
instruction_decoder_.Decode(data);
}
}
void QpackProgressiveDecoder::EndHeaderBlock() {
- DCHECK(decoding_);
+ QUICHE_DCHECK(decoding_);
decoding_ = false;
if (!blocked_) {
@@ -90,7 +90,7 @@
}
void QpackProgressiveDecoder::OnError(absl::string_view error_message) {
- DCHECK(!error_detected_);
+ QUICHE_DCHECK(!error_detected_);
error_detected_ = true;
// Might destroy |this|.
@@ -103,8 +103,9 @@
return DoPrefixInstruction();
}
- DCHECK(prefix_decoded_);
- DCHECK_LE(required_insert_count_, header_table_->inserted_entry_count());
+ QUICHE_DCHECK(prefix_decoded_);
+ QUICHE_DCHECK_LE(required_insert_count_,
+ header_table_->inserted_entry_count());
if (instruction == QpackIndexedHeaderFieldInstruction()) {
return DoIndexedHeaderFieldInstruction();
@@ -118,7 +119,7 @@
if (instruction == QpackLiteralHeaderFieldPostBaseInstruction()) {
return DoLiteralHeaderFieldPostBaseInstruction();
}
- DCHECK_EQ(instruction, QpackLiteralHeaderFieldInstruction());
+ QUICHE_DCHECK_EQ(instruction, QpackLiteralHeaderFieldInstruction());
return DoLiteralHeaderFieldInstruction();
}
@@ -132,7 +133,7 @@
}
void QpackProgressiveDecoder::OnInsertCountReachedThreshold() {
- DCHECK(blocked_);
+ QUICHE_DCHECK(blocked_);
// Clear |blocked_| before calling instruction_decoder_.Decode() below,
// because that might destroy |this| and ~QpackProgressiveDecoder() needs to
@@ -172,7 +173,7 @@
return false;
}
- DCHECK_LT(absolute_index, std::numeric_limits<uint64_t>::max());
+ QUICHE_DCHECK_LT(absolute_index, std::numeric_limits<uint64_t>::max());
required_insert_count_so_far_ =
std::max(required_insert_count_so_far_, absolute_index + 1);
@@ -212,7 +213,7 @@
return false;
}
- DCHECK_LT(absolute_index, std::numeric_limits<uint64_t>::max());
+ QUICHE_DCHECK_LT(absolute_index, std::numeric_limits<uint64_t>::max());
required_insert_count_so_far_ =
std::max(required_insert_count_so_far_, absolute_index + 1);
@@ -242,7 +243,7 @@
return false;
}
- DCHECK_LT(absolute_index, std::numeric_limits<uint64_t>::max());
+ QUICHE_DCHECK_LT(absolute_index, std::numeric_limits<uint64_t>::max());
required_insert_count_so_far_ =
std::max(required_insert_count_so_far_, absolute_index + 1);
@@ -282,7 +283,7 @@
return false;
}
- DCHECK_LT(absolute_index, std::numeric_limits<uint64_t>::max());
+ QUICHE_DCHECK_LT(absolute_index, std::numeric_limits<uint64_t>::max());
required_insert_count_so_far_ =
std::max(required_insert_count_so_far_, absolute_index + 1);
@@ -306,7 +307,7 @@
}
bool QpackProgressiveDecoder::DoPrefixInstruction() {
- DCHECK(!prefix_decoded_);
+ QUICHE_DCHECK(!prefix_decoded_);
if (!QpackDecodeRequiredInsertCount(
prefix_decoder_->varint(), header_table_->max_entries(),
@@ -337,9 +338,9 @@
}
void QpackProgressiveDecoder::FinishDecoding() {
- DCHECK(buffer_.empty());
- DCHECK(!blocked_);
- DCHECK(!decoding_);
+ QUICHE_DCHECK(buffer_.empty());
+ QUICHE_DCHECK(!blocked_);
+ QUICHE_DCHECK(!decoding_);
if (error_detected_) {
return;
diff --git a/quic/core/qpack/qpack_receive_stream.cc b/quic/core/qpack/qpack_receive_stream.cc
index 00fb394..65e290f 100644
--- a/quic/core/qpack/qpack_receive_stream.cc
+++ b/quic/core/qpack/qpack_receive_stream.cc
@@ -23,7 +23,7 @@
void QpackReceiveStream::OnDataAvailable() {
iovec iov;
while (!reading_stopped() && sequencer()->GetReadableRegion(&iov)) {
- DCHECK(!sequencer()->IsClosed());
+ QUICHE_DCHECK(!sequencer()->IsClosed());
receiver_->Decode(absl::string_view(
reinterpret_cast<const char*>(iov.iov_base), iov.iov_len));
diff --git a/quic/core/qpack/qpack_required_insert_count.cc b/quic/core/qpack/qpack_required_insert_count.cc
index 841af28..6e17b24 100644
--- a/quic/core/qpack/qpack_required_insert_count.cc
+++ b/quic/core/qpack/qpack_required_insert_count.cc
@@ -30,17 +30,18 @@
// |max_entries| is calculated by dividing an unsigned 64-bit integer by 32,
// precluding all calculations in this method from overflowing.
- DCHECK_LE(max_entries, std::numeric_limits<uint64_t>::max() / 32);
+ QUICHE_DCHECK_LE(max_entries, std::numeric_limits<uint64_t>::max() / 32);
if (encoded_required_insert_count > 2 * max_entries) {
return false;
}
*required_insert_count = encoded_required_insert_count - 1;
- DCHECK_LT(*required_insert_count, std::numeric_limits<uint64_t>::max() / 16);
+ QUICHE_DCHECK_LT(*required_insert_count,
+ std::numeric_limits<uint64_t>::max() / 16);
uint64_t current_wrapped = total_number_of_inserts % (2 * max_entries);
- DCHECK_LT(current_wrapped, std::numeric_limits<uint64_t>::max() / 16);
+ QUICHE_DCHECK_LT(current_wrapped, std::numeric_limits<uint64_t>::max() / 16);
if (current_wrapped >= *required_insert_count + max_entries) {
// Required Insert Count wrapped around 1 extra time.
diff --git a/quic/core/qpack/qpack_static_table.cc b/quic/core/qpack/qpack_static_table.cc
index 8a65b07..869d09c 100644
--- a/quic/core/qpack/qpack_static_table.cc
+++ b/quic/core/qpack/qpack_static_table.cc
@@ -130,7 +130,7 @@
auto* table = new QpackStaticTable();
table->Initialize(QpackStaticTableVector().data(),
QpackStaticTableVector().size());
- CHECK(table->IsInitialized());
+ QUICHE_CHECK(table->IsInitialized());
return table;
}();
return *shared_static_table;
diff --git a/quic/core/qpack/value_splitting_header_list.cc b/quic/core/qpack/value_splitting_header_list.cc
index 80d7dac..9d4231d 100644
--- a/quic/core/qpack/value_splitting_header_list.cc
+++ b/quic/core/qpack/value_splitting_header_list.cc
@@ -3,7 +3,9 @@
// found in the LICENSE file.
#include "quic/core/qpack/value_splitting_header_list.h"
+
#include "absl/strings/string_view.h"
+#include "quic/platform/api/quic_logging.h"
namespace quic {
namespace {
@@ -61,7 +63,7 @@
}
void ValueSplittingHeaderList::const_iterator::UpdateHeaderField() {
- DCHECK(value_start_ != absl::string_view::npos);
+ QUICHE_DCHECK(value_start_ != absl::string_view::npos);
if (header_list_iterator_ == header_list_->end()) {
return;
@@ -91,7 +93,7 @@
ValueSplittingHeaderList::ValueSplittingHeaderList(
const spdy::Http2HeaderBlock* header_list)
: header_list_(header_list) {
- DCHECK(header_list_);
+ QUICHE_DCHECK(header_list_);
}
ValueSplittingHeaderList::const_iterator ValueSplittingHeaderList::begin()
diff --git a/quic/core/quic_alarm.cc b/quic/core/quic_alarm.cc
index cdbe9bf..bfef316 100644
--- a/quic/core/quic_alarm.cc
+++ b/quic/core/quic_alarm.cc
@@ -12,8 +12,8 @@
QuicAlarm::~QuicAlarm() {}
void QuicAlarm::Set(QuicTime new_deadline) {
- DCHECK(!IsSet());
- DCHECK(new_deadline.IsInitialized());
+ QUICHE_DCHECK(!IsSet());
+ QUICHE_DCHECK(new_deadline.IsInitialized());
deadline_ = new_deadline;
SetImpl();
}
diff --git a/quic/core/quic_alarm_test.cc b/quic/core/quic_alarm_test.cc
index 29ff974..8f7296c 100644
--- a/quic/core/quic_alarm_test.cc
+++ b/quic/core/quic_alarm_test.cc
@@ -24,7 +24,7 @@
void set_alarm(QuicAlarm* alarm) { alarm_ = alarm; }
void OnAlarm() override {
- DCHECK(alarm_);
+ QUICHE_DCHECK(alarm_);
delete alarm_;
}
@@ -46,12 +46,12 @@
protected:
void SetImpl() override {
- DCHECK(deadline().IsInitialized());
+ QUICHE_DCHECK(deadline().IsInitialized());
scheduled_ = true;
}
void CancelImpl() override {
- DCHECK(!deadline().IsInitialized());
+ QUICHE_DCHECK(!deadline().IsInitialized());
scheduled_ = false;
}
diff --git a/quic/core/quic_arena_scoped_ptr_test.cc b/quic/core/quic_arena_scoped_ptr_test.cc
index 45bc142..6388cf3 100644
--- a/quic/core/quic_arena_scoped_ptr_test.cc
+++ b/quic/core/quic_arena_scoped_ptr_test.cc
@@ -29,7 +29,7 @@
case TestParam::kFromArena:
return "arena";
}
- DCHECK(false);
+ QUICHE_DCHECK(false);
return "?";
}
@@ -40,11 +40,11 @@
switch (GetParam()) {
case TestParam::kFromHeap:
ptr = QuicArenaScopedPtr<TestObject>(new TestObject(value));
- CHECK(!ptr.is_from_arena());
+ QUICHE_CHECK(!ptr.is_from_arena());
break;
case TestParam::kFromArena:
ptr = arena_.New<TestObject>(value);
- CHECK(ptr.is_from_arena());
+ QUICHE_CHECK(ptr.is_from_arena());
break;
}
return ptr;
diff --git a/quic/core/quic_buffered_packet_store.cc b/quic/core/quic_buffered_packet_store.cc
index 893fc82..b9e3d10 100644
--- a/quic/core/quic_buffered_packet_store.cc
+++ b/quic/core/quic_buffered_packet_store.cc
@@ -110,7 +110,7 @@
undecryptable_packets_.back().second.ietf_quic = ietf_quic;
undecryptable_packets_.back().second.version = version;
}
- CHECK(QuicContainsKey(undecryptable_packets_, connection_id));
+ QUICHE_CHECK(QuicContainsKey(undecryptable_packets_, connection_id));
BufferedPacketList& queue =
undecryptable_packets_.find(connection_id)->second;
@@ -243,7 +243,7 @@
connections_with_chlo_.pop_front();
BufferedPacketList packets = DeliverPackets(*connection_id);
- DCHECK(!packets.buffered_packets.empty())
+ QUICHE_DCHECK(!packets.buffered_packets.empty())
<< "Try to deliver connectons without CHLO";
return packets;
}
@@ -258,8 +258,8 @@
const ParsedQuicVersion& version,
const QuicReceivedPacket& packet,
std::vector<std::string>* out_alpns) {
- DCHECK_NE(out_alpns, nullptr);
- DCHECK_EQ(version.handshake_protocol, PROTOCOL_TLS1_3);
+ QUICHE_DCHECK_NE(out_alpns, nullptr);
+ QUICHE_DCHECK_EQ(version.handshake_protocol, PROTOCOL_TLS1_3);
auto it = undecryptable_packets_.find(connection_id);
if (it == undecryptable_packets_.end()) {
QUIC_BUG << "Cannot ingest packet for unknown connection ID "
diff --git a/quic/core/quic_clock.cc b/quic/core/quic_clock.cc
index f057b40..4d865b5 100644
--- a/quic/core/quic_clock.cc
+++ b/quic/core/quic_clock.cc
@@ -38,7 +38,7 @@
}
void QuicClock::SetCalibrationOffset(QuicTime::Delta offset) {
- DCHECK(!is_calibrated_) << "A clock should only be calibrated once";
+ QUICHE_DCHECK(!is_calibrated_) << "A clock should only be calibrated once";
calibration_offset_ = offset;
is_calibrated_ = true;
}
diff --git a/quic/core/quic_coalesced_packet.cc b/quic/core/quic_coalesced_packet.cc
index 47aa93b..2ae9b41 100644
--- a/quic/core/quic_coalesced_packet.cc
+++ b/quic/core/quic_coalesced_packet.cc
@@ -30,10 +30,10 @@
if (length_ == 0) {
#ifndef NDEBUG
for (const auto& buffer : encrypted_buffers_) {
- DCHECK(buffer.empty());
+ QUICHE_DCHECK(buffer.empty());
}
#endif
- DCHECK(initial_packet_ == nullptr);
+ QUICHE_DCHECK(initial_packet_ == nullptr);
// This is the first packet, set max_packet_length and self/peer
// addresses.
max_packet_length_ = current_max_packet_length;
diff --git a/quic/core/quic_config.cc b/quic/core/quic_config.cc
index 725b513..893d822 100644
--- a/quic/core/quic_config.cc
+++ b/quic/core/quic_config.cc
@@ -37,7 +37,7 @@
uint32_t default_value,
uint32_t* out,
std::string* error_details) {
- DCHECK(error_details != nullptr);
+ QUICHE_DCHECK(error_details != nullptr);
QuicErrorCode error = msg.GetUint32(tag, out);
switch (error) {
case QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND:
@@ -112,7 +112,7 @@
const CryptoHandshakeMessage& peer_hello,
HelloType /*hello_type*/,
std::string* error_details) {
- DCHECK(error_details != nullptr);
+ QUICHE_DCHECK(error_details != nullptr);
if (tag_ == 0) {
*error_details =
"This parameter does not support reading from CryptoHandshakeMessage";
@@ -201,7 +201,7 @@
const CryptoHandshakeMessage& peer_hello,
HelloType /*hello_type*/,
std::string* error_details) {
- DCHECK(error_details != nullptr);
+ QUICHE_DCHECK(error_details != nullptr);
uint32_t receive_value32;
QuicErrorCode error = peer_hello.GetUint32(tag_, &receive_value32);
// GetUint32 is guaranteed to always initialize receive_value32.
@@ -269,7 +269,7 @@
const CryptoHandshakeMessage& peer_hello,
HelloType /*hello_type*/,
std::string* error_details) {
- DCHECK(error_details != nullptr);
+ QUICHE_DCHECK(error_details != nullptr);
QuicErrorCode error = peer_hello.GetUint128(tag_, &receive_value_);
switch (error) {
case QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND:
@@ -339,7 +339,7 @@
const CryptoHandshakeMessage& peer_hello,
HelloType /*hello_type*/,
std::string* error_details) {
- DCHECK(error_details != nullptr);
+ QUICHE_DCHECK(error_details != nullptr);
QuicTagVector values;
QuicErrorCode error = peer_hello.GetTaglist(tag_, &values);
switch (error) {
@@ -942,7 +942,7 @@
const std::pair<QuicConnectionId, QuicUint128>&
QuicConfig::ReceivedPreferredAddressConnectionIdAndToken() const {
- DCHECK(HasReceivedPreferredAddressConnectionIdAndToken());
+ QUICHE_DCHECK(HasReceivedPreferredAddressConnectionIdAndToken());
return *preferred_address_connection_id_and_token_;
}
@@ -1092,7 +1092,7 @@
const CryptoHandshakeMessage& peer_hello,
HelloType hello_type,
std::string* error_details) {
- DCHECK(error_details != nullptr);
+ QUICHE_DCHECK(error_details != nullptr);
QuicErrorCode error = QUIC_NO_ERROR;
if (error == QUIC_NO_ERROR) {
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index 5c14542..df09b23 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -69,8 +69,8 @@
AckAlarmDelegate& operator=(const AckAlarmDelegate&) = delete;
void OnAlarm() override {
- DCHECK(connection_->ack_frame_updated());
- DCHECK(connection_->connected());
+ QUICHE_DCHECK(connection_->ack_frame_updated());
+ QUICHE_DCHECK(connection_->connected());
QuicConnection::ScopedPacketFlusher flusher(connection_);
if (connection_->SupportsMultiplePacketNumberSpaces()) {
connection_->SendAllPendingAcks();
@@ -95,7 +95,7 @@
delete;
void OnAlarm() override {
- DCHECK(connection_->connected());
+ QUICHE_DCHECK(connection_->connected());
connection_->OnRetransmissionTimeout();
}
@@ -113,7 +113,7 @@
SendAlarmDelegate& operator=(const SendAlarmDelegate&) = delete;
void OnAlarm() override {
- DCHECK(connection_->connected());
+ QUICHE_DCHECK(connection_->connected());
connection_->WriteAndBundleAcksIfNotBlocked();
}
@@ -129,7 +129,7 @@
PingAlarmDelegate& operator=(const PingAlarmDelegate&) = delete;
void OnAlarm() override {
- DCHECK(connection_->connected());
+ QUICHE_DCHECK(connection_->connected());
connection_->OnPingTimeout();
}
@@ -146,7 +146,7 @@
delete;
void OnAlarm() override {
- DCHECK(connection_->connected());
+ QUICHE_DCHECK(connection_->connected());
connection_->DiscoverMtu();
}
@@ -164,7 +164,7 @@
const ProcessUndecryptablePacketsAlarmDelegate&) = delete;
void OnAlarm() override {
- DCHECK(connection_->connected());
+ QUICHE_DCHECK(connection_->connected());
QuicConnection::ScopedPacketFlusher flusher(connection_);
connection_->MaybeProcessUndecryptablePackets();
}
@@ -183,7 +183,7 @@
const DiscardPreviousOneRttKeysAlarmDelegate&) = delete;
void OnAlarm() override {
- DCHECK(connection_->connected());
+ QUICHE_DCHECK(connection_->connected());
connection_->DiscardPreviousOneRttKeys();
}
@@ -201,7 +201,7 @@
const DiscardZeroRttDecryptionKeysAlarmDelegate&) = delete;
void OnAlarm() override {
- DCHECK(connection_->connected());
+ QUICHE_DCHECK(connection_->connected());
QUIC_DLOG(INFO) << "0-RTT discard alarm fired";
connection_->RemoveDecrypter(ENCRYPTION_ZERO_RTT);
}
@@ -375,8 +375,8 @@
most_recent_frame_type_(NUM_FRAME_TYPES) {
QUIC_BUG_IF(!start_peer_migration_earlier_ && send_path_response_);
- DCHECK(perspective_ == Perspective::IS_CLIENT ||
- self_address_.IsInitialized());
+ QUICHE_DCHECK(perspective_ == Perspective::IS_CLIENT ||
+ self_address_.IsInitialized());
if (use_encryption_level_context_) {
QUIC_RELOADABLE_FLAG_COUNT(quic_use_encryption_level_context);
@@ -406,8 +406,8 @@
: kDefaultMaxPacketSize);
uber_received_packet_manager_.set_max_ack_ranges(255);
MaybeEnableMultiplePacketNumberSpacesSupport();
- DCHECK(perspective_ == Perspective::IS_CLIENT ||
- supported_versions.size() == 1);
+ QUICHE_DCHECK(perspective_ == Perspective::IS_CLIENT ||
+ supported_versions.size() == 1);
InstallInitialCrypters(server_connection_id_);
// On the server side, version negotiation has been done by the dispatcher,
@@ -461,7 +461,7 @@
}
bool QuicConnection::ValidateConfigConnectionIds(const QuicConfig& config) {
- DCHECK(config.negotiated());
+ QUICHE_DCHECK(config.negotiated());
if (!version().UsesTls()) {
// QUIC+TLS is required to transmit connection ID transport parameters.
return true;
@@ -837,9 +837,9 @@
// Check that any public reset packet with a different connection ID that was
// routed to this QuicConnection has been redirected before control reaches
// here. (Check for a bug regression.)
- DCHECK_EQ(server_connection_id_, packet.connection_id);
- DCHECK_EQ(perspective_, Perspective::IS_CLIENT);
- DCHECK(!version().HasIetfInvariantHeader());
+ QUICHE_DCHECK_EQ(server_connection_id_, packet.connection_id);
+ QUICHE_DCHECK_EQ(perspective_, Perspective::IS_CLIENT);
+ QUICHE_DCHECK(!version().HasIetfInvariantHeader());
if (debug_visitor_ != nullptr) {
debug_visitor_->OnPublicResetPacket(packet);
}
@@ -875,7 +875,7 @@
// Check that any public reset packet with a different connection ID that was
// routed to this QuicConnection has been redirected before control reaches
// here. (Check for a bug regression.)
- DCHECK_EQ(server_connection_id_, packet.connection_id);
+ QUICHE_DCHECK_EQ(server_connection_id_, packet.connection_id);
if (perspective_ == Perspective::IS_SERVER) {
const std::string error_details =
"Server received version negotiation packet.";
@@ -924,7 +924,7 @@
absl::string_view retry_token,
absl::string_view retry_integrity_tag,
absl::string_view retry_without_tag) {
- DCHECK_EQ(Perspective::IS_CLIENT, perspective_);
+ QUICHE_DCHECK_EQ(Perspective::IS_CLIENT, perspective_);
if (version().UsesTls()) {
if (!CryptoUtils::ValidateRetryIntegrityTag(
version(), server_connection_id_, retry_without_tag,
@@ -949,7 +949,7 @@
if (!original_destination_connection_id_.has_value()) {
original_destination_connection_id_ = server_connection_id_;
}
- DCHECK(!retry_source_connection_id_.has_value())
+ QUICHE_DCHECK(!retry_source_connection_id_.has_value())
<< retry_source_connection_id_.value();
retry_source_connection_id_ = new_connection_id;
server_connection_id_ = new_connection_id;
@@ -980,12 +980,12 @@
<< original_destination_connection_id
<< " on connection with server_connection_id "
<< server_connection_id_;
- DCHECK_NE(original_destination_connection_id, server_connection_id_);
+ QUICHE_DCHECK_NE(original_destination_connection_id, server_connection_id_);
if (!HasIncomingConnectionId(original_destination_connection_id)) {
incoming_connection_ids_.push_back(original_destination_connection_id);
}
InstallInitialCrypters(original_destination_connection_id);
- DCHECK(!original_destination_connection_id_.has_value())
+ QUICHE_DCHECK(!original_destination_connection_id_.has_value())
<< original_destination_connection_id_.value();
original_destination_connection_id_ = original_destination_connection_id;
}
@@ -1027,7 +1027,7 @@
// If this is a server, the dispatcher routes each packet to the
// QuicConnection responsible for the packet's connection ID. So if control
// arrives here and this is a server, the dispatcher must be malfunctioning.
- DCHECK_NE(Perspective::IS_SERVER, perspective_);
+ QUICHE_DCHECK_NE(Perspective::IS_SERVER, perspective_);
return false;
}
@@ -1066,11 +1066,11 @@
// Check that any public reset packet with a different connection ID that was
// routed to this QuicConnection has been redirected before control reaches
// here.
- DCHECK(GetServerConnectionIdAsRecipient(header, perspective_) ==
- server_connection_id_ ||
- HasIncomingConnectionId(
- GetServerConnectionIdAsRecipient(header, perspective_)) ||
- PacketCanReplaceConnectionId(header, perspective_));
+ QUICHE_DCHECK(GetServerConnectionIdAsRecipient(header, perspective_) ==
+ server_connection_id_ ||
+ HasIncomingConnectionId(
+ GetServerConnectionIdAsRecipient(header, perspective_)) ||
+ PacketCanReplaceConnectionId(header, perspective_));
if (packet_creator_.HasPendingFrames()) {
// Incoming packets may change a queued ACK frame.
@@ -1094,7 +1094,7 @@
}
void QuicConnection::OnSuccessfulMigration() {
- DCHECK_EQ(perspective_, Perspective::IS_CLIENT);
+ QUICHE_DCHECK_EQ(perspective_, Perspective::IS_CLIENT);
if (IsPathDegrading()) {
// If path was previously degrading, and migration is successful after
// probing, restart the path degrading and blackhole detection.
@@ -1252,7 +1252,7 @@
stats_.address_validated_via_token = true;
}
}
- DCHECK(connected_);
+ QUICHE_DCHECK(connected_);
return true;
}
@@ -1606,7 +1606,7 @@
"is closed. Last frame: "
<< most_recent_frame_type_;
if (has_path_challenge_in_current_packet_) {
- DCHECK(send_path_response_);
+ QUICHE_DCHECK(send_path_response_);
QUIC_RELOADABLE_FLAG_COUNT_N(quic_send_path_response, 2, 5);
// Only respond to the 1st PATH_CHALLENGE.
return true;
@@ -1960,7 +1960,7 @@
}
if (IsCurrentPacketConnectivityProbing()) {
- DCHECK(!version().HasIetfQuicFrames());
+ QUICHE_DCHECK(!version().HasIetfQuicFrames());
++stats_.num_connectivity_probing_received;
}
@@ -2065,8 +2065,8 @@
const QuicIetfStatelessResetPacket& /*packet*/) {
// TODO(fayang): Add OnAuthenticatedIetfStatelessResetPacket to
// debug_visitor_.
- DCHECK(version().HasIetfInvariantHeader());
- DCHECK_EQ(perspective_, Perspective::IS_CLIENT);
+ QUICHE_DCHECK(version().HasIetfInvariantHeader());
+ QUICHE_DCHECK_EQ(perspective_, Perspective::IS_CLIENT);
if (use_path_validator_) {
if (!IsDefaultPath(last_packet_destination_address_,
@@ -2097,7 +2097,7 @@
}
void QuicConnection::OnKeyUpdate(KeyUpdateReason reason) {
- DCHECK(support_key_update_for_connection_);
+ QUICHE_DCHECK(support_key_update_for_connection_);
QUIC_DLOG(INFO) << ENDPOINT << "Key phase updated for " << reason;
lowest_packet_sent_in_current_key_phase_.Clear();
@@ -2171,7 +2171,7 @@
}
const QuicFrame QuicConnection::GetUpdatedAckFrame() {
- DCHECK(!uber_received_packet_manager_.IsAckFrameEmpty(
+ QUICHE_DCHECK(!uber_received_packet_manager_.IsAckFrameEmpty(
QuicUtils::GetPacketNumberSpace(encryption_level_)))
<< "Try to retrieve an empty ACK frame";
return uber_received_packet_manager_.GetUpdatedAckFrame(
@@ -2222,7 +2222,7 @@
if (!legacy_version_encapsulation_enabled_) {
return;
}
- DCHECK(!legacy_version_encapsulation_in_progress_);
+ QUICHE_DCHECK(!legacy_version_encapsulation_in_progress_);
QUIC_BUG_IF(!packet_creator_.CanSetMaxPacketLength())
<< "Cannot activate Legacy Version Encapsulation mid-packet";
QUIC_BUG_IF(coalesced_packet_.length() != 0u)
@@ -2236,7 +2236,7 @@
}
// Flush any remaining packet before disactivating encapsulation.
packet_creator_.FlushCurrentPacket();
- DCHECK(legacy_version_encapsulation_enabled_);
+ QUICHE_DCHECK(legacy_version_encapsulation_enabled_);
legacy_version_encapsulation_in_progress_ = false;
MaybeUpdatePacketCreatorMaxPacketLengthAndPadding();
}
@@ -2373,7 +2373,7 @@
<< decryption_level
<< " while connection is at encryption level "
<< encryption_level_;
- DCHECK(EncryptionLevelIsValid(decryption_level));
+ QUICHE_DCHECK(EncryptionLevelIsValid(decryption_level));
if (encryption_level_ != ENCRYPTION_FORWARD_SECURE) {
++stats_.undecryptable_packets_received_before_handshake_complete;
}
@@ -2393,7 +2393,7 @@
stats_.num_failed_authentication_packets_received++;
if (version().UsesTls()) {
// Should always be non-null if has_decryption_key is true.
- DCHECK(framer_.GetDecrypter(decryption_level));
+ QUICHE_DCHECK(framer_.GetDecrypter(decryption_level));
const QuicPacketCount integrity_limit =
framer_.GetDecrypter(decryption_level)->GetIntegrityLimit();
QUIC_DVLOG(2) << ENDPOINT << "Checking AEAD integrity limits:"
@@ -2464,7 +2464,7 @@
void QuicConnection::MaybeUpdatePacketCreatorMaxPacketLengthAndPadding() {
QuicByteCount max_packet_length = GetLimitedMaxPacketSize(long_term_mtu_);
if (legacy_version_encapsulation_in_progress_) {
- DCHECK(legacy_version_encapsulation_enabled_);
+ QUICHE_DCHECK(legacy_version_encapsulation_enabled_);
const QuicByteCount minimum_overhead =
QuicLegacyVersionEncapsulator::GetMinimumOverhead(
legacy_version_encapsulation_sni_);
@@ -2713,7 +2713,7 @@
if (!version_negotiated_) {
if (perspective_ == Perspective::IS_CLIENT) {
- DCHECK(!header.version_flag || header.form != GOOGLE_QUIC_PACKET);
+ QUICHE_DCHECK(!header.version_flag || header.form != GOOGLE_QUIC_PACKET);
if (!version().HasIetfInvariantHeader()) {
// If the client gets a packet without the version flag from the server
// it should stop sending version since the version negotiation is done.
@@ -2758,7 +2758,7 @@
}
void QuicConnection::WriteQueuedPackets() {
- DCHECK(!writer_->IsWriteBlocked());
+ QUICHE_DCHECK(!writer_->IsWriteBlocked());
QUIC_CLIENT_HISTOGRAM_COUNTS("QuicSession.NumQueuedPacketsBeforeWrite",
buffered_packets_.size(), 1, 1000, 50, "");
@@ -2838,8 +2838,8 @@
bool QuicConnection::ShouldGeneratePacket(
HasRetransmittableData retransmittable,
IsHandshake handshake) {
- DCHECK(handshake != IS_HANDSHAKE ||
- QuicVersionUsesCryptoFrames(transport_version()))
+ QUICHE_DCHECK(handshake != IS_HANDSHAKE ||
+ QuicVersionUsesCryptoFrames(transport_version()))
<< ENDPOINT
<< "Handshake in STREAM frames should not check ShouldGeneratePacket";
if (!count_bytes_on_alternative_path_separately_) {
@@ -3002,7 +3002,7 @@
termination_packets_->emplace_back(
new QuicEncryptedPacket(buffer_copy, encrypted_length, true));
if (error_code == QUIC_SILENT_IDLE_TIMEOUT) {
- DCHECK_EQ(Perspective::IS_SERVER, perspective_);
+ QUICHE_DCHECK_EQ(Perspective::IS_SERVER, perspective_);
// TODO(fayang): populate histogram indicating the time elapsed from this
// connection gets closed to following client packets get received.
QUIC_DVLOG(1) << ENDPOINT
@@ -3013,9 +3013,9 @@
}
}
- DCHECK_LE(encrypted_length, kMaxOutgoingPacketSize);
- DCHECK(is_mtu_discovery ||
- encrypted_length <= packet_creator_.max_packet_length())
+ QUICHE_DCHECK_LE(encrypted_length, kMaxOutgoingPacketSize);
+ QUICHE_DCHECK(is_mtu_discovery ||
+ encrypted_length <= packet_creator_.max_packet_length())
<< " encrypted_length=" << encrypted_length
<< " > packet_creator max_packet_length="
<< packet_creator_.max_packet_length();
@@ -3106,11 +3106,11 @@
}
break;
case LEGACY_VERSION_ENCAPSULATE: {
- DCHECK(!is_mtu_discovery);
- DCHECK_EQ(perspective_, Perspective::IS_CLIENT);
- DCHECK_EQ(packet->encryption_level, ENCRYPTION_INITIAL);
- DCHECK(legacy_version_encapsulation_enabled_);
- DCHECK(legacy_version_encapsulation_in_progress_);
+ QUICHE_DCHECK(!is_mtu_discovery);
+ QUICHE_DCHECK_EQ(perspective_, Perspective::IS_CLIENT);
+ QUICHE_DCHECK_EQ(packet->encryption_level, ENCRYPTION_INITIAL);
+ QUICHE_DCHECK(legacy_version_encapsulation_enabled_);
+ QUICHE_DCHECK(legacy_version_encapsulation_in_progress_);
QuicPacketLength encapsulated_length =
QuicLegacyVersionEncapsulator::Encapsulate(
legacy_version_encapsulation_sni_,
@@ -3149,7 +3149,7 @@
}
} break;
default:
- DCHECK(false);
+ QUICHE_DCHECK(false);
break;
}
@@ -3161,7 +3161,7 @@
if (IsWriteBlockedStatus(result.status)) {
// Ensure the writer is still write blocked, otherwise QUIC may continue
// trying to write when it will not be able to.
- DCHECK(writer_->IsWriteBlocked());
+ QUICHE_DCHECK(writer_->IsWriteBlocked());
visitor_->OnWriteBlocked();
// If the socket buffers the data, then the packet should not
// be queued and sent again, which would result in an unnecessary
@@ -3453,7 +3453,7 @@
"QuicConnection::FlushPackets.");
if (HandleWriteBlocked()) {
- DCHECK_EQ(WRITE_STATUS_BLOCKED, result.status)
+ QUICHE_DCHECK_EQ(WRITE_STATUS_BLOCKED, result.status)
<< "Unexpected flush result:" << result;
QUIC_DLOG(INFO) << ENDPOINT << "Write blocked in FlushPackets.";
return;
@@ -3671,7 +3671,7 @@
}
void QuicConnection::SendAck() {
- DCHECK(!SupportsMultiplePacketNumberSpaces());
+ QUICHE_DCHECK(!SupportsMultiplePacketNumberSpaces());
QUIC_DVLOG(1) << ENDPOINT << "Sending an ACK proactively";
QuicFrames frames;
frames.push_back(GetUpdatedAckFrame());
@@ -3700,8 +3700,8 @@
void QuicConnection::OnRetransmissionTimeout() {
#ifndef NDEBUG
if (sent_packet_manager_.unacked_packets().empty()) {
- DCHECK(sent_packet_manager_.handshake_mode_disabled());
- DCHECK(!IsHandshakeComplete());
+ QUICHE_DCHECK(sent_packet_manager_.handshake_mode_disabled());
+ QUICHE_DCHECK(!IsHandshakeComplete());
}
#endif
if (!connected_) {
@@ -3732,7 +3732,7 @@
!sent_packet_manager_.HasInFlightPackets() &&
blackhole_detector_.IsDetectionInProgress()) {
// Stop detection in quiescence.
- DCHECK_EQ(QuicSentPacketManager::LOSS_MODE, retransmission_mode);
+ QUICHE_DCHECK_EQ(QuicSentPacketManager::LOSS_MODE, retransmission_mode);
blackhole_detector_.StopDetection();
}
WriteIfNotBlocked();
@@ -3762,7 +3762,8 @@
QUIC_DLOG(INFO) << ENDPOINT
<< "No packet gets sent when timer fires in mode "
<< retransmission_mode << ", send PING";
- DCHECK_LT(0u, sent_packet_manager_.pending_timer_transmission_count());
+ QUICHE_DCHECK_LT(0u,
+ sent_packet_manager_.pending_timer_transmission_count());
EncryptionLevel level = encryption_level_;
PacketNumberSpace packet_number_space = NUM_PACKET_NUMBER_SPACES;
if (SupportsMultiplePacketNumberSpaces() &&
@@ -3813,7 +3814,7 @@
void QuicConnection::SetDiversificationNonce(
const DiversificationNonce& nonce) {
- DCHECK_EQ(Perspective::IS_SERVER, perspective_);
+ QUICHE_DCHECK_EQ(Perspective::IS_SERVER, perspective_);
packet_creator_.SetDiversificationNonce(nonce);
}
@@ -4043,7 +4044,7 @@
QuicIetfTransportErrorCodes ietf_error,
const std::string& error_details,
ConnectionCloseBehavior connection_close_behavior) {
- DCHECK(!error_details.empty());
+ QUICHE_DCHECK(!error_details.empty());
if (!connected_) {
QUIC_DLOG(INFO) << "Connection is already closed.";
return;
@@ -4195,7 +4196,7 @@
// If we are using a batch writer, flush packets queued in it, if any.
FlushPackets();
connected_ = false;
- DCHECK(visitor_ != nullptr);
+ QUICHE_DCHECK(visitor_ != nullptr);
visitor_->OnConnectionClosed(frame, source);
// LossDetectionTunerInterface::Finish() may be called from
// sent_packet_manager_.OnConnectionClosed. Which may require the session to
@@ -4285,12 +4286,12 @@
}
return;
}
- DCHECK_LT(initial_retransmittable_on_wire_timeout_, ping_timeout_);
+ QUICHE_DCHECK_LT(initial_retransmittable_on_wire_timeout_, ping_timeout_);
QuicTime::Delta retransmittable_on_wire_timeout =
initial_retransmittable_on_wire_timeout_;
int max_aggressive_retransmittable_on_wire_ping_count =
GetQuicFlag(FLAGS_quic_max_aggressive_retransmittable_on_wire_ping_count);
- DCHECK_LE(0, max_aggressive_retransmittable_on_wire_ping_count);
+ QUICHE_DCHECK_LE(0, max_aggressive_retransmittable_on_wire_ping_count);
if (consecutive_retransmittable_on_wire_ping_count_ >
max_aggressive_retransmittable_on_wire_ping_count) {
// Exponentially back off the timeout if the number of consecutive
@@ -4444,8 +4445,8 @@
connection_->pending_retransmission_alarm_ = false;
}
}
- DCHECK_EQ(flush_and_set_pending_retransmission_alarm_on_delete_,
- !connection_->packet_creator_.PacketFlusherAttached());
+ QUICHE_DCHECK_EQ(flush_and_set_pending_retransmission_alarm_on_delete_,
+ !connection_->packet_creator_.PacketFlusherAttached());
}
QuicConnection::ScopedEncryptionLevelContext::ScopedEncryptionLevelContext(
@@ -4544,7 +4545,7 @@
void QuicConnection::SendMtuDiscoveryPacket(QuicByteCount target_mtu) {
// Currently, this limit is ensured by the caller.
- DCHECK_EQ(target_mtu, GetLimitedMaxPacketSize(target_mtu));
+ QUICHE_DCHECK_EQ(target_mtu, GetLimitedMaxPacketSize(target_mtu));
// Send the probe.
packet_creator_.GenerateMtuDiscoveryPacket(target_mtu);
@@ -4570,7 +4571,7 @@
QuicPacketWriter* probing_writer,
const QuicSocketAddress& peer_address,
bool is_response) {
- DCHECK(peer_address.IsInitialized());
+ QUICHE_DCHECK(peer_address.IsInitialized());
if (!connected_) {
QUIC_BUG << "Not sending connectivity probing packet as connection is "
<< "disconnected.";
@@ -4580,7 +4581,7 @@
// Server can use default packet writer to write packet.
probing_writer = writer_;
}
- DCHECK(probing_writer);
+ QUICHE_DCHECK(probing_writer);
if (probing_writer->IsWriteBlocked()) {
QUIC_DLOG(INFO)
@@ -4604,7 +4605,7 @@
// request or a response.
probing_packet = packet_creator_.SerializeConnectivityProbingPacket();
} else if (is_response) {
- DCHECK(!send_path_response_);
+ QUICHE_DCHECK(!send_path_response_);
// IETF QUIC path response.
// Respond to path probe request using IETF QUIC PATH_RESPONSE frame.
probing_packet =
@@ -4626,7 +4627,7 @@
transmitted_connectivity_probe_payload_ = nullptr;
}
}
- DCHECK_EQ(IsRetransmittable(*probing_packet), NO_RETRANSMITTABLE_DATA);
+ QUICHE_DCHECK_EQ(IsRetransmittable(*probing_packet), NO_RETRANSMITTABLE_DATA);
return WritePacketUsingWriter(std::move(probing_packet), probing_writer,
self_address(), peer_address,
/*measure_rtt=*/true);
@@ -4702,7 +4703,7 @@
}
void QuicConnection::DiscoverMtu() {
- DCHECK(!mtu_discovery_alarm_->IsSet());
+ QUICHE_DCHECK(!mtu_discovery_alarm_->IsSet());
const QuicPacketNumber largest_sent_packet =
sent_packet_manager_.GetLargestSentPacket();
@@ -4711,7 +4712,7 @@
SendMtuDiscoveryPacket(
mtu_discoverer_.GetUpdatedMtuProbeSize(largest_sent_packet));
}
- DCHECK(!mtu_discovery_alarm_->IsSet());
+ QUICHE_DCHECK(!mtu_discovery_alarm_->IsSet());
}
void QuicConnection::OnEffectivePeerMigrationValidated() {
@@ -4802,7 +4803,7 @@
}
void QuicConnection::MaybeSendProbingRetransmissions() {
- DCHECK(fill_up_link_during_probing_);
+ QUICHE_DCHECK(fill_up_link_during_probing_);
// Don't send probing retransmissions until the handshake has completed.
if (!IsHandshakeComplete() ||
@@ -4938,7 +4939,7 @@
}
void QuicConnection::MaybeStartIetfPeerMigration() {
- DCHECK(version().HasIetfQuicFrames());
+ QUICHE_DCHECK(version().HasIetfQuicFrames());
if (!start_peer_migration_earlier_) {
return;
}
@@ -5021,7 +5022,7 @@
}
void QuicConnection::UpdateReleaseTimeIntoFuture() {
- DCHECK(supports_release_time_);
+ QUICHE_DCHECK(supports_release_time_);
const QuicTime::Delta prior_max_release_time = release_time_into_future_;
release_time_into_future_ = std::max(
@@ -5100,7 +5101,7 @@
}
void QuicConnection::MaybeBundleCryptoDataWithAcks() {
- DCHECK(SupportsMultiplePacketNumberSpaces());
+ QUICHE_DCHECK(SupportsMultiplePacketNumberSpaces());
if (IsHandshakeConfirmed()) {
return;
}
@@ -5136,7 +5137,7 @@
}
void QuicConnection::SendAllPendingAcks() {
- DCHECK(SupportsMultiplePacketNumberSpaces());
+ QUICHE_DCHECK(SupportsMultiplePacketNumberSpaces());
QUIC_DVLOG(1) << ENDPOINT << "Trying to send all pending ACKs";
ack_alarm_->Cancel();
QuicTime earliest_ack_timeout =
@@ -5444,7 +5445,7 @@
return DISCARD;
}
if (legacy_version_encapsulation_in_progress_) {
- DCHECK(!is_mtu_discovery);
+ QUICHE_DCHECK(!is_mtu_discovery);
return LEGACY_VERSION_ENCAPSULATE;
}
if (version().CanSendCoalescedPackets() && !coalescing_done_ &&
@@ -5471,7 +5472,7 @@
}
bool QuicConnection::IsHandshakeConfirmed() const {
- DCHECK_EQ(PROTOCOL_TLS1_3, version().handshake_protocol);
+ QUICHE_DCHECK_EQ(PROTOCOL_TLS1_3, version().handshake_protocol);
return visitor_->GetHandshakeState() == HANDSHAKE_CONFIRMED;
}
@@ -5616,7 +5617,7 @@
if (!ShouldDetectBlackhole()) {
return QuicTime::Zero();
}
- DCHECK_LT(0u, num_rtos_for_blackhole_detection_);
+ QUICHE_DCHECK_LT(0u, num_rtos_for_blackhole_detection_);
return clock_->ApproximateNow() +
sent_packet_manager_.GetNetworkBlackholeDelay(
num_rtos_for_blackhole_detection_);
@@ -5674,8 +5675,8 @@
std::unique_ptr<SerializedPacket> probing_packet =
packet_creator_.SerializePathChallengeConnectivityProbingPacket(
data_buffer);
- DCHECK_EQ(IsRetransmittable(*probing_packet), NO_RETRANSMITTABLE_DATA);
- DCHECK_EQ(self_address, most_recent_alternative_path_.self_address);
+ QUICHE_DCHECK_EQ(IsRetransmittable(*probing_packet), NO_RETRANSMITTABLE_DATA);
+ QUICHE_DCHECK_EQ(self_address, most_recent_alternative_path_.self_address);
WritePacketUsingWriter(std::move(probing_packet), writer, self_address,
peer_address, /*measure_rtt=*/false);
return true;
@@ -5694,7 +5695,7 @@
void QuicConnection::ValidatePath(
std::unique_ptr<QuicPathValidationContext> context,
std::unique_ptr<QuicPathValidator::ResultDelegate> result_delegate) {
- DCHECK(use_path_validator_);
+ QUICHE_DCHECK(use_path_validator_);
if (perspective_ == Perspective::IS_CLIENT &&
!IsDefaultPath(context->self_address(), context->peer_address())) {
most_recent_alternative_path_ =
@@ -5722,7 +5723,7 @@
return packet_creator_.AddPathResponseFrame(data_buffer);
}
- DCHECK_EQ(Perspective::IS_CLIENT, perspective_);
+ QUICHE_DCHECK_EQ(Perspective::IS_CLIENT, perspective_);
// This PATH_CHALLENGE is received on an alternative socket which should be
// used to send PATH_RESPONSE.
if (!path_validator_.HasPendingPathValidation() ||
@@ -5736,7 +5737,7 @@
std::unique_ptr<SerializedPacket> probing_packet =
packet_creator_.SerializePathResponseConnectivityProbingPacket(
{data_buffer}, /*is_padded=*/true);
- DCHECK_EQ(IsRetransmittable(*probing_packet), NO_RETRANSMITTABLE_DATA);
+ QUICHE_DCHECK_EQ(IsRetransmittable(*probing_packet), NO_RETRANSMITTABLE_DATA);
QUIC_DVLOG(1) << ENDPOINT
<< "Send PATH_RESPONSE from alternative socket with address "
<< last_packet_destination_address_;
@@ -5760,17 +5761,17 @@
}
bool QuicConnection::HasPendingPathValidation() const {
- DCHECK(use_path_validator_);
+ QUICHE_DCHECK(use_path_validator_);
return path_validator_.HasPendingPathValidation();
}
QuicPathValidationContext* QuicConnection::GetPathValidationContext() const {
- DCHECK(use_path_validator_);
+ QUICHE_DCHECK(use_path_validator_);
return path_validator_.GetContext();
}
void QuicConnection::CancelPathValidation() {
- DCHECK(use_path_validator_);
+ QUICHE_DCHECK(use_path_validator_);
path_validator_.CancelPathValidation();
}
@@ -5798,7 +5799,7 @@
}
void QuicConnection::SetSourceAddressTokenToSend(absl::string_view token) {
- DCHECK_EQ(perspective_, Perspective::IS_CLIENT);
+ QUICHE_DCHECK_EQ(perspective_, Perspective::IS_CLIENT);
if (!packet_creator_.HasRetryToken()) {
// Ignore received tokens (via NEW_TOKEN frame) from previous connections
// when a RETRY token has been received.
@@ -5813,7 +5814,7 @@
perspective_ != Perspective::IS_SERVER) {
return;
}
- DCHECK(!IsDefaultPath(self_address_, peer_address));
+ QUICHE_DCHECK(!IsDefaultPath(self_address_, peer_address));
if (!IsMostRecentAlternativePath(self_address_, peer_address)) {
QUIC_DLOG(INFO) << "Wrote to uninteresting peer address: " << peer_address
<< " default direct_peer_address_ " << direct_peer_address_
@@ -5853,8 +5854,8 @@
}
// Only update bytes received if this probing frame is received on the most
// recent alternative path.
- DCHECK(!IsDefaultPath(last_packet_destination_address_,
- GetEffectivePeerAddressFromCurrentPacket()));
+ QUICHE_DCHECK(!IsDefaultPath(last_packet_destination_address_,
+ GetEffectivePeerAddressFromCurrentPacket()));
if (!most_recent_alternative_path_.validated) {
most_recent_alternative_path_.bytes_received_before_address_validation +=
received_packet_size;
diff --git a/quic/core/quic_connection_id.cc b/quic/core/quic_connection_id.cc
index ea8b936..303db8f 100644
--- a/quic/core/quic_connection_id.cc
+++ b/quic/core/quic_connection_id.cc
@@ -68,7 +68,7 @@
return;
}
data_long_ = reinterpret_cast<char*>(malloc(length_));
- CHECK_NE(nullptr, data_long_);
+ QUICHE_CHECK_NE(nullptr, data_long_);
memcpy(data_long_, data, length_);
}
@@ -113,13 +113,13 @@
// Copy data from data_short_ to data_long_.
memcpy(temporary_data, data_short_, length_);
data_long_ = reinterpret_cast<char*>(malloc(length));
- CHECK_NE(nullptr, data_long_);
+ QUICHE_CHECK_NE(nullptr, data_long_);
memcpy(data_long_, temporary_data, length_);
} else {
// Resize data_long_.
char* realloc_result =
reinterpret_cast<char*>(realloc(data_long_, length));
- CHECK_NE(nullptr, realloc_result);
+ QUICHE_CHECK_NE(nullptr, realloc_result);
data_long_ = realloc_result;
}
} else if (length_ > sizeof(data_short_)) {
diff --git a/quic/core/quic_connection_id_manager.cc b/quic/core/quic_connection_id_manager.cc
index a4166ef..adf8eba 100644
--- a/quic/core/quic_connection_id_manager.cc
+++ b/quic/core/quic_connection_id_manager.cc
@@ -69,8 +69,8 @@
clock_(clock),
retire_connection_id_alarm_(alarm_factory->CreateAlarm(
new RetirePeerIssuedConnectionIdAlarm(visitor))) {
- DCHECK_GE(active_connection_id_limit_, 2u);
- DCHECK(!initial_peer_issued_connection_id.IsEmpty());
+ QUICHE_DCHECK_GE(active_connection_id_limit_, 2u);
+ QUICHE_DCHECK(!initial_peer_issued_connection_id.IsEmpty());
active_connection_id_data_.emplace_back(initial_peer_issued_connection_id,
/*sequence_number=*/0u,
QuicUint128());
@@ -294,7 +294,7 @@
QuicNewConnectionIdFrame
QuicSelfIssuedConnectionIdManager::IssueNewConnectionIdForPreferredAddress() {
QuicNewConnectionIdFrame frame = IssueNewConnectionId();
- DCHECK_EQ(frame.sequence_number, 1u);
+ QUICHE_DCHECK_EQ(frame.sequence_number, 1u);
return frame;
}
@@ -302,7 +302,7 @@
const QuicRetireConnectionIdFrame& frame,
QuicTime::Delta pto_delay,
std::string* error_detail) {
- DCHECK(!active_connection_ids_.empty());
+ QUICHE_DCHECK(!active_connection_ids_.empty());
if (frame.sequence_number > active_connection_ids_.back().second) {
*error_detail = "To be retired connecton ID is never issued.";
return IETF_QUIC_PROTOCOL_VIOLATION;
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index a32d9e4..b3a3d13 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -105,10 +105,10 @@
case ENCRYPTION_ZERO_RTT:
return ZERO_RTT_PROTECTED;
case ENCRYPTION_FORWARD_SECURE:
- DCHECK(false);
+ QUICHE_DCHECK(false);
return INVALID_PACKET_TYPE;
default:
- DCHECK(false);
+ QUICHE_DCHECK(false);
return INVALID_PACKET_TYPE;
}
}
@@ -295,7 +295,7 @@
QuicStreamOffset offset,
StreamSendingState state) {
ScopedPacketFlusher flusher(this);
- DCHECK(encryption_level >= ENCRYPTION_ZERO_RTT);
+ QUICHE_DCHECK(encryption_level >= ENCRYPTION_ZERO_RTT);
SetEncrypter(encryption_level, std::make_unique<TaggingEncrypter>(0x01));
SetDefaultEncryptionLevel(encryption_level);
struct iovec iov;
@@ -474,7 +474,7 @@
}
void PathDegradingTimeout() {
- DCHECK(PathDegradingDetectionInProgress());
+ QUICHE_DCHECK(PathDegradingDetectionInProgress());
GetBlackholeDetectorAlarm()->Fire();
}
@@ -511,8 +511,8 @@
if (QuicConnectionPeer::GetSentPacketManager(this)->pto_enabled()) {
// PTO mode is default enabled for T099. And TLP/RTO related tests are
// stale.
- DCHECK(PROTOCOL_TLS1_3 == version().handshake_protocol ||
- GetQuicReloadableFlag(quic_default_on_pto));
+ QUICHE_DCHECK(PROTOCOL_TLS1_3 == version().handshake_protocol ||
+ GetQuicReloadableFlag(quic_default_on_pto));
return true;
}
return false;
@@ -799,7 +799,7 @@
QuicSocketAddress self_address,
QuicSocketAddress peer_address,
EncryptionLevel level) {
- DCHECK(peer_framer_.HasEncrypterOfEncryptionLevel(level));
+ QUICHE_DCHECK(peer_framer_.HasEncrypterOfEncryptionLevel(level));
peer_creator_.set_encryption_level(level);
QuicPacketCreatorPeer::SetSendVersionInPacket(
&peer_creator_,
@@ -835,14 +835,14 @@
size_t length = peer_framer_.BuildDataPacket(
header, frames, encrypted_buffer, kMaxOutgoingPacketSize,
ENCRYPTION_INITIAL);
- DCHECK_GT(length, 0u);
+ QUICHE_DCHECK_GT(length, 0u);
const size_t encrypted_length = peer_framer_.EncryptInPlace(
ENCRYPTION_INITIAL, header.packet_number,
GetStartOfEncryptedData(peer_framer_.version().transport_version,
header),
length, kMaxOutgoingPacketSize, encrypted_buffer);
- DCHECK_GT(encrypted_length, 0u);
+ QUICHE_DCHECK_GT(encrypted_length, 0u);
connection_.ProcessUdpPacket(
kSelfAddress, kPeerAddress,
@@ -941,7 +941,8 @@
size_t encrypted_length = peer_framer_.EncryptPayload(
packet.level, QuicPacketNumber(packet.packet_number),
*constructed_packet, buffer, kMaxOutgoingPacketSize);
- DCHECK_LE(coalesced_size + encrypted_length, kMaxOutgoingPacketSize);
+ QUICHE_DCHECK_LE(coalesced_size + encrypted_length,
+ kMaxOutgoingPacketSize);
memcpy(coalesced_buffer + coalesced_size, buffer, encrypted_length);
coalesced_size += encrypted_length;
}
diff --git a/quic/core/quic_control_frame_manager.cc b/quic/core/quic_control_frame_manager.cc
index 31d67c3..64e5f5d 100644
--- a/quic/core/quic_control_frame_manager.cc
+++ b/quic/core/quic_control_frame_manager.cc
@@ -270,8 +270,8 @@
bool QuicControlFrameManager::RetransmitControlFrame(const QuicFrame& frame,
TransmissionType type) {
- DCHECK(type == PTO_RETRANSMISSION || type == RTO_RETRANSMISSION ||
- type == TLP_RETRANSMISSION || type == PROBING_RETRANSMISSION);
+ QUICHE_DCHECK(type == PTO_RETRANSMISSION || type == RTO_RETRANSMISSION ||
+ type == TLP_RETRANSMISSION || type == PROBING_RETRANSMISSION);
QuicControlFrameId id = GetControlFrameId(frame);
if (id == kInvalidControlFrameId) {
// Frame does not have a valid control frame ID, ignore it. Returns true
diff --git a/quic/core/quic_crypto_client_handshaker.cc b/quic/core/quic_crypto_client_handshaker.cc
index cebbc94..29a4367 100644
--- a/quic/core/quic_crypto_client_handshaker.cc
+++ b/quic/core/quic_crypto_client_handshaker.cc
@@ -167,12 +167,12 @@
}
void QuicCryptoClientHandshaker::OnHandshakeDoneReceived() {
- DCHECK(false);
+ QUICHE_DCHECK(false);
}
void QuicCryptoClientHandshaker::OnNewTokenReceived(
absl::string_view /*token*/) {
- DCHECK(false);
+ QUICHE_DCHECK(false);
}
size_t QuicCryptoClientHandshaker::BufferSizeLimitForLevel(
@@ -187,14 +187,14 @@
std::unique_ptr<QuicDecrypter>
QuicCryptoClientHandshaker::AdvanceKeysAndCreateCurrentOneRttDecrypter() {
// Key update is only defined in QUIC+TLS.
- DCHECK(false);
+ QUICHE_DCHECK(false);
return nullptr;
}
std::unique_ptr<QuicEncrypter>
QuicCryptoClientHandshaker::CreateCurrentOneRttEncrypter() {
// Key update is only defined in QUIC+TLS.
- DCHECK(false);
+ QUICHE_DCHECK(false);
return nullptr;
}
@@ -206,7 +206,7 @@
void QuicCryptoClientHandshaker::HandleServerConfigUpdateMessage(
const CryptoHandshakeMessage& server_config_update) {
- DCHECK(server_config_update.tag() == kSCUP);
+ QUICHE_DCHECK(server_config_update.tag() == kSCUP);
std::string error_details;
QuicCryptoClientConfig::CachedState* cached =
crypto_config_->LookupOrCreate(server_id_);
@@ -221,7 +221,7 @@
return;
}
- DCHECK(one_rtt_keys_available());
+ QUICHE_DCHECK(one_rtt_keys_available());
if (proof_verify_callback_) {
proof_verify_callback_->Cancel();
}
@@ -236,7 +236,7 @@
QuicAsyncStatus rv = QUIC_SUCCESS;
do {
- CHECK_NE(STATE_NONE, next_state_);
+ QUICHE_CHECK_NE(STATE_NONE, next_state_);
const State state = next_state_;
next_state_ = STATE_IDLE;
rv = QUIC_SUCCESS;
@@ -284,7 +284,7 @@
// This allows us to respond to CA trust changes or certificate
// expiration because it may have been a while since we last verified
// the proof.
- DCHECK(crypto_config_->proof_verifier());
+ QUICHE_DCHECK(crypto_config_->proof_verifier());
// Track proof verification time when cached server config is used.
proof_verify_start_time_ = session()->connection()->clock()->Now();
chlo_hash_ = cached->chlo_hash();
@@ -310,8 +310,8 @@
num_client_hellos_++;
CryptoHandshakeMessage out;
- DCHECK(session() != nullptr);
- DCHECK(session()->config() != nullptr);
+ QUICHE_DCHECK(session() != nullptr);
+ QUICHE_DCHECK(session()->config() != nullptr);
// Send all the options, regardless of whether we're sending an
// inchoate or subsequent hello.
session()->config()->ToHandshakeMessage(&out, session()->transport_version());
@@ -463,7 +463,7 @@
QuicAsyncStatus QuicCryptoClientHandshaker::DoVerifyProof(
QuicCryptoClientConfig::CachedState* cached) {
ProofVerifier* verifier = crypto_config_->proof_verifier();
- DCHECK(verifier);
+ QUICHE_DCHECK(verifier);
next_state_ = STATE_VERIFY_PROOF_COMPLETE;
generation_counter_ = cached->generation_counter();
@@ -614,7 +614,7 @@
bool update_ignored = false;
if (!cached->IsEmpty() && !cached->signature().empty()) {
// Note that we verify the proof even if the cached proof is valid.
- DCHECK(crypto_config_->proof_verifier());
+ QUICHE_DCHECK(crypto_config_->proof_verifier());
next_state_ = STATE_VERIFY_PROOF;
} else {
update_ignored = true;
diff --git a/quic/core/quic_crypto_client_stream.cc b/quic/core/quic_crypto_client_stream.cc
index 46af89a..3160f58 100644
--- a/quic/core/quic_crypto_client_stream.cc
+++ b/quic/core/quic_crypto_client_stream.cc
@@ -35,7 +35,8 @@
ProofHandler* proof_handler,
bool has_application_state)
: QuicCryptoClientStreamBase(session) {
- DCHECK_EQ(Perspective::IS_CLIENT, session->connection()->perspective());
+ QUICHE_DCHECK_EQ(Perspective::IS_CLIENT,
+ session->connection()->perspective());
switch (session->connection()->version().handshake_protocol) {
case PROTOCOL_QUIC_CRYPTO:
handshaker_ = std::make_unique<QuicCryptoClientHandshaker>(
@@ -149,13 +150,13 @@
}
std::string QuicCryptoClientStream::GetAddressToken() const {
- DCHECK(false);
+ QUICHE_DCHECK(false);
return "";
}
bool QuicCryptoClientStream::ValidateAddressToken(
absl::string_view /*token*/) const {
- DCHECK(false);
+ QUICHE_DCHECK(false);
return false;
}
diff --git a/quic/core/quic_crypto_server_stream.cc b/quic/core/quic_crypto_server_stream.cc
index acf28b7..fc9be17 100644
--- a/quic/core/quic_crypto_server_stream.cc
+++ b/quic/core/quic_crypto_server_stream.cc
@@ -126,8 +126,8 @@
CryptoUtils::HashHandshakeMessage(message, Perspective::IS_SERVER);
std::unique_ptr<ValidateCallback> cb(new ValidateCallback(this));
- DCHECK(validate_client_hello_cb_ == nullptr);
- DCHECK(process_client_hello_cb_ == nullptr);
+ QUICHE_DCHECK(validate_client_hello_cb_ == nullptr);
+ QUICHE_DCHECK(process_client_hello_cb_ == nullptr);
validate_client_hello_cb_ = cb.get();
crypto_config_->ValidateClientHello(
message, GetClientAddress(), session()->connection()->self_address(),
@@ -140,8 +140,8 @@
result,
std::unique_ptr<ProofSource::Details> details) {
// Clear the callback that got us here.
- DCHECK(validate_client_hello_cb_ != nullptr);
- DCHECK(process_client_hello_cb_ == nullptr);
+ QUICHE_DCHECK(validate_client_hello_cb_ != nullptr);
+ QUICHE_DCHECK(process_client_hello_cb_ == nullptr);
validate_client_hello_cb_ = nullptr;
std::unique_ptr<ProcessClientHelloCallback> cb(
@@ -159,8 +159,8 @@
std::unique_ptr<DiversificationNonce> diversification_nonce,
std::unique_ptr<ProofSource::Details> proof_source_details) {
// Clear the callback that got us here.
- DCHECK(process_client_hello_cb_ != nullptr);
- DCHECK(validate_client_hello_cb_ == nullptr);
+ QUICHE_DCHECK(process_client_hello_cb_ != nullptr);
+ QUICHE_DCHECK(validate_client_hello_cb_ == nullptr);
process_client_hello_cb_ = nullptr;
proof_source_details_ = std::move(proof_source_details);
@@ -276,7 +276,7 @@
bool ok,
const CryptoHandshakeMessage& message) {
// Clear the callback that got us here.
- DCHECK(send_server_config_update_cb_ != nullptr);
+ QUICHE_DCHECK(send_server_config_update_cb_ != nullptr);
send_server_config_update_cb_ = nullptr;
if (!ok) {
@@ -337,21 +337,21 @@
}
void QuicCryptoServerStream::OnHandshakeDoneReceived() {
- DCHECK(false);
+ QUICHE_DCHECK(false);
}
void QuicCryptoServerStream::OnNewTokenReceived(absl::string_view /*token*/) {
- DCHECK(false);
+ QUICHE_DCHECK(false);
}
std::string QuicCryptoServerStream::GetAddressToken() const {
- DCHECK(false);
+ QUICHE_DCHECK(false);
return "";
}
bool QuicCryptoServerStream::ValidateAddressToken(
absl::string_view /*token*/) const {
- DCHECK(false);
+ QUICHE_DCHECK(false);
return false;
}
@@ -428,14 +428,14 @@
std::unique_ptr<QuicDecrypter>
QuicCryptoServerStream::AdvanceKeysAndCreateCurrentOneRttDecrypter() {
// Key update is only defined in QUIC+TLS.
- DCHECK(false);
+ QUICHE_DCHECK(false);
return nullptr;
}
std::unique_ptr<QuicEncrypter>
QuicCryptoServerStream::CreateCurrentOneRttEncrypter() {
// Key update is only defined in QUIC+TLS.
- DCHECK(false);
+ QUICHE_DCHECK(false);
return nullptr;
}
diff --git a/quic/core/quic_crypto_server_stream_test.cc b/quic/core/quic_crypto_server_stream_test.cc
index 1d5ff65..88fdda9 100644
--- a/quic/core/quic_crypto_server_stream_test.cc
+++ b/quic/core/quic_crypto_server_stream_test.cc
@@ -90,7 +90,7 @@
helpers_.back().get(), alarm_factories_.back().get(),
&server_crypto_config_, &server_compressed_certs_cache_,
&server_connection_, &server_session);
- CHECK(server_session);
+ QUICHE_CHECK(server_session);
server_session_.reset(server_session);
EXPECT_CALL(*server_session_->helper(), CanAcceptClientHello(_, _, _, _, _))
.Times(testing::AnyNumber());
@@ -124,13 +124,13 @@
server_id_, QuicTime::Delta::FromSeconds(100000), supported_versions_,
helpers_.back().get(), alarm_factories_.back().get(),
&client_crypto_config_, &client_connection_, &client_session);
- CHECK(client_session);
+ QUICHE_CHECK(client_session);
client_session_.reset(client_session);
}
int CompleteCryptoHandshake() {
- CHECK(server_connection_);
- CHECK(server_session_ != nullptr);
+ QUICHE_CHECK(server_connection_);
+ QUICHE_CHECK(server_session_ != nullptr);
return crypto_test_utils::HandshakeWithFakeClient(
helpers_.back().get(), alarm_factories_.back().get(),
@@ -141,8 +141,8 @@
// Performs a single round of handshake message-exchange between the
// client and server.
void AdvanceHandshakeWithFakeClient() {
- CHECK(server_connection_);
- CHECK(client_session_ != nullptr);
+ QUICHE_CHECK(server_connection_);
+ QUICHE_CHECK(client_session_ != nullptr);
EXPECT_CALL(*client_session_, OnProofValid(_)).Times(testing::AnyNumber());
EXPECT_CALL(*client_session_, OnProofVerifyDetailsAvailable(_))
diff --git a/quic/core/quic_crypto_stream.cc b/quic/core/quic_crypto_stream.cc
index eccf4a3..1b2f6db 100644
--- a/quic/core/quic_crypto_stream.cc
+++ b/quic/core/quic_crypto_stream.cc
@@ -49,7 +49,8 @@
QuicByteCount QuicCryptoStream::CryptoMessageFramingOverhead(
QuicTransportVersion version,
QuicConnectionId connection_id) {
- DCHECK(QuicUtils::IsConnectionIdValidForVersion(connection_id, version));
+ QUICHE_DCHECK(
+ QuicUtils::IsConnectionIdValidForVersion(connection_id, version));
QuicVariableLengthIntegerLength retry_token_length_length =
VARIABLE_LENGTH_INTEGER_LENGTH_1;
QuicVariableLengthIntegerLength length_length =
@@ -312,7 +313,7 @@
QuicByteCount data_length,
bool /*fin*/,
TransmissionType type) {
- DCHECK(type == HANDSHAKE_RETRANSMISSION || type == PTO_RETRANSMISSION);
+ QUICHE_DCHECK(type == HANDSHAKE_RETRANSMISSION || type == PTO_RETRANSMISSION);
QuicIntervalSet<QuicStreamOffset> retransmission(offset,
offset + data_length);
// Determine the encryption level to send data. This only needs to be once as
@@ -345,7 +346,7 @@
QuicByteCount retransmission_length,
EncryptionLevel encryption_level,
TransmissionType type) {
- DCHECK(type == HANDSHAKE_RETRANSMISSION || type == PTO_RETRANSMISSION);
+ QUICHE_DCHECK(type == HANDSHAKE_RETRANSMISSION || type == PTO_RETRANSMISSION);
const auto consumed = stream_delegate()->WritevData(
id(), retransmission_length, retransmission_offset, NO_FIN, type,
encryption_level);
@@ -446,7 +447,8 @@
<< "Versions less than 47 don't use CRYPTO frames";
for (EncryptionLevel level : AllEncryptionLevels()) {
const QuicStreamSendBuffer& send_buffer = substreams_[level].send_buffer;
- DCHECK_GE(send_buffer.stream_offset(), send_buffer.stream_bytes_written());
+ QUICHE_DCHECK_GE(send_buffer.stream_offset(),
+ send_buffer.stream_bytes_written());
if (send_buffer.stream_offset() > send_buffer.stream_bytes_written()) {
return true;
}
diff --git a/quic/core/quic_data_reader.cc b/quic/core/quic_data_reader.cc
index 761b92c..d15dd6e 100644
--- a/quic/core/quic_data_reader.cc
+++ b/quic/core/quic_data_reader.cc
@@ -45,16 +45,16 @@
// After the fast pass, the exponent is at least one (offset by one).
// Un-offset the exponent.
--exponent;
- DCHECK_GE(exponent, 1);
- DCHECK_LE(exponent, kUFloat16MaxExponent);
+ QUICHE_DCHECK_GE(exponent, 1);
+ QUICHE_DCHECK_LE(exponent, kUFloat16MaxExponent);
// Here we need to clear the exponent and set the hidden bit. We have already
// decremented the exponent, so when we subtract it, it leaves behind the
// hidden bit.
*result -= exponent << kUFloat16MantissaBits;
*result <<= exponent;
- DCHECK_GE(*result,
- static_cast<uint64_t>(1 << kUFloat16MantissaEffectiveBits));
- DCHECK_LE(*result, kUFloat16MaxValue);
+ QUICHE_DCHECK_GE(*result,
+ static_cast<uint64_t>(1 << kUFloat16MantissaEffectiveBits));
+ QUICHE_DCHECK_LE(*result, kUFloat16MaxValue);
return true;
}
@@ -72,7 +72,7 @@
connection_id->set_length(length);
const bool ok =
ReadBytes(connection_id->mutable_data(), connection_id->length());
- DCHECK(ok);
+ QUICHE_DCHECK(ok);
return ok;
}
@@ -86,7 +86,7 @@
}
QuicVariableLengthIntegerLength QuicDataReader::PeekVarInt62Length() {
- DCHECK_EQ(endianness(), quiche::NETWORK_BYTE_ORDER);
+ QUICHE_DCHECK_EQ(endianness(), quiche::NETWORK_BYTE_ORDER);
const unsigned char* next =
reinterpret_cast<const unsigned char*>(data() + pos());
if (BytesRemaining() == 0) {
@@ -113,7 +113,7 @@
// Low-level optimization is useful here because this function will be
// called frequently, leading to outsize benefits.
bool QuicDataReader::ReadVarInt62(uint64_t* result) {
- DCHECK_EQ(endianness(), quiche::NETWORK_BYTE_ORDER);
+ QUICHE_DCHECK_EQ(endianness(), quiche::NETWORK_BYTE_ORDER);
size_t remaining = BytesRemaining();
const unsigned char* next =
diff --git a/quic/core/quic_data_writer.cc b/quic/core/quic_data_writer.cc
index 78db03f..39cbc5a 100644
--- a/quic/core/quic_data_writer.cc
+++ b/quic/core/quic_data_writer.cc
@@ -52,10 +52,10 @@
}
}
- DCHECK_GE(exponent, 1);
- DCHECK_LE(exponent, kUFloat16MaxExponent);
- DCHECK_GE(value, UINT64_C(1) << kUFloat16MantissaBits);
- DCHECK_LT(value, UINT64_C(1) << kUFloat16MantissaEffectiveBits);
+ QUICHE_DCHECK_GE(exponent, 1);
+ QUICHE_DCHECK_LE(exponent, kUFloat16MaxExponent);
+ QUICHE_DCHECK_GE(value, UINT64_C(1) << kUFloat16MantissaBits);
+ QUICHE_DCHECK_LT(value, UINT64_C(1) << kUFloat16MantissaEffectiveBits);
// Hidden bit (position 11) is set. We should remove it and increment the
// exponent. Equivalently, we just add it to the exponent.
@@ -111,7 +111,7 @@
// Low-level optimization is useful here because this function will be
// called frequently, leading to outsize benefits.
bool QuicDataWriter::WriteVarInt62(uint64_t value) {
- DCHECK_EQ(endianness(), quiche::NETWORK_BYTE_ORDER);
+ QUICHE_DCHECK_EQ(endianness(), quiche::NETWORK_BYTE_ORDER);
size_t remaining_bytes = remaining();
char* next = buffer() + length();
@@ -182,7 +182,7 @@
bool QuicDataWriter::WriteVarInt62(
uint64_t value,
QuicVariableLengthIntegerLength write_length) {
- DCHECK_EQ(endianness(), quiche::NETWORK_BYTE_ORDER);
+ QUICHE_DCHECK_EQ(endianness(), quiche::NETWORK_BYTE_ORDER);
size_t remaining_bytes = remaining();
if (remaining_bytes < write_length) {
diff --git a/quic/core/quic_default_packet_writer.cc b/quic/core/quic_default_packet_writer.cc
index fe230d0..e71169a 100644
--- a/quic/core/quic_default_packet_writer.cc
+++ b/quic/core/quic_default_packet_writer.cc
@@ -19,8 +19,8 @@
const QuicIpAddress& self_address,
const QuicSocketAddress& peer_address,
PerPacketOptions* options) {
- DCHECK(!write_blocked_);
- DCHECK(nullptr == options)
+ QUICHE_DCHECK(!write_blocked_);
+ QUICHE_DCHECK(nullptr == options)
<< "QuicDefaultPacketWriter does not accept any options.";
QuicUdpPacketInfo packet_info;
packet_info.SetPeerAddress(peer_address);
diff --git a/quic/core/quic_dispatcher.cc b/quic/core/quic_dispatcher.cc
index 75f665a..d0d44b6 100644
--- a/quic/core/quic_dispatcher.cc
+++ b/quic/core/quic_dispatcher.cc
@@ -82,12 +82,12 @@
bool ShouldGeneratePacket(HasRetransmittableData /*retransmittable*/,
IsHandshake /*handshake*/) override {
- DCHECK(false);
+ QUICHE_DCHECK(false);
return true;
}
const QuicFrames MaybeBundleAckOpportunistically() override {
- DCHECK(false);
+ QUICHE_DCHECK(false);
return {};
}
@@ -181,7 +181,7 @@
return;
}
creator_.FlushCurrentPacket();
- DCHECK_EQ(1u, collector_.packets()->size());
+ QUICHE_DCHECK_EQ(1u, collector_.packets()->size());
}
QuicConnectionId server_connection_id_;
@@ -347,7 +347,7 @@
}
void QuicDispatcher::InitializeWithWriter(QuicPacketWriter* writer) {
- DCHECK(writer_ == nullptr);
+ QUICHE_DCHECK(writer_ == nullptr);
writer_.reset(writer);
time_wait_list_manager_.reset(CreateQuicTimeWaitListManager());
}
@@ -424,24 +424,27 @@
if (server_connection_id_length == expected_server_connection_id_length_) {
return server_connection_id;
}
- DCHECK(version.AllowsVariableLengthConnectionIds());
+ QUICHE_DCHECK(version.AllowsVariableLengthConnectionIds());
QuicConnectionId new_connection_id;
if (server_connection_id_length < expected_server_connection_id_length_) {
new_connection_id = ReplaceShortServerConnectionId(
version, server_connection_id, expected_server_connection_id_length_);
// Verify that ReplaceShortServerConnectionId is deterministic.
- DCHECK_EQ(new_connection_id, ReplaceShortServerConnectionId(
- version, server_connection_id,
- expected_server_connection_id_length_));
+ QUICHE_DCHECK_EQ(
+ new_connection_id,
+ ReplaceShortServerConnectionId(version, server_connection_id,
+ expected_server_connection_id_length_));
} else {
new_connection_id = ReplaceLongServerConnectionId(
version, server_connection_id, expected_server_connection_id_length_);
// Verify that ReplaceLongServerConnectionId is deterministic.
- DCHECK_EQ(new_connection_id, ReplaceLongServerConnectionId(
- version, server_connection_id,
- expected_server_connection_id_length_));
+ QUICHE_DCHECK_EQ(
+ new_connection_id,
+ ReplaceLongServerConnectionId(version, server_connection_id,
+ expected_server_connection_id_length_));
}
- DCHECK_EQ(expected_server_connection_id_length_, new_connection_id.length());
+ QUICHE_DCHECK_EQ(expected_server_connection_id_length_,
+ new_connection_id.length());
QUIC_DLOG(INFO) << "Replacing incoming connection ID " << server_connection_id
<< " with " << new_connection_id;
@@ -452,8 +455,8 @@
const ParsedQuicVersion& /*version*/,
const QuicConnectionId& server_connection_id,
uint8_t expected_server_connection_id_length) const {
- DCHECK_LT(server_connection_id.length(),
- expected_server_connection_id_length);
+ QUICHE_DCHECK_LT(server_connection_id.length(),
+ expected_server_connection_id_length);
return QuicUtils::CreateReplacementConnectionId(
server_connection_id, expected_server_connection_id_length);
}
@@ -462,8 +465,8 @@
const ParsedQuicVersion& /*version*/,
const QuicConnectionId& server_connection_id,
uint8_t expected_server_connection_id_length) const {
- DCHECK_GT(server_connection_id.length(),
- expected_server_connection_id_length);
+ QUICHE_DCHECK_GT(server_connection_id.length(),
+ expected_server_connection_id_length);
return QuicUtils::CreateReplacementConnectionId(
server_connection_id, expected_server_connection_id_length);
}
@@ -490,8 +493,8 @@
server_connection_id.length() < kQuicMinimumInitialConnectionIdLength &&
server_connection_id.length() < expected_server_connection_id_length_ &&
!allow_short_initial_server_connection_ids_) {
- DCHECK(packet_info.version_flag);
- DCHECK(packet_info.version.AllowsVariableLengthConnectionIds());
+ QUICHE_DCHECK(packet_info.version_flag);
+ QUICHE_DCHECK(packet_info.version.AllowsVariableLengthConnectionIds());
QUIC_DLOG(INFO) << "Packet with short destination connection ID "
<< server_connection_id << " expected "
<< static_cast<int>(expected_server_connection_id_length_);
@@ -505,7 +508,8 @@
if (use_reference_counted_session_map_) {
auto it = reference_counted_session_map_.find(server_connection_id);
if (it != reference_counted_session_map_.end()) {
- DCHECK(!buffered_packets_.HasBufferedPackets(server_connection_id));
+ QUICHE_DCHECK(
+ !buffered_packets_.HasBufferedPackets(server_connection_id));
if (packet_info.version_flag &&
packet_info.version != it->second->version() &&
packet_info.version == LegacyVersionForEncapsulation()) {
@@ -530,7 +534,8 @@
} else {
auto it = session_map_.find(server_connection_id);
if (it != session_map_.end()) {
- DCHECK(!buffered_packets_.HasBufferedPackets(server_connection_id));
+ QUICHE_DCHECK(
+ !buffered_packets_.HasBufferedPackets(server_connection_id));
if (packet_info.version_flag &&
packet_info.version != it->second->version() &&
packet_info.version == LegacyVersionForEncapsulation()) {
@@ -567,7 +572,8 @@
// Search for the replacement.
auto it2 = reference_counted_session_map_.find(replaced_connection_id);
if (it2 != reference_counted_session_map_.end()) {
- DCHECK(!buffered_packets_.HasBufferedPackets(replaced_connection_id));
+ QUICHE_DCHECK(
+ !buffered_packets_.HasBufferedPackets(replaced_connection_id));
it2->second->ProcessUdpPacket(packet_info.self_address,
packet_info.peer_address,
packet_info.packet);
@@ -577,7 +583,8 @@
// Search for the replacement.
auto it2 = session_map_.find(replaced_connection_id);
if (it2 != session_map_.end()) {
- DCHECK(!buffered_packets_.HasBufferedPackets(replaced_connection_id));
+ QUICHE_DCHECK(
+ !buffered_packets_.HasBufferedPackets(replaced_connection_id));
it2->second->ProcessUdpPacket(packet_info.self_address,
packet_info.peer_address,
packet_info.packet);
@@ -748,7 +755,7 @@
QUIC_HANDSHAKE_FAILED, "Reject connection",
quic::QuicTimeWaitListManager::SEND_STATELESS_RESET);
- DCHECK(time_wait_list_manager_->IsConnectionIdInTimeWait(
+ QUICHE_DCHECK(time_wait_list_manager_->IsConnectionIdInTimeWait(
server_connection_id));
time_wait_list_manager_->ProcessPacket(
packet_info->self_address, packet_info->peer_address,
@@ -884,7 +891,7 @@
// Get a snapshot of all sessions.
std::vector<std::shared_ptr<QuicSession>> QuicDispatcher::GetSessionsSnapshot()
const {
- DCHECK(use_reference_counted_session_map_);
+ QUICHE_DCHECK(use_reference_counted_session_map_);
std::vector<std::shared_ptr<QuicSession>> snapshot;
snapshot.reserve(reference_counted_session_map_.size());
absl::flat_hash_set<QuicSession*> visited_session;
@@ -937,7 +944,7 @@
const size_t num_blocked_writers_before = write_blocked_list_.size();
WriteBlockedList temp_list;
temp_list.swap(write_blocked_list_);
- DCHECK(write_blocked_list_.empty());
+ QUICHE_DCHECK(write_blocked_list_.empty());
// Give each blocked writer a chance to write what they indended to write.
// If they are blocked again, they will call |OnWriteBlocked| to add
@@ -970,8 +977,9 @@
QUIC_PEER_GOING_AWAY, "Server shutdown imminent",
ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
// Validate that the session removes itself from the session map on close.
- DCHECK(reference_counted_session_map_.empty() ||
- reference_counted_session_map_.begin()->second.get() != session);
+ QUICHE_DCHECK(reference_counted_session_map_.empty() ||
+ reference_counted_session_map_.begin()->second.get() !=
+ session);
}
} else {
while (!session_map_.empty()) {
@@ -980,8 +988,8 @@
QUIC_PEER_GOING_AWAY, "Server shutdown imminent",
ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
// Validate that the session removes itself from the session map on close.
- DCHECK(session_map_.empty() ||
- session_map_.begin()->second.get() != session);
+ QUICHE_DCHECK(session_map_.empty() ||
+ session_map_.begin()->second.get() != session);
}
}
DeleteSessions();
@@ -1062,7 +1070,7 @@
QuicBlockedWriterInterface* blocked_writer) {
if (!blocked_writer->IsWriterBlocked()) {
// It is a programming error if this ever happens. When we are sure it is
- // not happening, replace it with a DCHECK.
+ // not happening, replace it with a QUICHE_DCHECK.
QUIC_BUG
<< "Tried to add writer into blocked list when it shouldn't be added";
// Return without adding the connection to the blocked list, to avoid
@@ -1081,7 +1089,7 @@
void QuicDispatcher::OnNewConnectionIdSent(
const QuicConnectionId& server_connection_id,
const QuicConnectionId& new_connection_id) {
- DCHECK(support_multiple_cid_per_connection_);
+ QUICHE_DCHECK(support_multiple_cid_per_connection_);
auto it = reference_counted_session_map_.find(server_connection_id);
if (it == reference_counted_session_map_.end()) {
QUIC_BUG << "Couldn't locate the session that issues the connection ID in "
@@ -1092,12 +1100,12 @@
}
auto insertion_result = reference_counted_session_map_.insert(
std::make_pair(new_connection_id, it->second));
- DCHECK(insertion_result.second);
+ QUICHE_DCHECK(insertion_result.second);
}
void QuicDispatcher::OnConnectionIdRetired(
const QuicConnectionId& server_connection_id) {
- DCHECK(support_multiple_cid_per_connection_);
+ QUICHE_DCHECK(support_multiple_cid_per_connection_);
reference_counted_session_map_.erase(server_connection_id);
}
@@ -1405,7 +1413,7 @@
void QuicDispatcher::MaybeResetPacketsWithNoVersion(
const ReceivedPacketInfo& packet_info) {
- DCHECK(!packet_info.version_flag);
+ QUICHE_DCHECK(!packet_info.version_flag);
const size_t MinValidPacketLength =
kPacketHeaderTypeSize + expected_server_connection_id_length_ +
PACKET_1BYTE_PACKET_NUMBER + /*payload size=*/1 + /*tag size=*/12;
diff --git a/quic/core/quic_dispatcher_test.cc b/quic/core/quic_dispatcher_test.cc
index ba2c6ea..26742d7 100644
--- a/quic/core/quic_dispatcher_test.cc
+++ b/quic/core/quic_dispatcher_test.cc
@@ -198,7 +198,7 @@
void RetireConnectionId(QuicConnectionId id) {
auto it = std::find(active_connection_ids_.begin(),
active_connection_ids_.end(), id);
- DCHECK(it != active_connection_ids_.end());
+ QUICHE_DCHECK(it != active_connection_ids_.end());
dispatcher_->OnConnectionIdRetired(id);
active_connection_ids_.erase(it);
}
@@ -800,9 +800,9 @@
std::string chlo = SerializeCHLO() + std::string(1200, 'a');
// Truncate to 1100 bytes of payload which results in a packet just
// under 1200 bytes after framing, packet, and encryption overhead.
- DCHECK_LE(1200u, chlo.length());
+ QUICHE_DCHECK_LE(1200u, chlo.length());
std::string truncated_chlo = chlo.substr(0, 1100);
- DCHECK_EQ(1100u, truncated_chlo.length());
+ QUICHE_DCHECK_EQ(1100u, truncated_chlo.length());
ProcessPacket(client_address, TestConnectionId(1), true,
QuicVersionReservedForNegotiation(), truncated_chlo, false,
CONNECTION_ID_PRESENT, PACKET_4BYTE_PACKET_NUMBER, 1);
@@ -824,9 +824,9 @@
std::string chlo = SerializeCHLO() + std::string(1200, 'a');
// Truncate to 1100 bytes of payload which results in a packet just
// under 1200 bytes after framing, packet, and encryption overhead.
- DCHECK_LE(1200u, chlo.length());
+ QUICHE_DCHECK_LE(1200u, chlo.length());
std::string truncated_chlo = chlo.substr(0, 1100);
- DCHECK_EQ(1100u, truncated_chlo.length());
+ QUICHE_DCHECK_EQ(1100u, truncated_chlo.length());
ProcessPacket(client_address, TestConnectionId(1), true,
QuicVersionReservedForNegotiation(), truncated_chlo, true,
CONNECTION_ID_PRESENT, PACKET_4BYTE_PACKET_NUMBER, 1);
diff --git a/quic/core/quic_epoll_alarm_factory.cc b/quic/core/quic_epoll_alarm_factory.cc
index 9f39f82..2a08868 100644
--- a/quic/core/quic_epoll_alarm_factory.cc
+++ b/quic/core/quic_epoll_alarm_factory.cc
@@ -21,18 +21,18 @@
protected:
void SetImpl() override {
- DCHECK(deadline().IsInitialized());
+ QUICHE_DCHECK(deadline().IsInitialized());
epoll_server_->RegisterAlarm(
(deadline() - QuicTime::Zero()).ToMicroseconds(), &epoll_alarm_impl_);
}
void CancelImpl() override {
- DCHECK(!deadline().IsInitialized());
+ QUICHE_DCHECK(!deadline().IsInitialized());
epoll_alarm_impl_.UnregisterIfRegistered();
}
void UpdateImpl() override {
- DCHECK(deadline().IsInitialized());
+ QUICHE_DCHECK(deadline().IsInitialized());
int64_t epoll_deadline = (deadline() - QuicTime::Zero()).ToMicroseconds();
if (epoll_alarm_impl_.registered()) {
epoll_alarm_impl_.ReregisterAlarm(epoll_deadline);
diff --git a/quic/core/quic_epoll_connection_helper.cc b/quic/core/quic_epoll_connection_helper.cc
index f44566f..8f53256 100644
--- a/quic/core/quic_epoll_connection_helper.cc
+++ b/quic/core/quic_epoll_connection_helper.cc
@@ -32,7 +32,7 @@
if (allocator_type_ == QuicAllocator::BUFFER_POOL) {
return &stream_buffer_allocator_;
} else {
- DCHECK(allocator_type_ == QuicAllocator::SIMPLE);
+ QUICHE_DCHECK(allocator_type_ == QuicAllocator::SIMPLE);
return &simple_buffer_allocator_;
}
}
diff --git a/quic/core/quic_error_codes.cc b/quic/core/quic_error_codes.cc
index cc050dd..dd8be33 100644
--- a/quic/core/quic_error_codes.cc
+++ b/quic/core/quic_error_codes.cc
@@ -313,7 +313,7 @@
// change behavior and are only here to make the compiler happy.
case CRYPTO_ERROR_FIRST:
case CRYPTO_ERROR_LAST:
- DCHECK(false) << "Unexpected error " << static_cast<uint64_t>(c);
+ QUICHE_DCHECK(false) << "Unexpected error " << static_cast<uint64_t>(c);
break;
}
diff --git a/quic/core/quic_flow_controller.cc b/quic/core/quic_flow_controller.cc
index b8bbda2..01fb72c 100644
--- a/quic/core/quic_flow_controller.cc
+++ b/quic/core/quic_flow_controller.cc
@@ -53,8 +53,8 @@
session_flow_controller_(session_flow_controller),
last_blocked_send_window_offset_(0),
prev_window_update_time_(QuicTime::Zero()) {
- DCHECK_LE(receive_window_size_, receive_window_size_limit_);
- DCHECK_EQ(
+ QUICHE_DCHECK_LE(receive_window_size_, receive_window_size_limit_);
+ QUICHE_DCHECK_EQ(
is_connection_flow_controller_,
QuicUtils::GetInvalidStreamId(session_->transport_version()) == id_);
@@ -198,7 +198,7 @@
// Send WindowUpdate to increase receive window if
// (receive window offset - consumed bytes) < (max window / 2).
// This is behaviour copied from SPDY.
- DCHECK_LE(bytes_consumed_, receive_window_offset_);
+ QUICHE_DCHECK_LE(bytes_consumed_, receive_window_offset_);
QuicStreamOffset available_window = receive_window_offset_ - bytes_consumed_;
QuicByteCount threshold = WindowUpdateThreshold();
@@ -294,7 +294,7 @@
}
void QuicFlowController::UpdateReceiveWindowSize(QuicStreamOffset size) {
- DCHECK_LE(size, receive_window_size_limit_);
+ QUICHE_DCHECK_LE(size, receive_window_size_limit_);
QUIC_DVLOG(1) << ENDPOINT << "UpdateReceiveWindowSize for " << LogLabel()
<< ": " << size;
if (receive_window_size_ != receive_window_offset_) {
diff --git a/quic/core/quic_framer.cc b/quic/core/quic_framer.cc
index af85f12..60f069c 100644
--- a/quic/core/quic_framer.cc
+++ b/quic/core/quic_framer.cc
@@ -194,7 +194,7 @@
}
QuicPacketNumberLength GetShortHeaderPacketNumberLength(uint8_t type) {
- DCHECK(!(type & FLAGS_LONG_HEADER));
+ QUICHE_DCHECK(!(type & FLAGS_LONG_HEADER));
return static_cast<QuicPacketNumberLength>((type & 0x03) + 1);
}
@@ -217,7 +217,7 @@
}
bool GetLongHeaderType(uint8_t type, QuicLongHeaderType* long_header_type) {
- DCHECK((type & FLAGS_LONG_HEADER));
+ QUICHE_DCHECK((type & FLAGS_LONG_HEADER));
switch ((type & 0x30) >> 4) {
case 0:
*long_header_type = INITIAL;
@@ -429,9 +429,9 @@
peer_ack_delay_exponent_(kDefaultAckDelayExponent),
local_ack_delay_exponent_(kDefaultAckDelayExponent),
current_received_frame_type_(0) {
- DCHECK(!supported_versions.empty());
+ QUICHE_DCHECK(!supported_versions.empty());
version_ = supported_versions_[0];
- DCHECK(version_.IsKnown())
+ QUICHE_DCHECK(version_.IsKnown())
<< ParsedQuicVersionVectorToString(supported_versions_);
}
@@ -704,12 +704,12 @@
case MESSAGE_FRAME:
case CRYPTO_FRAME:
case NUM_FRAME_TYPES:
- DCHECK(false);
+ QUICHE_DCHECK(false);
return 0;
}
// Not reachable, but some Chrome compilers can't figure that out. *sigh*
- DCHECK(false);
+ QUICHE_DCHECK(false);
return 0;
}
@@ -1310,7 +1310,7 @@
const ParsedQuicVersionVector& versions) {
QUIC_CODE_COUNT(quic_build_version_negotiation);
if (use_length_prefix) {
- DCHECK(ietf_quic);
+ QUICHE_DCHECK(ietf_quic);
QUIC_CODE_COUNT(quic_build_version_negotiation_ietf);
} else if (ietf_quic) {
QUIC_CODE_COUNT(quic_build_version_negotiation_old_ietf);
@@ -1346,11 +1346,11 @@
}
// The GQUIC encoding does not support encoding client connection IDs.
- DCHECK(client_connection_id.IsEmpty());
+ QUICHE_DCHECK(client_connection_id.IsEmpty());
// The GQUIC encoding does not support length-prefixed connection IDs.
- DCHECK(!use_length_prefix);
+ QUICHE_DCHECK(!use_length_prefix);
- DCHECK(!wire_versions.empty());
+ QUICHE_DCHECK(!wire_versions.empty());
size_t len = kPublicFlagsSize + server_connection_id.length() +
wire_versions.size() * kQuicVersionSize;
std::unique_ptr<char[]> buffer(new char[len]);
@@ -1389,7 +1389,7 @@
<< server_connection_id << " client_connection_id "
<< client_connection_id << " versions "
<< ParsedQuicVersionVectorToString(versions);
- DCHECK(!versions.empty());
+ QUICHE_DCHECK(!versions.empty());
size_t len = kPacketHeaderTypeSize + kConnectionIdLengthSize +
client_connection_id.length() + server_connection_id.length() +
(versions.size() + 1) * kQuicVersionSize;
@@ -1450,10 +1450,10 @@
QuicPacketHeader header;
if (!ProcessPublicHeader(&reader, packet_has_ietf_packet_header, &header)) {
- DCHECK_NE("", detailed_error_);
+ QUICHE_DCHECK_NE("", detailed_error_);
QUIC_DVLOG(1) << ENDPOINT << "Unable to process public header. Error: "
<< detailed_error_;
- DCHECK_NE("", detailed_error_);
+ QUICHE_DCHECK_NE("", detailed_error_);
RecordDroppedPacketReason(DroppedPacketReason::INVALID_PUBLIC_HEADER);
return RaiseError(QUIC_INVALID_PACKET_HEADER);
}
@@ -1526,7 +1526,7 @@
bool QuicFramer::ProcessVersionNegotiationPacket(
QuicDataReader* reader,
const QuicPacketHeader& header) {
- DCHECK_EQ(Perspective::IS_CLIENT, perspective_);
+ QUICHE_DCHECK_EQ(Perspective::IS_CLIENT, perspective_);
QuicVersionNegotiationPacket packet(
GetServerConnectionIdAsRecipient(header, perspective_));
@@ -1554,14 +1554,14 @@
bool QuicFramer::ProcessRetryPacket(QuicDataReader* reader,
const QuicPacketHeader& header) {
- DCHECK_EQ(Perspective::IS_CLIENT, perspective_);
+ QUICHE_DCHECK_EQ(Perspective::IS_CLIENT, perspective_);
if (drop_incoming_retry_packets_) {
QUIC_DLOG(INFO) << "Ignoring received RETRY packet";
return true;
}
if (version_.UsesTls()) {
- DCHECK(version_.HasLengthPrefixedConnectionIds()) << version_;
+ QUICHE_DCHECK(version_.HasLengthPrefixedConnectionIds()) << version_;
const size_t bytes_remaining = reader->BytesRemaining();
if (bytes_remaining <= kRetryIntegrityTagLength) {
set_detailed_error("Retry packet too short to parse integrity tag.");
@@ -1569,7 +1569,7 @@
}
const size_t retry_token_length =
bytes_remaining - kRetryIntegrityTagLength;
- DCHECK_GT(retry_token_length, 0u);
+ QUICHE_DCHECK_GT(retry_token_length, 0u);
absl::string_view retry_token;
if (!reader->ReadStringPiece(&retry_token, retry_token_length)) {
set_detailed_error("Failed to read retry token.");
@@ -1577,7 +1577,7 @@
}
absl::string_view retry_without_tag = reader->PreviouslyReadPayload();
absl::string_view integrity_tag = reader->ReadRemainingPayload();
- DCHECK_EQ(integrity_tag.length(), kRetryIntegrityTagLength);
+ QUICHE_DCHECK_EQ(integrity_tag.length(), kRetryIntegrityTagLength);
visitor_->OnRetryPacket(EmptyQuicConnectionId(),
header.source_connection_id, retry_token,
integrity_tag, retry_without_tag);
@@ -1634,7 +1634,7 @@
}
absl::string_view remaining_data = encrypted_reader.PeekRemainingPayload();
- DCHECK_EQ(remaining_data.length(), remaining_bytes_length);
+ QUICHE_DCHECK_EQ(remaining_data.length(), remaining_bytes_length);
const char* coalesced_data =
remaining_data.data() + header.remaining_packet_length;
@@ -1708,8 +1708,8 @@
const QuicEncryptedPacket& packet,
char* decrypted_buffer,
size_t buffer_length) {
- DCHECK_NE(GOOGLE_QUIC_PACKET, header->form);
- DCHECK(!header->has_possible_stateless_reset_token);
+ QUICHE_DCHECK_NE(GOOGLE_QUIC_PACKET, header->form);
+ QUICHE_DCHECK(!header->has_possible_stateless_reset_token);
header->length_length = VARIABLE_LENGTH_INTEGER_LENGTH_0;
header->remaining_packet_length = 0;
if (header->form == IETF_QUIC_SHORT_HEADER_PACKET &&
@@ -1735,10 +1735,10 @@
QuicPacketNumber base_packet_number;
if (header->form == IETF_QUIC_SHORT_HEADER_PACKET ||
header->long_packet_type != VERSION_NEGOTIATION) {
- DCHECK(header->form == IETF_QUIC_SHORT_HEADER_PACKET ||
- header->long_packet_type == INITIAL ||
- header->long_packet_type == HANDSHAKE ||
- header->long_packet_type == ZERO_RTT_PROTECTED);
+ QUICHE_DCHECK(header->form == IETF_QUIC_SHORT_HEADER_PACKET ||
+ header->long_packet_type == INITIAL ||
+ header->long_packet_type == HANDSHAKE ||
+ header->long_packet_type == ZERO_RTT_PROTECTED);
// Process packet number.
if (supports_multiple_packet_number_spaces_) {
PacketNumberSpace pn_space = GetPacketNumberSpace(*header);
@@ -1889,8 +1889,9 @@
current_received_frame_type_ = 0;
if (!ProcessIetfFrameData(&reader, *header)) {
current_received_frame_type_ = 0;
- DCHECK_NE(QUIC_NO_ERROR, error_); // ProcessIetfFrameData sets the error.
- DCHECK_NE("", detailed_error_);
+ QUICHE_DCHECK_NE(QUIC_NO_ERROR,
+ error_); // ProcessIetfFrameData sets the error.
+ QUICHE_DCHECK_NE("", detailed_error_);
QUIC_DLOG(WARNING) << ENDPOINT << "Unable to process frame data. Error: "
<< detailed_error_;
return false;
@@ -1898,8 +1899,9 @@
current_received_frame_type_ = 0;
} else {
if (!ProcessFrameData(&reader, *header)) {
- DCHECK_NE(QUIC_NO_ERROR, error_); // ProcessFrameData sets the error.
- DCHECK_NE("", detailed_error_);
+ QUICHE_DCHECK_NE(QUIC_NO_ERROR,
+ error_); // ProcessFrameData sets the error.
+ QUICHE_DCHECK_NE("", detailed_error_);
QUIC_DLOG(WARNING) << ENDPOINT << "Unable to process frame data. Error: "
<< detailed_error_;
return false;
@@ -1916,7 +1918,7 @@
char* decrypted_buffer,
size_t buffer_length) {
if (!ProcessUnauthenticatedHeader(encrypted_reader, header)) {
- DCHECK_NE("", detailed_error_);
+ QUICHE_DCHECK_NE("", detailed_error_);
QUIC_DVLOG(1)
<< ENDPOINT
<< "Unable to process packet header. Stopping parsing. Error: "
@@ -1977,8 +1979,9 @@
// Handle the payload.
if (!ProcessFrameData(&reader, *header)) {
- DCHECK_NE(QUIC_NO_ERROR, error_); // ProcessFrameData sets the error.
- DCHECK_NE("", detailed_error_);
+ QUICHE_DCHECK_NE(QUIC_NO_ERROR,
+ error_); // ProcessFrameData sets the error.
+ QUICHE_DCHECK_NE("", detailed_error_);
QUIC_DLOG(WARNING) << ENDPOINT << "Unable to process frame data. Error: "
<< detailed_error_;
return false;
@@ -2079,7 +2082,7 @@
if (HasEncrypterOfEncryptionLevel(ENCRYPTION_FORWARD_SECURE)) {
return ENCRYPTION_FORWARD_SECURE;
}
- DCHECK(HasEncrypterOfEncryptionLevel(ENCRYPTION_ZERO_RTT));
+ QUICHE_DCHECK(HasEncrypterOfEncryptionLevel(ENCRYPTION_ZERO_RTT));
return ENCRYPTION_ZERO_RTT;
}
@@ -2102,7 +2105,7 @@
<< kPublicHeaderSequenceNumberShift;
if (header.nonce != nullptr) {
- DCHECK_EQ(Perspective::IS_SERVER, perspective_);
+ QUICHE_DCHECK_EQ(Perspective::IS_SERVER, perspective_);
public_flags |= PACKET_PUBLIC_FLAGS_NONCE;
}
@@ -2110,8 +2113,8 @@
GetServerConnectionIdAsSender(header, perspective_);
QuicConnectionIdIncluded server_connection_id_included =
GetServerConnectionIdIncludedAsSender(header, perspective_);
- DCHECK_EQ(CONNECTION_ID_ABSENT,
- GetClientConnectionIdIncludedAsSender(header, perspective_))
+ QUICHE_DCHECK_EQ(CONNECTION_ID_ABSENT,
+ GetClientConnectionIdIncludedAsSender(header, perspective_))
<< ENDPOINT << ParsedQuicVersionToString(version_)
<< " invalid header: " << header;
@@ -2142,7 +2145,7 @@
last_serialized_server_connection_id_ = server_connection_id;
if (header.version_flag) {
- DCHECK_EQ(Perspective::IS_CLIENT, perspective_);
+ QUICHE_DCHECK_EQ(Perspective::IS_CLIENT, perspective_);
QuicVersionLabel version_label = CreateQuicVersionLabel(version_);
if (!writer->WriteUInt32(version_label)) {
return false;
@@ -2196,7 +2199,7 @@
}
if (header.version_flag) {
- DCHECK_NE(VERSION_NEGOTIATION, header.long_packet_type)
+ QUICHE_DCHECK_NE(VERSION_NEGOTIATION, header.long_packet_type)
<< "QuicFramer::AppendIetfPacketHeader does not support sending "
"version negotiation packets, use "
"QuicFramer::BuildVersionNegotiationPacket instead "
@@ -2234,8 +2237,8 @@
if (QuicVersionHasLongHeaderLengths(transport_version()) &&
header.version_flag) {
if (header.long_packet_type == INITIAL) {
- DCHECK_NE(VARIABLE_LENGTH_INTEGER_LENGTH_0,
- header.retry_token_length_length)
+ QUICHE_DCHECK_NE(VARIABLE_LENGTH_INTEGER_LENGTH_0,
+ header.retry_token_length_length)
<< ENDPOINT << ParsedQuicVersionToString(version_)
<< " bad retry token length length in header: " << header;
// Write retry token length.
@@ -2270,9 +2273,9 @@
}
if (header.nonce != nullptr) {
- DCHECK(header.version_flag);
- DCHECK_EQ(ZERO_RTT_PROTECTED, header.long_packet_type);
- DCHECK_EQ(Perspective::IS_SERVER, perspective_);
+ QUICHE_DCHECK(header.version_flag);
+ QUICHE_DCHECK_EQ(ZERO_RTT_PROTECTED, header.long_packet_type);
+ QUICHE_DCHECK_EQ(Perspective::IS_SERVER, perspective_);
if (!writer->WriteBytes(header.nonce, kDiversificationNonceSize)) {
return false;
}
@@ -2424,7 +2427,7 @@
// static
QuicPacketNumberLength QuicFramer::GetMinPacketNumberLength(
QuicPacketNumber packet_number) {
- DCHECK(packet_number.IsInitialized());
+ QUICHE_DCHECK(packet_number.IsInitialized());
if (packet_number < QuicPacketNumber(1 << (PACKET_1BYTE_PACKET_NUMBER * 8))) {
return PACKET_1BYTE_PACKET_NUMBER;
} else if (packet_number <
@@ -2729,7 +2732,7 @@
header->source_connection_id_included =
header->version_flag ? CONNECTION_ID_PRESENT : CONNECTION_ID_ABSENT;
if (header->source_connection_id_included == CONNECTION_ID_ABSENT) {
- DCHECK(header->source_connection_id.IsEmpty());
+ QUICHE_DCHECK(header->source_connection_id.IsEmpty());
if (perspective_ == Perspective::IS_CLIENT) {
header->source_connection_id = last_serialized_server_connection_id_;
} else {
@@ -2819,7 +2822,7 @@
if (header->source_connection_id_included == CONNECTION_ID_ABSENT) {
if (!header->source_connection_id.IsEmpty()) {
- DCHECK(!version_.SupportsClientConnectionIds());
+ QUICHE_DCHECK(!version_.SupportsClientConnectionIds());
set_detailed_error("Client connection ID not supported in this version.");
return false;
}
@@ -2852,7 +2855,7 @@
bool QuicFramer::ProcessFrameData(QuicDataReader* reader,
const QuicPacketHeader& header) {
- DCHECK(!VersionHasIetfQuicFrames(version_.transport_version))
+ QUICHE_DCHECK(!VersionHasIetfQuicFrames(version_.transport_version))
<< "IETF QUIC Framing negotiated but attempting to process frames as "
"non-IETF QUIC.";
if (reader->IsDoneReading()) {
@@ -3085,7 +3088,7 @@
bool QuicFramer::ProcessIetfFrameData(QuicDataReader* reader,
const QuicPacketHeader& header) {
- DCHECK(VersionHasIetfQuicFrames(version_.transport_version))
+ QUICHE_DCHECK(VersionHasIetfQuicFrames(version_.transport_version))
<< "Attempt to process frames as IETF frames but version ("
<< version_.transport_version << ") does not support IETF Framing.";
@@ -3458,7 +3461,7 @@
// Set |num_bits|, offset by |offset| to |val| in |flags|.
void SetBits(uint8_t* flags, uint8_t val, uint8_t num_bits, uint8_t offset) {
- DCHECK_LE(val, GetMaskFromNumBits(num_bits));
+ QUICHE_DCHECK_LE(val, GetMaskFromNumBits(num_bits));
*flags |= val << offset;
}
@@ -3576,7 +3579,7 @@
return false;
}
frame->data_buffer = data.data();
- DCHECK_EQ(frame->data_length, data.length());
+ QUICHE_DCHECK_EQ(frame->data_length, data.length());
return true;
}
@@ -4144,7 +4147,7 @@
bool QuicFramer::ProcessBlockedFrame(QuicDataReader* reader,
QuicBlockedFrame* frame) {
- DCHECK(!VersionHasIetfQuicFrames(version_.transport_version))
+ QUICHE_DCHECK(!VersionHasIetfQuicFrames(version_.transport_version))
<< "Attempt to process non-IETF QUIC frames in an IETF QUIC version.";
if (!reader->ReadUInt32(&frame->stream_id)) {
@@ -4162,7 +4165,7 @@
uint8_t next_byte;
while (!reader->IsDoneReading() && reader->PeekByte() == 0x00) {
reader->ReadBytes(&next_byte, 1);
- DCHECK_EQ(0x00, next_byte);
+ QUICHE_DCHECK_EQ(0x00, next_byte);
++frame->num_padding_bytes;
}
}
@@ -4219,9 +4222,9 @@
void QuicFramer::SetDecrypter(EncryptionLevel level,
std::unique_ptr<QuicDecrypter> decrypter) {
- DCHECK_EQ(alternative_decrypter_level_, NUM_ENCRYPTION_LEVELS);
- DCHECK_GE(level, decrypter_level_);
- DCHECK(!version_.KnowsWhichDecrypterToUse());
+ QUICHE_DCHECK_EQ(alternative_decrypter_level_, NUM_ENCRYPTION_LEVELS);
+ QUICHE_DCHECK_GE(level, decrypter_level_);
+ QUICHE_DCHECK(!version_.KnowsWhichDecrypterToUse());
QUIC_DVLOG(1) << ENDPOINT << "Setting decrypter from level "
<< decrypter_level_ << " to " << level;
decrypter_[decrypter_level_] = nullptr;
@@ -4233,8 +4236,8 @@
EncryptionLevel level,
std::unique_ptr<QuicDecrypter> decrypter,
bool latch_once_used) {
- DCHECK_NE(level, decrypter_level_);
- DCHECK(!version_.KnowsWhichDecrypterToUse());
+ QUICHE_DCHECK_NE(level, decrypter_level_);
+ QUICHE_DCHECK(!version_.KnowsWhichDecrypterToUse());
QUIC_DVLOG(1) << ENDPOINT << "Setting alternative decrypter from level "
<< alternative_decrypter_level_ << " to " << level;
if (alternative_decrypter_level_ != NUM_ENCRYPTION_LEVELS) {
@@ -4247,13 +4250,13 @@
void QuicFramer::InstallDecrypter(EncryptionLevel level,
std::unique_ptr<QuicDecrypter> decrypter) {
- DCHECK(version_.KnowsWhichDecrypterToUse());
+ QUICHE_DCHECK(version_.KnowsWhichDecrypterToUse());
QUIC_DVLOG(1) << ENDPOINT << "Installing decrypter at level " << level;
decrypter_[level] = std::move(decrypter);
}
void QuicFramer::RemoveDecrypter(EncryptionLevel level) {
- DCHECK(version_.KnowsWhichDecrypterToUse());
+ QUICHE_DCHECK(version_.KnowsWhichDecrypterToUse());
QUIC_DVLOG(1) << ENDPOINT << "Removing decrypter at level " << level;
decrypter_[level] = nullptr;
}
@@ -4264,13 +4267,13 @@
}
void QuicFramer::DiscardPreviousOneRttKeys() {
- DCHECK(support_key_update_for_connection_);
+ QUICHE_DCHECK(support_key_update_for_connection_);
QUIC_DVLOG(1) << ENDPOINT << "Discarding previous set of 1-RTT keys";
previous_decrypter_ = nullptr;
}
bool QuicFramer::DoKeyUpdate(KeyUpdateReason reason) {
- DCHECK(support_key_update_for_connection_);
+ QUICHE_DCHECK(support_key_update_for_connection_);
if (!next_decrypter_) {
// If key update is locally initiated, next decrypter might not be created
// yet.
@@ -4298,7 +4301,7 @@
}
const QuicDecrypter* QuicFramer::GetDecrypter(EncryptionLevel level) const {
- DCHECK(version_.KnowsWhichDecrypterToUse());
+ QUICHE_DCHECK(version_.KnowsWhichDecrypterToUse());
return decrypter_[level].get();
}
@@ -4315,8 +4318,8 @@
void QuicFramer::SetEncrypter(EncryptionLevel level,
std::unique_ptr<QuicEncrypter> encrypter) {
- DCHECK_GE(level, 0);
- DCHECK_LT(level, NUM_ENCRYPTION_LEVELS);
+ QUICHE_DCHECK_GE(level, 0);
+ QUICHE_DCHECK_LT(level, NUM_ENCRYPTION_LEVELS);
QUIC_DVLOG(1) << ENDPOINT << "Setting encrypter at level " << level;
encrypter_[level] = std::move(encrypter);
}
@@ -4340,7 +4343,7 @@
size_t total_len,
size_t buffer_len,
char* buffer) {
- DCHECK(packet_number.IsInitialized());
+ QUICHE_DCHECK(packet_number.IsInitialized());
if (encrypter_[level] == nullptr) {
QUIC_BUG << ENDPOINT
<< "Attempted to encrypt in place without encrypter at level "
@@ -4595,7 +4598,7 @@
const QuicPacket& packet,
char* buffer,
size_t buffer_len) {
- DCHECK(packet_number.IsInitialized());
+ QUICHE_DCHECK(packet_number.IsInitialized());
if (encrypter_[level] == nullptr) {
QUIC_BUG << ENDPOINT << "Attempted to encrypt without encrypter at level "
<< level;
@@ -4711,8 +4714,8 @@
}
if (support_key_update_for_connection_ &&
header.form == IETF_QUIC_SHORT_HEADER_PACKET) {
- DCHECK(version().UsesTls());
- DCHECK_EQ(level, ENCRYPTION_FORWARD_SECURE);
+ QUICHE_DCHECK(version().UsesTls());
+ QUICHE_DCHECK_EQ(level, ENCRYPTION_FORWARD_SECURE);
key_phase = (header.type_byte & FLAGS_KEY_PHASE_BIT) != 0;
key_phase_parsed = true;
QUIC_DVLOG(1) << ENDPOINT << "packet " << header.packet_number
@@ -4791,7 +4794,7 @@
set_detailed_error("Key update failed due to internal error");
return RaiseError(QUIC_INTERNAL_ERROR);
}
- DCHECK_EQ(current_key_phase_bit_, key_phase);
+ QUICHE_DCHECK_EQ(current_key_phase_bit_, key_phase);
}
if (key_phase_parsed &&
!current_key_phase_first_received_packet_number_.IsInitialized() &&
@@ -4809,7 +4812,7 @@
}
} else if (alternative_decrypter != nullptr) {
if (header.nonce != nullptr) {
- DCHECK_EQ(perspective_, Perspective::IS_CLIENT);
+ QUICHE_DCHECK_EQ(perspective_, Perspective::IS_CLIENT);
alternative_decrypter->SetDiversificationNonce(*header.nonce);
}
bool try_alternative_decryption = true;
@@ -4820,7 +4823,7 @@
try_alternative_decryption = false;
}
} else {
- DCHECK(header.nonce == nullptr);
+ QUICHE_DCHECK(header.nonce == nullptr);
}
}
@@ -4909,7 +4912,7 @@
size_t QuicFramer::GetAckFrameSize(
const QuicAckFrame& ack,
QuicPacketNumberLength /*packet_number_length*/) {
- DCHECK(!ack.packets.Empty());
+ QUICHE_DCHECK(!ack.packets.Empty());
size_t ack_size = 0;
if (VersionHasIetfQuicFrames(version_.transport_version)) {
@@ -4975,7 +4978,7 @@
last_frame_in_packet,
frame.message_frame->message_length);
case PADDING_FRAME:
- DCHECK(false);
+ QUICHE_DCHECK(false);
return 0;
default:
return GetRetransmittableControlFrameSize(version_.transport_version,
@@ -5165,7 +5168,7 @@
bool QuicFramer::AppendPacketNumber(QuicPacketNumberLength packet_number_length,
QuicPacketNumber packet_number,
QuicDataWriter* writer) {
- DCHECK(packet_number.IsInitialized());
+ QUICHE_DCHECK(packet_number.IsInitialized());
if (!IsValidPacketNumberLength(packet_number_length)) {
QUIC_BUG << "Invalid packet_number_length: " << packet_number_length;
return false;
@@ -5243,7 +5246,7 @@
}
if (data_producer_ != nullptr) {
- DCHECK_EQ(nullptr, frame.data_buffer);
+ QUICHE_DCHECK_EQ(nullptr, frame.data_buffer);
if (frame.data_length == 0) {
return true;
}
@@ -5332,7 +5335,7 @@
return false;
}
} else {
- DCHECK_EQ(nullptr, frame.data_buffer);
+ QUICHE_DCHECK_EQ(nullptr, frame.data_buffer);
if (data_producer_->WriteStreamData(frame.stream_id, frame.offset,
frame.data_length,
@@ -5361,7 +5364,7 @@
return false;
}
} else {
- DCHECK_EQ(nullptr, frame.data_buffer);
+ QUICHE_DCHECK_EQ(nullptr, frame.data_buffer);
if (!data_producer_->WriteCryptoData(frame.level, frame.offset,
frame.data_length, writer)) {
return false;
@@ -5394,7 +5397,8 @@
}
void QuicFramer::set_version(const ParsedQuicVersion version) {
- DCHECK(IsSupportedVersion(version)) << ParsedQuicVersionToString(version);
+ QUICHE_DCHECK(IsSupportedVersion(version))
+ << ParsedQuicVersionToString(version);
version_ = version;
}
@@ -5416,7 +5420,7 @@
GetMinAckFrameSize(version_.transport_version, frame,
local_ack_delay_exponent_) -
(new_ack_info.num_ack_blocks != 0 ? kNumberOfAckBlocksSize : 0);
- DCHECK_LE(0, available_timestamp_and_ack_block_bytes);
+ QUICHE_DCHECK_LE(0, available_timestamp_and_ack_block_bytes);
uint8_t type_byte = 0;
SetBit(&type_byte, new_ack_info.num_ack_blocks != 0,
@@ -5452,7 +5456,7 @@
// Largest acked delta time.
uint64_t ack_delay_time_us = kUFloat16MaxValue;
if (!frame.ack_delay_time.IsInfinite()) {
- DCHECK_LE(0u, frame.ack_delay_time.ToMicroseconds());
+ QUICHE_DCHECK_LE(0u, frame.ack_delay_time.ToMicroseconds());
ack_delay_time_us = frame.ack_delay_time.ToMicroseconds();
}
if (!writer->WriteUFloat16(ack_delay_time_us)) {
@@ -5524,7 +5528,7 @@
}
++num_ack_blocks_written;
}
- DCHECK_EQ(num_ack_blocks, num_ack_blocks_written);
+ QUICHE_DCHECK_EQ(num_ack_blocks, num_ack_blocks_written);
}
// Timestamps.
// If we don't process timestamps or if we don't have enough available space
@@ -5546,8 +5550,8 @@
bool QuicFramer::AppendTimestampsToAckFrame(const QuicAckFrame& frame,
QuicDataWriter* writer) {
- DCHECK_GE(std::numeric_limits<uint8_t>::max(),
- frame.received_packet_times.size());
+ QUICHE_DCHECK_GE(std::numeric_limits<uint8_t>::max(),
+ frame.received_packet_times.size());
// num_received_packets is only 1 byte.
if (frame.received_packet_times.size() >
std::numeric_limits<uint8_t>::max()) {
@@ -5566,7 +5570,8 @@
QuicPacketNumber packet_number = it->first;
uint64_t delta_from_largest_observed = LargestAcked(frame) - packet_number;
- DCHECK_GE(std::numeric_limits<uint8_t>::max(), delta_from_largest_observed);
+ QUICHE_DCHECK_GE(std::numeric_limits<uint8_t>::max(),
+ delta_from_largest_observed);
if (delta_from_largest_observed > std::numeric_limits<uint8_t>::max()) {
return false;
}
@@ -5610,9 +5615,9 @@
bool QuicFramer::AppendStopWaitingFrame(const QuicPacketHeader& header,
const QuicStopWaitingFrame& frame,
QuicDataWriter* writer) {
- DCHECK(!version_.HasIetfInvariantHeader());
- DCHECK(frame.least_unacked.IsInitialized());
- DCHECK_GE(header.packet_number, frame.least_unacked);
+ QUICHE_DCHECK(!version_.HasIetfInvariantHeader());
+ QUICHE_DCHECK(frame.least_unacked.IsInitialized());
+ QUICHE_DCHECK_GE(header.packet_number, frame.least_unacked);
const uint64_t least_unacked_delta =
header.packet_number - frame.least_unacked;
const uint64_t length_shift = header.packet_number_length * 8;
@@ -5664,7 +5669,7 @@
uint64_t ack_delay_time_us = kVarInt62MaxValue;
if (!frame.ack_delay_time.IsInfinite()) {
- DCHECK_LE(0u, frame.ack_delay_time.ToMicroseconds());
+ QUICHE_DCHECK_LE(0u, frame.ack_delay_time.ToMicroseconds());
ack_delay_time_us = frame.ack_delay_time.ToMicroseconds();
ack_delay_time_us = ack_delay_time_us >> local_ack_delay_exponent_;
}
@@ -5710,7 +5715,7 @@
}
const bool success =
writer->WriteVarInt62(gap) && writer->WriteVarInt62(ack_range);
- DCHECK(success);
+ QUICHE_DCHECK(success);
previous_smallest = iter->min();
++appended_ack_blocks;
}
@@ -6365,7 +6370,7 @@
uint8_t QuicFramer::GetIetfStreamFrameTypeByte(
const QuicStreamFrame& frame,
bool last_frame_in_packet) const {
- DCHECK(VersionHasIetfQuicFrames(version_.transport_version));
+ QUICHE_DCHECK(VersionHasIetfQuicFrames(version_.transport_version));
uint8_t type_byte = IETF_STREAM;
if (!last_frame_in_packet) {
type_byte |= IETF_STREAM_FRAME_LEN_BIT;
@@ -6382,8 +6387,8 @@
void QuicFramer::InferPacketHeaderTypeFromVersion() {
// This function should only be called when server connection negotiates the
// version.
- DCHECK_EQ(perspective_, Perspective::IS_SERVER);
- DCHECK(!infer_packet_header_type_from_version_);
+ QUICHE_DCHECK_EQ(perspective_, Perspective::IS_SERVER);
+ QUICHE_DCHECK(!infer_packet_header_type_from_version_);
infer_packet_header_type_from_version_ = true;
}
@@ -6620,7 +6625,7 @@
return QUIC_NO_ERROR;
}
- DCHECK_EQ(IETF_QUIC_LONG_HEADER_PACKET, *format);
+ QUICHE_DCHECK_EQ(IETF_QUIC_LONG_HEADER_PACKET, *format);
*version_present = true;
if (!ProcessVersionLabel(reader, version_label)) {
*detailed_error = "Unable to read protocol version.";
@@ -6751,7 +6756,7 @@
}
// Fill the rest of the packet with zeroes.
writer.WritePadding();
- DCHECK_EQ(0u, writer.remaining());
+ QUICHE_DCHECK_EQ(0u, writer.remaining());
return true;
}
diff --git a/quic/core/quic_framer_test.cc b/quic/core/quic_framer_test.cc
index 4859ad6..12b779a 100644
--- a/quic/core/quic_framer_test.cc
+++ b/quic/core/quic_framer_test.cc
@@ -364,7 +364,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);
if (VersionHasIetfQuicFrames(transport_version_)) {
EXPECT_TRUE(IETF_ACK == framer_->current_received_frame_type() ||
@@ -433,7 +433,7 @@
++frame_count_;
handshake_done_frames_.push_back(
std::make_unique<QuicHandshakeDoneFrame>(frame));
- DCHECK(VersionHasIetfQuicFrames(transport_version_));
+ QUICHE_DCHECK(VersionHasIetfQuicFrames(transport_version_));
EXPECT_EQ(IETF_HANDSHAKE_DONE, framer_->current_received_frame_type());
return true;
}
@@ -442,7 +442,7 @@
++frame_count_;
ack_frequency_frames_.emplace_back(
std::make_unique<QuicAckFrequencyFrame>(frame));
- DCHECK(VersionHasIetfQuicFrames(transport_version_));
+ QUICHE_DCHECK(VersionHasIetfQuicFrames(transport_version_));
EXPECT_EQ(IETF_ACK_FREQUENCY, framer_->current_received_frame_type());
return true;
}
@@ -2762,7 +2762,7 @@
// If IETF frames are in use then we must also have the IETF
// header invariants.
if (VersionHasIetfQuicFrames(framer_.transport_version())) {
- DCHECK(framer_.version().HasIetfInvariantHeader());
+ QUICHE_DCHECK(framer_.version().HasIetfInvariantHeader());
}
SetDecrypterLevel(ENCRYPTION_ZERO_RTT);
diff --git a/quic/core/quic_idle_network_detector.cc b/quic/core/quic_idle_network_detector.cc
index e310f69..8046e44 100644
--- a/quic/core/quic_idle_network_detector.cc
+++ b/quic/core/quic_idle_network_detector.cc
@@ -112,7 +112,7 @@
void QuicIdleNetworkDetector::MaybeSetAlarmOnSentPacket(
QuicTime::Delta pto_delay) {
- DCHECK(shorter_idle_timeout_on_sent_packet_);
+ QUICHE_DCHECK(shorter_idle_timeout_on_sent_packet_);
if (!handshake_timeout_.IsInfinite() || !alarm_->IsSet()) {
SetAlarm();
return;
diff --git a/quic/core/quic_legacy_version_encapsulator.cc b/quic/core/quic_legacy_version_encapsulator.cc
index b9fd693..bfe2df2 100644
--- a/quic/core/quic_legacy_version_encapsulator.cc
+++ b/quic/core/quic_legacy_version_encapsulator.cc
@@ -99,8 +99,8 @@
outer_chlo.SetStringPiece(kSNI, sni);
outer_chlo.SetStringPiece(kQLVE, inner_packet);
const QuicData& serialized_outer_chlo = outer_chlo.GetSerialized();
- DCHECK(!LegacyVersionForEncapsulation().UsesCryptoFrames());
- DCHECK(LegacyVersionForEncapsulation().UsesQuicCrypto());
+ QUICHE_DCHECK(!LegacyVersionForEncapsulation().UsesCryptoFrames());
+ QUICHE_DCHECK(LegacyVersionForEncapsulation().UsesQuicCrypto());
QuicStreamFrame outer_stream_frame(
QuicUtils::GetCryptoStreamId(
LegacyVersionForEncapsulation().transport_version),
diff --git a/quic/core/quic_linux_socket_utils.cc b/quic/core/quic_linux_socket_utils.cc
index ecb691e..c2931af 100644
--- a/quic/core/quic_linux_socket_utils.cc
+++ b/quic/core/quic_linux_socket_utils.cc
@@ -25,7 +25,7 @@
cbuf_size_(cbuf_size),
cmsg_(nullptr) {
// Only support unconnected sockets.
- DCHECK(peer_address.IsInitialized());
+ QUICHE_DCHECK(peer_address.IsInitialized());
raw_peer_address_ = peer_address.generic_address();
hdr_.msg_name = &raw_peer_address_;
@@ -61,19 +61,19 @@
// msg_controllen needs to be increased first, otherwise CMSG_NXTHDR will
// return nullptr.
hdr_.msg_controllen += CMSG_SPACE(data_size);
- DCHECK_LE(hdr_.msg_controllen, cbuf_size_);
+ QUICHE_DCHECK_LE(hdr_.msg_controllen, cbuf_size_);
if (cmsg_ == nullptr) {
- DCHECK_EQ(nullptr, hdr_.msg_control);
+ QUICHE_DCHECK_EQ(nullptr, hdr_.msg_control);
memset(cbuf_, 0, cbuf_size_);
hdr_.msg_control = cbuf_;
cmsg_ = CMSG_FIRSTHDR(&hdr_);
} else {
- DCHECK_NE(nullptr, hdr_.msg_control);
+ QUICHE_DCHECK_NE(nullptr, hdr_.msg_control);
cmsg_ = CMSG_NXTHDR(&hdr_, cmsg_);
}
- DCHECK_NE(nullptr, cmsg_) << "Insufficient control buffer space";
+ QUICHE_DCHECK_NE(nullptr, cmsg_) << "Insufficient control buffer space";
cmsg_->cmsg_len = CMSG_LEN(data_size);
cmsg_->cmsg_level = cmsg_level;
@@ -95,7 +95,7 @@
hdr->msg_controllen = 0;
// Only support unconnected sockets.
- DCHECK(buffered_write.peer_address.IsInitialized());
+ QUICHE_DCHECK(buffered_write.peer_address.IsInitialized());
sockaddr_storage* peer_address_storage = GetPeerAddressStorage(i);
*peer_address_storage = buffered_write.peer_address.generic_address();
@@ -131,18 +131,18 @@
// msg_controllen needs to be increased first, otherwise CMSG_NXTHDR will
// return nullptr.
hdr->msg_controllen += CMSG_SPACE(data_size);
- DCHECK_LE(hdr->msg_controllen, cbuf_size_);
+ QUICHE_DCHECK_LE(hdr->msg_controllen, cbuf_size_);
if (cmsg == nullptr) {
- DCHECK_EQ(nullptr, hdr->msg_control);
+ QUICHE_DCHECK_EQ(nullptr, hdr->msg_control);
hdr->msg_control = GetCbuf(i);
cmsg = CMSG_FIRSTHDR(hdr);
} else {
- DCHECK_NE(nullptr, hdr->msg_control);
+ QUICHE_DCHECK_NE(nullptr, hdr->msg_control);
cmsg = CMSG_NXTHDR(hdr, cmsg);
}
- DCHECK_NE(nullptr, cmsg) << "Insufficient control buffer space";
+ QUICHE_DCHECK_NE(nullptr, cmsg) << "Insufficient control buffer space";
cmsg->cmsg_len = CMSG_LEN(data_size);
cmsg->cmsg_level = cmsg_level;
@@ -152,8 +152,8 @@
}
int QuicMMsgHdr::num_bytes_sent(int num_packets_sent) {
- DCHECK_LE(0, num_packets_sent);
- DCHECK_LE(num_packets_sent, num_msgs_);
+ QUICHE_DCHECK_LE(0, num_packets_sent);
+ QUICHE_DCHECK_LE(num_packets_sent, num_msgs_);
int bytes_sent = 0;
iovec* iov = GetIov(0);
@@ -219,7 +219,7 @@
void QuicLinuxSocketUtils::SetIpInfoInCmsgData(
const QuicIpAddress& self_address,
void* cmsg_data) {
- DCHECK(self_address.IsInitialized());
+ QUICHE_DCHECK(self_address.IsInitialized());
const std::string& address_str = self_address.ToPackedString();
if (self_address.IsIPv4()) {
in_pktinfo* pktinfo = static_cast<in_pktinfo*>(cmsg_data);
diff --git a/quic/core/quic_mtu_discovery.cc b/quic/core/quic_mtu_discovery.cc
index 400efda..056a4bd 100644
--- a/quic/core/quic_mtu_discovery.cc
+++ b/quic/core/quic_mtu_discovery.cc
@@ -17,7 +17,7 @@
void QuicConnectionMtuDiscoverer::Enable(
QuicByteCount max_packet_length,
QuicByteCount target_max_packet_length) {
- DCHECK(!IsEnabled());
+ QUICHE_DCHECK(!IsEnabled());
if (target_max_packet_length <= max_packet_length) {
QUIC_DVLOG(1) << "MtuDiscoverer not enabled. target_max_packet_length:"
@@ -28,7 +28,7 @@
min_probe_length_ = max_packet_length;
max_probe_length_ = target_max_packet_length;
- DCHECK(IsEnabled());
+ QUICHE_DCHECK(IsEnabled());
QUIC_DVLOG(1) << "MtuDiscoverer enabled. min:" << min_probe_length_
<< ", max:" << max_probe_length_
@@ -70,7 +70,7 @@
QuicPacketLength QuicConnectionMtuDiscoverer::GetUpdatedMtuProbeSize(
QuicPacketNumber largest_sent_packet) {
- DCHECK(ShouldProbeMtu(largest_sent_packet));
+ QUICHE_DCHECK(ShouldProbeMtu(largest_sent_packet));
QuicPacketLength probe_packet_length = next_probe_packet_length();
if (probe_packet_length == last_probe_length_) {
@@ -78,7 +78,7 @@
// previous one exceeded MTU, we need to decrease the probe packet length.
max_probe_length_ = probe_packet_length;
} else {
- DCHECK_GT(probe_packet_length, last_probe_length_);
+ QUICHE_DCHECK_GT(probe_packet_length, last_probe_length_);
}
last_probe_length_ = next_probe_packet_length();
@@ -93,14 +93,14 @@
<< ", New packets_between_probes_:" << packets_between_probes_
<< ", next_probe_at_:" << next_probe_at_
<< ", remaining_probe_count_:" << remaining_probe_count_;
- DCHECK(!ShouldProbeMtu(largest_sent_packet));
+ QUICHE_DCHECK(!ShouldProbeMtu(largest_sent_packet));
return last_probe_length_;
}
QuicPacketLength QuicConnectionMtuDiscoverer::next_probe_packet_length() const {
- DCHECK_NE(min_probe_length_, 0);
- DCHECK_NE(max_probe_length_, 0);
- DCHECK_GE(max_probe_length_, min_probe_length_);
+ QUICHE_DCHECK_NE(min_probe_length_, 0);
+ QUICHE_DCHECK_NE(max_probe_length_, 0);
+ QUICHE_DCHECK_GE(max_probe_length_, min_probe_length_);
const QuicPacketLength normal_next_probe_length =
(min_probe_length_ + max_probe_length_ + 1) / 2;
@@ -121,7 +121,7 @@
return;
}
- DCHECK_EQ(old_value, min_probe_length_);
+ QUICHE_DCHECK_EQ(old_value, min_probe_length_);
min_probe_length_ = new_value;
}
diff --git a/quic/core/quic_packet_creator.cc b/quic/core/quic_packet_creator.cc
index 7dbe37a..9dabd3a 100644
--- a/quic/core/quic_packet_creator.cc
+++ b/quic/core/quic_packet_creator.cc
@@ -159,7 +159,7 @@
}
void QuicPacketCreator::SetMaxPacketLength(QuicByteCount length) {
- DCHECK(CanSetMaxPacketLength());
+ QUICHE_DCHECK(CanSetMaxPacketLength());
// Avoid recomputing |max_plaintext_size_| if the length does not actually
// change.
@@ -192,7 +192,7 @@
}
void QuicPacketCreator::SetSoftMaxPacketLength(QuicByteCount length) {
- DCHECK(CanSetMaxPacketLength());
+ QUICHE_DCHECK(CanSetMaxPacketLength());
if (length > max_packet_length_) {
QUIC_BUG << ENDPOINT
<< "Try to increase max_packet_length_ in "
@@ -217,18 +217,18 @@
// A packet that is already open might send kQuicVersionSize bytes less than the
// maximum packet size if we stop sending version before it is serialized.
void QuicPacketCreator::StopSendingVersion() {
- DCHECK(send_version_in_packet_);
- DCHECK(!version().HasIetfInvariantHeader());
+ QUICHE_DCHECK(send_version_in_packet_);
+ QUICHE_DCHECK(!version().HasIetfInvariantHeader());
send_version_in_packet_ = false;
if (packet_size_ > 0) {
- DCHECK_LT(kQuicVersionSize, packet_size_);
+ QUICHE_DCHECK_LT(kQuicVersionSize, packet_size_);
packet_size_ -= kQuicVersionSize;
}
}
void QuicPacketCreator::SetDiversificationNonce(
const DiversificationNonce& nonce) {
- DCHECK(!have_diversification_nonce_);
+ QUICHE_DCHECK(!have_diversification_nonce_);
have_diversification_nonce_ = true;
diversification_nonce_ = nonce;
}
@@ -246,7 +246,7 @@
}
const QuicPacketNumber next_packet_number = NextSendingPacketNumber();
- DCHECK_LE(least_packet_awaited_by_peer, next_packet_number);
+ QUICHE_DCHECK_LE(least_packet_awaited_by_peer, next_packet_number);
const uint64_t current_delta =
next_packet_number - least_packet_awaited_by_peer;
const uint64_t delta = std::max(current_delta, max_packets_in_flight);
@@ -414,14 +414,14 @@
QuicFrame* frame) {
// Make sure max_packet_length_ is greater than the largest possible overhead
// or max_packet_length_ is set to the soft limit.
- DCHECK(max_packet_length_ >
- StreamFramePacketOverhead(
- framer_->transport_version(),
- GetDestinationConnectionIdLength(),
- GetSourceConnectionIdLength(), kIncludeVersion,
- IncludeNonceInPublicHeader(), PACKET_6BYTE_PACKET_NUMBER,
- GetRetryTokenLengthLength(), GetLengthLength(), offset) ||
- latched_hard_max_packet_length_ > 0);
+ QUICHE_DCHECK(
+ max_packet_length_ >
+ StreamFramePacketOverhead(
+ framer_->transport_version(), GetDestinationConnectionIdLength(),
+ GetSourceConnectionIdLength(), kIncludeVersion,
+ IncludeNonceInPublicHeader(), PACKET_6BYTE_PACKET_NUMBER,
+ GetRetryTokenLengthLength(), GetLengthLength(), offset) ||
+ latched_hard_max_packet_length_ > 0);
QUIC_BUG_IF(!HasRoomForStreamFrame(id, offset, data_size))
<< "No room for Stream frame, BytesFree: " << BytesFree()
@@ -471,7 +471,7 @@
external_buffer.release_buffer = nullptr;
}
- DCHECK_EQ(nullptr, packet_.encrypted_buffer);
+ QUICHE_DCHECK_EQ(nullptr, packet_.encrypted_buffer);
if (!SerializePacket(std::move(external_buffer), kMaxOutgoingPacketSize)) {
return;
}
@@ -500,8 +500,8 @@
QUIC_BUG_IF(packet_.release_encrypted_buffer != nullptr)
<< "packet_.release_encrypted_buffer should be empty";
packet_.release_encrypted_buffer = nullptr;
- DCHECK(packet_.retransmittable_frames.empty());
- DCHECK(packet_.nonretransmittable_frames.empty());
+ QUICHE_DCHECK(packet_.retransmittable_frames.empty());
+ QUICHE_DCHECK(packet_.nonretransmittable_frames.empty());
packet_.largest_acked.Clear();
needs_full_padding_ = false;
}
@@ -564,8 +564,8 @@
TransmissionType transmission_type,
size_t* num_bytes_consumed) {
// TODO(b/167222597): consider using ScopedSerializationFailureHandler.
- DCHECK(queued_frames_.empty());
- DCHECK(!QuicUtils::IsCryptoStreamId(transport_version(), id));
+ QUICHE_DCHECK(queued_frames_.empty());
+ QUICHE_DCHECK(!QuicUtils::IsCryptoStreamId(transport_version(), id));
// Write out the packet header
QuicPacketHeader header;
FillPacketHeader(&header);
@@ -651,8 +651,8 @@
packet_.transmission_type = transmission_type;
- DCHECK(packet_.encryption_level == ENCRYPTION_FORWARD_SECURE ||
- packet_.encryption_level == ENCRYPTION_ZERO_RTT)
+ QUICHE_DCHECK(packet_.encryption_level == ENCRYPTION_FORWARD_SECURE ||
+ packet_.encryption_level == ENCRYPTION_ZERO_RTT)
<< packet_.encryption_level;
size_t encrypted_length = framer_->EncryptInPlace(
packet_.encryption_level, packet_.packet_number,
@@ -721,7 +721,7 @@
}
size_t QuicPacketCreator::BytesFree() const {
- DCHECK_GE(max_plaintext_size_, PacketSize());
+ QUICHE_DCHECK_GE(max_plaintext_size_, PacketSize());
return max_plaintext_size_ -
std::min(max_plaintext_size_, PacketSize() + ExpansionOnNewFrame());
}
@@ -752,7 +752,7 @@
}
ScopedSerializationFailureHandler handler(this);
- DCHECK_LT(0u, encrypted_buffer_len);
+ QUICHE_DCHECK_LT(0u, encrypted_buffer_len);
QUIC_BUG_IF(queued_frames_.empty() && pending_padding_bytes_ == 0)
<< "Attempt to serialize empty packet";
QuicPacketHeader header;
@@ -785,7 +785,7 @@
return false;
}
- DCHECK_GE(max_plaintext_size_, packet_size_);
+ QUICHE_DCHECK_GE(max_plaintext_size_, packet_size_);
// Use the packet_size_ instead of the buffer size to ensure smaller
// packet sizes are properly used.
size_t length =
@@ -813,7 +813,7 @@
// Because of possible truncation, we can't be confident that our
// packet size calculation worked correctly.
if (!possibly_truncated_by_length) {
- DCHECK_EQ(packet_size_, length);
+ QUICHE_DCHECK_EQ(packet_size_, length);
}
const size_t encrypted_length = framer_->EncryptInPlace(
packet_.encryption_level, packet_.packet_number,
@@ -848,14 +848,14 @@
std::unique_ptr<char[]> buffer(new char[kMaxOutgoingPacketSize]);
size_t length = BuildConnectivityProbingPacket(
header, buffer.get(), max_plaintext_size_, packet_.encryption_level);
- DCHECK(length);
+ QUICHE_DCHECK(length);
- DCHECK_EQ(packet_.encryption_level, ENCRYPTION_FORWARD_SECURE);
+ QUICHE_DCHECK_EQ(packet_.encryption_level, ENCRYPTION_FORWARD_SECURE);
const size_t encrypted_length = framer_->EncryptInPlace(
packet_.encryption_level, packet_.packet_number,
GetStartOfEncryptedData(framer_->transport_version(), header), length,
kMaxOutgoingPacketSize, buffer.get());
- DCHECK(encrypted_length);
+ QUICHE_DCHECK(encrypted_length);
std::unique_ptr<SerializedPacket> serialize_packet(new SerializedPacket(
header.packet_number, header.packet_number_length, buffer.release(),
@@ -888,14 +888,14 @@
size_t length =
BuildPaddedPathChallengePacket(header, buffer.get(), max_plaintext_size_,
payload, packet_.encryption_level);
- DCHECK(length);
+ QUICHE_DCHECK(length);
- DCHECK_EQ(packet_.encryption_level, ENCRYPTION_FORWARD_SECURE);
+ QUICHE_DCHECK_EQ(packet_.encryption_level, ENCRYPTION_FORWARD_SECURE);
const size_t encrypted_length = framer_->EncryptInPlace(
packet_.encryption_level, packet_.packet_number,
GetStartOfEncryptedData(framer_->transport_version(), header), length,
kMaxOutgoingPacketSize, buffer.get());
- DCHECK(encrypted_length);
+ QUICHE_DCHECK(encrypted_length);
std::unique_ptr<SerializedPacket> serialize_packet(
new SerializedPacket(header.packet_number, header.packet_number_length,
@@ -930,14 +930,14 @@
size_t length =
BuildPathResponsePacket(header, buffer.get(), max_plaintext_size_,
payloads, is_padded, packet_.encryption_level);
- DCHECK(length);
+ QUICHE_DCHECK(length);
- DCHECK_EQ(packet_.encryption_level, ENCRYPTION_FORWARD_SECURE);
+ QUICHE_DCHECK_EQ(packet_.encryption_level, ENCRYPTION_FORWARD_SECURE);
const size_t encrypted_length = framer_->EncryptInPlace(
packet_.encryption_level, packet_.packet_number,
GetStartOfEncryptedData(framer_->transport_version(), header), length,
kMaxOutgoingPacketSize, buffer.get());
- DCHECK(encrypted_length);
+ QUICHE_DCHECK(encrypted_length);
std::unique_ptr<SerializedPacket> serialize_packet(
new SerializedPacket(header.packet_number, header.packet_number_length,
@@ -959,7 +959,7 @@
size_t packet_length,
const QuicPathFrameBuffer& payload,
EncryptionLevel level) {
- DCHECK(VersionHasIetfQuicFrames(framer_->transport_version()));
+ QUICHE_DCHECK(VersionHasIetfQuicFrames(framer_->transport_version()));
QuicFrames frames;
// Write a PATH_CHALLENGE frame, which has a random 8-byte payload
@@ -990,7 +990,7 @@
<< "Attempt to generate connectivity response with no request payloads";
return 0;
}
- DCHECK(VersionHasIetfQuicFrames(framer_->transport_version()));
+ QUICHE_DCHECK(VersionHasIetfQuicFrames(framer_->transport_version()));
std::vector<std::unique_ptr<QuicPathResponseFrame>> path_response_frames;
for (const QuicPathFrameBuffer& payload : payloads) {
@@ -1129,8 +1129,8 @@
QuicConnectionIdLength QuicPacketCreator::GetDestinationConnectionIdLength()
const {
- DCHECK(QuicUtils::IsConnectionIdValidForVersion(server_connection_id_,
- transport_version()));
+ QUICHE_DCHECK(QuicUtils::IsConnectionIdValidForVersion(server_connection_id_,
+ transport_version()));
return GetDestinationConnectionIdIncluded() == CONNECTION_ID_PRESENT
? static_cast<QuicConnectionIdLength>(
GetDestinationConnectionId().length())
@@ -1138,8 +1138,8 @@
}
QuicConnectionIdLength QuicPacketCreator::GetSourceConnectionIdLength() const {
- DCHECK(QuicUtils::IsConnectionIdValidForVersion(server_connection_id_,
- transport_version()));
+ QUICHE_DCHECK(QuicUtils::IsConnectionIdValidForVersion(server_connection_id_,
+ transport_version()));
return GetSourceConnectionIdIncluded() == CONNECTION_ID_PRESENT
? static_cast<QuicConnectionIdLength>(
GetSourceConnectionId().length())
@@ -1190,7 +1190,7 @@
QUIC_BUG_IF(IsControlFrame(frame.type) && !GetControlFrameId(frame) &&
frame.type != PING_FRAME)
<< "Adding a control frame with no control frame id: " << frame;
- DCHECK(QuicUtils::IsRetransmittableFrame(frame.type)) << frame;
+ QUICHE_DCHECK(QuicUtils::IsRetransmittableFrame(frame.type)) << frame;
MaybeBundleAckOpportunistically();
if (HasPendingFrames()) {
if (AddFrame(frame, next_transmission_type_)) {
@@ -1198,7 +1198,7 @@
return true;
}
}
- DCHECK(!HasPendingFrames());
+ QUICHE_DCHECK(!HasPendingFrames());
if (frame.type != PING_FRAME && frame.type != CONNECTION_CLOSE_FRAME &&
!delegate_->ShouldGeneratePacket(HAS_RETRANSMITTABLE_DATA,
NOT_HANDSHAKE)) {
@@ -1270,8 +1270,8 @@
if (fin_consumed && state == FIN_AND_PADDING) {
AddRandomPadding();
}
- DCHECK(total_bytes_consumed == write_length ||
- (bytes_consumed > 0 && HasPendingFrames()));
+ QUICHE_DCHECK(total_bytes_consumed == write_length ||
+ (bytes_consumed > 0 && HasPendingFrames()));
if (total_bytes_consumed == write_length) {
// We're done writing the data. Exit the loop.
@@ -1306,7 +1306,7 @@
QuicStreamOffset offset,
bool fin,
size_t total_bytes_consumed) {
- DCHECK(!QuicUtils::IsCryptoStreamId(transport_version(), id));
+ QUICHE_DCHECK(!QuicUtils::IsCryptoStreamId(transport_version(), id));
if (AttemptingToSendUnencryptedStreamData()) {
return QuicConsumedData(total_bytes_consumed,
fin && (total_bytes_consumed == write_length));
@@ -1429,14 +1429,14 @@
!frames.empty() && has_ack())
<< "Trying to flush " << frames << " when there is ACK queued";
for (const auto& frame : frames) {
- DCHECK(frame.type == ACK_FRAME || frame.type == STOP_WAITING_FRAME);
+ QUICHE_DCHECK(frame.type == ACK_FRAME || frame.type == STOP_WAITING_FRAME);
if (HasPendingFrames()) {
if (AddFrame(frame, next_transmission_type_)) {
// There is pending frames and current frame fits.
continue;
}
}
- DCHECK(!HasPendingFrames());
+ QUICHE_DCHECK(!HasPendingFrames());
// There is no pending frames, consult the delegate whether a packet can be
// generated.
if (!delegate_->ShouldGeneratePacket(NO_RETRANSMITTABLE_DATA,
@@ -1541,7 +1541,7 @@
header->reset_flag = false;
header->version_flag = IncludeVersionInHeader();
if (IncludeNonceInPublicHeader()) {
- DCHECK_EQ(Perspective::IS_SERVER, framer_->perspective());
+ QUICHE_DCHECK_EQ(Perspective::IS_SERVER, framer_->perspective());
header->nonce = &diversification_nonce_;
} else {
header->nonce = nullptr;
@@ -1615,9 +1615,9 @@
// If this is an ACK frame, validate that it is non-empty and that
// largest_acked matches the max packet number.
- DCHECK(frame.type != ACK_FRAME ||
- (!frame.ack_frame->packets.Empty() &&
- frame.ack_frame->packets.Max() == frame.ack_frame->largest_acked))
+ QUICHE_DCHECK(frame.type != ACK_FRAME || (!frame.ack_frame->packets.Empty() &&
+ frame.ack_frame->packets.Max() ==
+ frame.ack_frame->largest_acked))
<< "Invalid ACK frame: " << frame;
size_t frame_len = GetSerializedFrameLength(frame);
@@ -1634,7 +1634,7 @@
if (queued_frames_.empty()) {
packet_size_ = PacketHeaderSize();
}
- DCHECK_LT(0u, packet_size_);
+ QUICHE_DCHECK_LT(0u, packet_size_);
packet_size_ += ExpansionOnNewFrame() + frame_len;
@@ -1711,12 +1711,12 @@
// The back of retransmittable frames must be the same as the original
// queued frames' back.
- DCHECK_EQ(packet_.retransmittable_frames.back().type, STREAM_FRAME);
+ QUICHE_DCHECK_EQ(packet_.retransmittable_frames.back().type, STREAM_FRAME);
QuicStreamFrame* retransmittable =
&packet_.retransmittable_frames.back().stream_frame;
- DCHECK_EQ(retransmittable->stream_id, frame.stream_id);
- DCHECK_EQ(retransmittable->offset + retransmittable->data_length,
- frame.offset);
+ QUICHE_DCHECK_EQ(retransmittable->stream_id, frame.stream_id);
+ QUICHE_DCHECK_EQ(retransmittable->offset + retransmittable->data_length,
+ frame.offset);
retransmittable->data_length = candidate->data_length;
retransmittable->fin = candidate->fin;
packet_size_ += frame.data_length;
@@ -1808,10 +1808,10 @@
void QuicPacketCreator::SetServerConnectionIdIncluded(
QuicConnectionIdIncluded server_connection_id_included) {
- DCHECK(server_connection_id_included == CONNECTION_ID_PRESENT ||
- server_connection_id_included == CONNECTION_ID_ABSENT);
- DCHECK(framer_->perspective() == Perspective::IS_SERVER ||
- server_connection_id_included != CONNECTION_ID_ABSENT);
+ QUICHE_DCHECK(server_connection_id_included == CONNECTION_ID_PRESENT ||
+ server_connection_id_included == CONNECTION_ID_ABSENT);
+ QUICHE_DCHECK(framer_->perspective() == Perspective::IS_SERVER ||
+ server_connection_id_included != CONNECTION_ID_ABSENT);
server_connection_id_included_ = server_connection_id_included;
}
@@ -1822,8 +1822,8 @@
void QuicPacketCreator::SetClientConnectionId(
QuicConnectionId client_connection_id) {
- DCHECK(client_connection_id.IsEmpty() ||
- framer_->version().SupportsClientConnectionIds());
+ QUICHE_DCHECK(client_connection_id.IsEmpty() ||
+ framer_->version().SupportsClientConnectionIds());
client_connection_id_ = client_connection_id;
}
@@ -1889,7 +1889,7 @@
const QuicPacketLength largest_payload =
largest_frame - std::min(largest_frame, kQuicFrameTypeSize);
// This must always be less than or equal to GetCurrentLargestMessagePayload.
- DCHECK_LE(largest_payload, GetCurrentLargestMessagePayload());
+ QUICHE_DCHECK_LE(largest_payload, GetCurrentLargestMessagePayload());
return largest_payload;
}
@@ -2001,7 +2001,7 @@
}
void QuicPacketCreator::set_encryption_level(EncryptionLevel level) {
- DCHECK(level == packet_.encryption_level || !HasPendingFrames())
+ QUICHE_DCHECK(level == packet_.encryption_level || !HasPendingFrames())
<< "Cannot update encryption level from " << packet_.encryption_level
<< " to " << level << " when we already have pending frames: "
<< QuicFramesToString(queued_frames_);
@@ -2048,7 +2048,7 @@
}
}
// Frame was not queued but queued frames were flushed.
- DCHECK(!HasPendingFrames());
+ QUICHE_DCHECK(!HasPendingFrames());
if (!delegate_->ShouldGeneratePacket(NO_RETRANSMITTABLE_DATA,
NOT_HANDSHAKE)) {
return false;
diff --git a/quic/core/quic_packet_creator_test.cc b/quic/core/quic_packet_creator_test.cc
index da0c6b2..8ff44c1 100644
--- a/quic/core/quic_packet_creator_test.cc
+++ b/quic/core/quic_packet_creator_test.cc
@@ -2442,7 +2442,7 @@
~QuicPacketCreatorMultiplePacketsTest() override {}
void SavePacket(SerializedPacket packet) {
- DCHECK(packet.release_encrypted_buffer == nullptr);
+ QUICHE_DCHECK(packet.release_encrypted_buffer == nullptr);
packet.encrypted_buffer = CopyBuffer(packet);
packet.release_encrypted_buffer = [](const char* p) { delete[] p; };
packets_.push_back(std::move(packet));
diff --git a/quic/core/quic_packet_number.cc b/quic/core/quic_packet_number.cc
index d326434..ba1c509 100644
--- a/quic/core/quic_packet_number.cc
+++ b/quic/core/quic_packet_number.cc
@@ -25,12 +25,12 @@
}
uint64_t QuicPacketNumber::Hash() const {
- DCHECK(IsInitialized());
+ QUICHE_DCHECK(IsInitialized());
return packet_number_;
}
uint64_t QuicPacketNumber::ToUint64() const {
- DCHECK(IsInitialized());
+ QUICHE_DCHECK(IsInitialized());
return packet_number_;
}
@@ -40,8 +40,8 @@
QuicPacketNumber& QuicPacketNumber::operator++() {
#ifndef NDEBUG
- DCHECK(IsInitialized());
- DCHECK_LT(ToUint64(), std::numeric_limits<uint64_t>::max() - 1);
+ QUICHE_DCHECK(IsInitialized());
+ QUICHE_DCHECK_LT(ToUint64(), std::numeric_limits<uint64_t>::max() - 1);
#endif
packet_number_++;
return *this;
@@ -49,8 +49,8 @@
QuicPacketNumber QuicPacketNumber::operator++(int) {
#ifndef NDEBUG
- DCHECK(IsInitialized());
- DCHECK_LT(ToUint64(), std::numeric_limits<uint64_t>::max() - 1);
+ QUICHE_DCHECK(IsInitialized());
+ QUICHE_DCHECK_LT(ToUint64(), std::numeric_limits<uint64_t>::max() - 1);
#endif
QuicPacketNumber previous(*this);
packet_number_++;
@@ -59,8 +59,8 @@
QuicPacketNumber& QuicPacketNumber::operator--() {
#ifndef NDEBUG
- DCHECK(IsInitialized());
- DCHECK_GE(ToUint64(), 1UL);
+ QUICHE_DCHECK(IsInitialized());
+ QUICHE_DCHECK_GE(ToUint64(), 1UL);
#endif
packet_number_--;
return *this;
@@ -68,8 +68,8 @@
QuicPacketNumber QuicPacketNumber::operator--(int) {
#ifndef NDEBUG
- DCHECK(IsInitialized());
- DCHECK_GE(ToUint64(), 1UL);
+ QUICHE_DCHECK(IsInitialized());
+ QUICHE_DCHECK_GE(ToUint64(), 1UL);
#endif
QuicPacketNumber previous(*this);
packet_number_--;
@@ -78,8 +78,8 @@
QuicPacketNumber& QuicPacketNumber::operator+=(uint64_t delta) {
#ifndef NDEBUG
- DCHECK(IsInitialized());
- DCHECK_GT(std::numeric_limits<uint64_t>::max() - ToUint64(), delta);
+ QUICHE_DCHECK(IsInitialized());
+ QUICHE_DCHECK_GT(std::numeric_limits<uint64_t>::max() - ToUint64(), delta);
#endif
packet_number_ += delta;
return *this;
@@ -87,8 +87,8 @@
QuicPacketNumber& QuicPacketNumber::operator-=(uint64_t delta) {
#ifndef NDEBUG
- DCHECK(IsInitialized());
- DCHECK_GE(ToUint64(), delta);
+ QUICHE_DCHECK(IsInitialized());
+ QUICHE_DCHECK_GE(ToUint64(), delta);
#endif
packet_number_ -= delta;
return *this;
diff --git a/quic/core/quic_packet_reader.cc b/quic/core/quic_packet_reader.cc
index 7b03762..4b0eb4b 100644
--- a/quic/core/quic_packet_reader.cc
+++ b/quic/core/quic_packet_reader.cc
@@ -20,7 +20,7 @@
QuicPacketReader::QuicPacketReader()
: read_buffers_(kNumPacketsPerReadMmsgCall),
read_results_(kNumPacketsPerReadMmsgCall) {
- DCHECK_EQ(read_buffers_.size(), read_results_.size());
+ QUICHE_DCHECK_EQ(read_buffers_.size(), read_results_.size());
for (size_t i = 0; i < read_results_.size(); ++i) {
read_results_[i].packet_buffer.buffer = read_buffers_[i].packet_buffer;
read_results_[i].packet_buffer.buffer_len =
diff --git a/quic/core/quic_packets.cc b/quic/core/quic_packets.cc
index 51946aa..5f3e5a2 100644
--- a/quic/core/quic_packets.cc
+++ b/quic/core/quic_packets.cc
@@ -74,8 +74,8 @@
QuicConnectionIdLength GetIncludedConnectionIdLength(
QuicConnectionId connection_id,
QuicConnectionIdIncluded connection_id_included) {
- DCHECK(connection_id_included == CONNECTION_ID_PRESENT ||
- connection_id_included == CONNECTION_ID_ABSENT);
+ QUICHE_DCHECK(connection_id_included == CONNECTION_ID_PRESENT ||
+ connection_id_included == CONNECTION_ID_ABSENT);
return connection_id_included == CONNECTION_ID_PRESENT
? static_cast<QuicConnectionIdLength>(connection_id.length())
: PACKET_0BYTE_CONNECTION_ID;
@@ -127,9 +127,9 @@
if (VersionHasLengthPrefixedConnectionIds(version)) {
size += kConnectionIdLengthSize;
}
- DCHECK(QuicVersionHasLongHeaderLengths(version) ||
- retry_token_length_length + retry_token_length + length_length ==
- 0);
+ QUICHE_DCHECK(
+ QuicVersionHasLongHeaderLengths(version) ||
+ retry_token_length_length + retry_token_length + length_length == 0);
if (QuicVersionHasLongHeaderLengths(version)) {
size += retry_token_length_length + retry_token_length + length_length;
}
@@ -140,8 +140,8 @@
packet_number_length;
}
// Google QUIC versions <= 43 can only carry one connection ID.
- DCHECK(destination_connection_id_length == 0 ||
- source_connection_id_length == 0);
+ QUICHE_DCHECK(destination_connection_id_length == 0 ||
+ source_connection_id_length == 0);
return kPublicFlagsSize + destination_connection_id_length +
source_connection_id_length +
(include_version ? kQuicVersionSize : 0) + packet_number_length +
@@ -534,7 +534,7 @@
// Copy underlying frames.
copy->retransmittable_frames =
CopyQuicFrames(allocator, serialized.retransmittable_frames);
- DCHECK(copy->nonretransmittable_frames.empty());
+ QUICHE_DCHECK(copy->nonretransmittable_frames.empty());
for (const auto& frame : serialized.nonretransmittable_frames) {
if (frame.type == ACK_FRAME) {
copy->has_ack_frame_copy = true;
diff --git a/quic/core/quic_path_validator.cc b/quic/core/quic_path_validator.cc
index 0cc387f..ac4f3ed 100644
--- a/quic/core/quic_path_validator.cc
+++ b/quic/core/quic_path_validator.cc
@@ -68,7 +68,7 @@
void QuicPathValidator::StartPathValidation(
std::unique_ptr<QuicPathValidationContext> context,
std::unique_ptr<ResultDelegate> result_delegate) {
- DCHECK(context);
+ QUICHE_DCHECK(context);
QUIC_DLOG(INFO) << "Start validating path " << *context
<< " via writer: " << context->WriterToUse();
if (path_context_ != nullptr) {
diff --git a/quic/core/quic_received_packet_manager.cc b/quic/core/quic_received_packet_manager.cc
index 4546399..2b43442 100644
--- a/quic/core/quic_received_packet_manager.cc
+++ b/quic/core/quic_received_packet_manager.cc
@@ -72,7 +72,8 @@
const QuicPacketHeader& header,
QuicTime receipt_time) {
const QuicPacketNumber packet_number = header.packet_number;
- DCHECK(IsAwaitingPacket(packet_number)) << " packet_number:" << packet_number;
+ QUICHE_DCHECK(IsAwaitingPacket(packet_number))
+ << " packet_number:" << packet_number;
was_last_packet_missing_ = IsMissing(packet_number);
if (!ack_frame_updated_) {
ack_frame_.received_packet_times.clear();
@@ -174,8 +175,8 @@
return;
}
// ValidateAck() should fail if peer_least_packet_awaiting_ack shrinks.
- DCHECK(!peer_least_packet_awaiting_ack_.IsInitialized() ||
- peer_least_packet_awaiting_ack_ <= least_unacked);
+ QUICHE_DCHECK(!peer_least_packet_awaiting_ack_.IsInitialized() ||
+ peer_least_packet_awaiting_ack_ <= least_unacked);
if (!peer_least_packet_awaiting_ack_.IsInitialized() ||
least_unacked > peer_least_packet_awaiting_ack_) {
peer_least_packet_awaiting_ack_ = least_unacked;
@@ -186,9 +187,9 @@
ack_frame_updated_ = true;
}
}
- DCHECK(ack_frame_.packets.Empty() ||
- !peer_least_packet_awaiting_ack_.IsInitialized() ||
- ack_frame_.packets.Min() >= peer_least_packet_awaiting_ack_);
+ QUICHE_DCHECK(ack_frame_.packets.Empty() ||
+ !peer_least_packet_awaiting_ack_.IsInitialized() ||
+ ack_frame_.packets.Min() >= peer_least_packet_awaiting_ack_);
}
QuicTime::Delta QuicReceivedPacketManager::GetMaxAckDelay(
diff --git a/quic/core/quic_received_packet_manager_test.cc b/quic/core/quic_received_packet_manager_test.cc
index 4935b2a..3cfa0ce 100644
--- a/quic/core/quic_received_packet_manager_test.cc
+++ b/quic/core/quic_received_packet_manager_test.cc
@@ -72,12 +72,12 @@
}
void CheckAckTimeout(QuicTime time) {
- DCHECK(HasPendingAck());
- DCHECK_EQ(received_manager_.ack_timeout(), time);
+ QUICHE_DCHECK(HasPendingAck());
+ QUICHE_DCHECK_EQ(received_manager_.ack_timeout(), time);
if (time <= clock_.ApproximateNow()) {
// ACK timeout expires, send an ACK.
received_manager_.ResetAckStates();
- DCHECK(!HasPendingAck());
+ QUICHE_DCHECK(!HasPendingAck());
}
}
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc
index 4f2b200..61d680c 100644
--- a/quic/core/quic_sent_packet_manager.cc
+++ b/quic/core/quic_sent_packet_manager.cc
@@ -594,7 +594,7 @@
bool QuicSentPacketManager::ShouldAddMaxAckDelay(
PacketNumberSpace space) const {
- DCHECK(pto_enabled_);
+ QUICHE_DCHECK(pto_enabled_);
if (supports_multiple_packet_number_spaces() && space != APPLICATION_DATA) {
// When the PTO is armed for Initial or Handshake packet number spaces,
// the max_ack_delay is 0.
@@ -631,7 +631,7 @@
QuicTime QuicSentPacketManager::GetEarliestPacketSentTimeForPto(
PacketNumberSpace* packet_number_space) const {
- DCHECK(supports_multiple_packet_number_spaces());
+ QUICHE_DCHECK(supports_multiple_packet_number_spaces());
QuicTime earliest_sent_time = QuicTime::Zero();
for (int8_t i = 0; i < NUM_PACKET_NUMBER_SPACES; ++i) {
const QuicTime sent_time = unacked_packets_.GetLastInFlightPacketSentTime(
@@ -665,8 +665,8 @@
<< " transmission_type: " << transmission_type << " transmission_info "
<< transmission_info->DebugString();
// Handshake packets should never be sent as probing retransmissions.
- DCHECK(!transmission_info->has_crypto_handshake ||
- transmission_type != PROBING_RETRANSMISSION);
+ QUICHE_DCHECK(!transmission_info->has_crypto_handshake ||
+ transmission_type != PROBING_RETRANSMISSION);
HandleRetransmission(transmission_type, transmission_info);
@@ -826,8 +826,8 @@
bool measure_rtt) {
const SerializedPacket& packet = *mutable_packet;
QuicPacketNumber packet_number = packet.packet_number;
- DCHECK_LE(FirstSendingPacketNumber(), packet_number);
- DCHECK(!unacked_packets_.IsUnacked(packet_number));
+ QUICHE_DCHECK_LE(FirstSendingPacketNumber(), packet_number);
+ QUICHE_DCHECK(!unacked_packets_.IsUnacked(packet_number));
QUIC_BUG_IF(packet.encrypted_length == 0) << "Cannot send empty packets.";
if (pending_timer_transmission_count_ > 0) {
--pending_timer_transmission_count_;
@@ -876,9 +876,9 @@
QuicSentPacketManager::RetransmissionTimeoutMode
QuicSentPacketManager::OnRetransmissionTimeout() {
- DCHECK(unacked_packets_.HasInFlightPackets() ||
- (handshake_mode_disabled_ && !handshake_finished_));
- DCHECK_EQ(0u, pending_timer_transmission_count_);
+ QUICHE_DCHECK(unacked_packets_.HasInFlightPackets() ||
+ (handshake_mode_disabled_ && !handshake_finished_));
+ QUICHE_DCHECK_EQ(0u, pending_timer_transmission_count_);
// Handshake retransmission, timer based loss detection, TLP, and RTO are
// implemented with a single alarm. The handshake alarm is set when the
// handshake has not completed, the loss alarm is set when the loss detection
@@ -886,7 +886,7 @@
// The TLP alarm is always set to run for under an RTO.
switch (GetRetransmissionMode()) {
case HANDSHAKE_MODE:
- DCHECK(!handshake_mode_disabled_);
+ QUICHE_DCHECK(!handshake_mode_disabled_);
++stats_->crypto_retransmit_count;
RetransmitCryptoPackets();
return HANDSHAKE_MODE;
@@ -924,7 +924,7 @@
}
void QuicSentPacketManager::RetransmitCryptoPackets() {
- DCHECK_EQ(HANDSHAKE_MODE, GetRetransmissionMode());
+ QUICHE_DCHECK_EQ(HANDSHAKE_MODE, GetRetransmissionMode());
++consecutive_crypto_retransmission_count_;
bool packet_retransmitted = false;
std::vector<QuicPacketNumber> crypto_retransmissions;
@@ -965,14 +965,15 @@
++pending_timer_transmission_count_;
}
}
- DCHECK(packet_retransmitted) << "No crypto packets found to retransmit.";
+ QUICHE_DCHECK(packet_retransmitted)
+ << "No crypto packets found to retransmit.";
for (QuicPacketNumber retransmission : crypto_retransmissions) {
MarkForRetransmission(retransmission, HANDSHAKE_RETRANSMISSION);
}
}
bool QuicSentPacketManager::MaybeRetransmitTailLossProbe() {
- DCHECK(!pto_enabled_);
+ QUICHE_DCHECK(!pto_enabled_);
if (pending_timer_transmission_count_ == 0) {
return false;
}
@@ -1022,7 +1023,7 @@
}
void QuicSentPacketManager::RetransmitRtoPackets() {
- DCHECK(!pto_enabled_);
+ QUICHE_DCHECK(!pto_enabled_);
QUIC_BUG_IF(pending_timer_transmission_count_ > 0)
<< "Retransmissions already queued:" << pending_timer_transmission_count_;
// Mark two packets for retransmission.
@@ -1038,7 +1039,7 @@
if (transmission_info->state == OUTSTANDING &&
unacked_packets_.HasRetransmittableFrames(*transmission_info) &&
pending_timer_transmission_count_ < max_rto_packets_) {
- DCHECK(transmission_info->in_flight);
+ QUICHE_DCHECK(transmission_info->in_flight);
retransmissions.push_back(packet_number);
++pending_timer_transmission_count_;
}
@@ -1051,7 +1052,7 @@
if (it->state == OUTSTANDING &&
unacked_packets_.HasRetransmittableFrames(*it) &&
pending_timer_transmission_count_ < max_rto_packets_) {
- DCHECK(it->in_flight);
+ QUICHE_DCHECK(it->in_flight);
retransmissions.push_back(packet_number);
++pending_timer_transmission_count_;
}
@@ -1104,7 +1105,7 @@
(!supports_multiple_packet_number_spaces() ||
unacked_packets_.GetPacketNumberSpace(
transmission_info->encryption_level) == packet_number_space)) {
- DCHECK(transmission_info->in_flight);
+ QUICHE_DCHECK(transmission_info->in_flight);
probing_packets.push_back(packet_number);
if (probing_packets.size() == pending_timer_transmission_count_) {
break;
@@ -1121,7 +1122,7 @@
(!supports_multiple_packet_number_spaces() ||
unacked_packets_.GetPacketNumberSpace(it->encryption_level) ==
packet_number_space)) {
- DCHECK(it->in_flight);
+ QUICHE_DCHECK(it->in_flight);
probing_packets.push_back(packet_number);
if (probing_packets.size() == pending_timer_transmission_count_) {
break;
@@ -1173,7 +1174,7 @@
void QuicSentPacketManager::RetransmitDataOfSpaceIfAny(
PacketNumberSpace space) {
- DCHECK(supports_multiple_packet_number_spaces());
+ QUICHE_DCHECK(supports_multiple_packet_number_spaces());
if (!unacked_packets_.GetLastInFlightPacketSentTime(space).IsInitialized()) {
// No in flight data of space.
return;
@@ -1192,7 +1193,7 @@
unacked_packets_.HasRetransmittableFrames(*transmission_info) &&
unacked_packets_.GetPacketNumberSpace(
transmission_info->encryption_level) == space) {
- DCHECK(transmission_info->in_flight);
+ QUICHE_DCHECK(transmission_info->in_flight);
if (pending_timer_transmission_count_ == 0) {
pending_timer_transmission_count_ = 1;
}
@@ -1208,7 +1209,7 @@
unacked_packets_.HasRetransmittableFrames(*it) &&
unacked_packets_.GetPacketNumberSpace(it->encryption_level) ==
space) {
- DCHECK(it->in_flight);
+ QUICHE_DCHECK(it->in_flight);
if (pending_timer_transmission_count_ == 0) {
pending_timer_transmission_count_ = 1;
}
@@ -1221,8 +1222,8 @@
QuicSentPacketManager::RetransmissionTimeoutMode
QuicSentPacketManager::GetRetransmissionMode() const {
- DCHECK(unacked_packets_.HasInFlightPackets() ||
- (handshake_mode_disabled_ && !handshake_finished_));
+ QUICHE_DCHECK(unacked_packets_.HasInFlightPackets() ||
+ (handshake_mode_disabled_ && !handshake_finished_));
if (!handshake_mode_disabled_ && !handshake_finished_ &&
unacked_packets_.HasPendingCryptoPackets()) {
return HANDSHAKE_MODE;
@@ -1243,8 +1244,8 @@
void QuicSentPacketManager::InvokeLossDetection(QuicTime time) {
if (!packets_acked_.empty()) {
- DCHECK_LE(packets_acked_.front().packet_number,
- packets_acked_.back().packet_number);
+ QUICHE_DCHECK_LE(packets_acked_.front().packet_number,
+ packets_acked_.back().packet_number);
largest_newly_acked_ = packets_acked_.back().packet_number;
}
LossDetectionInterface::DetectionStats detection_stats =
@@ -1357,7 +1358,7 @@
case LOSS_MODE:
return loss_algorithm_->GetLossTimeout();
case TLP_MODE: {
- DCHECK(!pto_enabled_);
+ QUICHE_DCHECK(!pto_enabled_);
// TODO(ianswett): When CWND is available, it would be preferable to
// set the timer based on the earliest retransmittable packet.
// Base the updated timer on the send time of the last packet.
@@ -1368,7 +1369,7 @@
return std::max(clock_->ApproximateNow(), tlp_time);
}
case RTO_MODE: {
- DCHECK(!pto_enabled_);
+ QUICHE_DCHECK(!pto_enabled_);
// The RTO is based on the first outstanding packet.
const QuicTime sent_time =
unacked_packets_.GetLastInFlightPacketSentTime();
@@ -1433,7 +1434,7 @@
earliest_right_edge + GetProbeTimeoutDelay(packet_number_space));
}
}
- DCHECK(false);
+ QUICHE_DCHECK(false);
return QuicTime::Zero();
}
@@ -1519,7 +1520,7 @@
const QuicTime::Delta QuicSentPacketManager::GetProbeTimeoutDelay(
PacketNumberSpace space) const {
- DCHECK(pto_enabled_);
+ QUICHE_DCHECK(pto_enabled_);
if (rtt_stats_.smoothed_rtt().IsZero()) {
// Respect kMinHandshakeTimeoutMs to avoid a potential amplification attack.
QUIC_BUG_IF(rtt_stats_.initial_rtt().IsZero());
@@ -1614,7 +1615,7 @@
// them as useless, thus not contributing to RTT stats.
if (unacked_packets_.HasRetransmittableFrames(packet_number)) {
MarkForRetransmission(packet_number, PATH_RETRANSMISSION);
- DCHECK_EQ(it->state, NOT_CONTRIBUTING_RTT);
+ QUICHE_DCHECK_EQ(it->state, NOT_CONTRIBUTING_RTT);
}
}
it->state = NOT_CONTRIBUTING_RTT;
@@ -1625,8 +1626,8 @@
void QuicSentPacketManager::OnAckFrameStart(QuicPacketNumber largest_acked,
QuicTime::Delta ack_delay_time,
QuicTime ack_receive_time) {
- DCHECK(packets_acked_.empty());
- DCHECK_LE(largest_acked, unacked_packets_.largest_sent_packet());
+ QUICHE_DCHECK(packets_acked_.empty());
+ QUICHE_DCHECK_LE(largest_acked, unacked_packets_.largest_sent_packet());
if (ack_delay_time > peer_max_ack_delay()) {
ack_delay_time = peer_max_ack_delay();
}
@@ -1799,7 +1800,7 @@
QuicPacketNumber QuicSentPacketManager::GetLargestAckedPacket(
EncryptionLevel decrypted_packet_level) const {
- DCHECK(supports_multiple_packet_number_spaces());
+ QUICHE_DCHECK(supports_multiple_packet_number_spaces());
return unacked_packets_.GetLargestAckedOfPacketNumberSpace(
QuicUtils::GetPacketNumberSpace(decrypted_packet_level));
}
@@ -1827,7 +1828,7 @@
QuicPacketNumber QuicSentPacketManager::GetLargestPacketPeerKnowsIsAcked(
EncryptionLevel decrypted_packet_level) const {
- DCHECK(supports_multiple_packet_number_spaces());
+ QUICHE_DCHECK(supports_multiple_packet_number_spaces());
return largest_packets_peer_knows_is_acked_[QuicUtils::GetPacketNumberSpace(
decrypted_packet_level)];
}
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc
index 5c308f0..5112cde 100644
--- a/quic/core/quic_session.cc
+++ b/quic/core/quic_session.cc
@@ -155,14 +155,14 @@
return;
}
- DCHECK_EQ(QuicUtils::GetCryptoStreamId(transport_version()),
- GetMutableCryptoStream()->id());
+ QUICHE_DCHECK_EQ(QuicUtils::GetCryptoStreamId(transport_version()),
+ GetMutableCryptoStream()->id());
}
QuicSession::~QuicSession() {}
void QuicSession::PendingStreamOnStreamFrame(const QuicStreamFrame& frame) {
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
QuicStreamId stream_id = frame.stream_id;
PendingStream* pending = GetOrCreatePendingStream(stream_id);
@@ -181,7 +181,7 @@
}
if (ProcessPendingStream(pending)) {
// The pending stream should now be in the scope of normal streams.
- DCHECK(IsClosedStream(stream_id) || IsOpenStream(stream_id))
+ QUICHE_DCHECK(IsClosedStream(stream_id) || IsOpenStream(stream_id))
<< "Stream " << stream_id << " not created";
pending_stream_map_.erase(stream_id);
return;
@@ -230,13 +230,13 @@
void QuicSession::OnStopSendingFrame(const QuicStopSendingFrame& frame) {
// STOP_SENDING is in IETF QUIC only.
- DCHECK(VersionHasIetfQuicFrames(transport_version()));
- DCHECK(QuicVersionUsesCryptoFrames(transport_version()));
+ QUICHE_DCHECK(VersionHasIetfQuicFrames(transport_version()));
+ QUICHE_DCHECK(QuicVersionUsesCryptoFrames(transport_version()));
QuicStreamId stream_id = frame.stream_id;
// If Stream ID is invalid then close the connection.
// TODO(ianswett): This check is redundant to checks for IsClosedStream,
- // but removing it requires removing multiple DCHECKs.
+ // but removing it requires removing multiple QUICHE_DCHECKs.
// TODO(ianswett): Multiple QUIC_DVLOGs could be QUIC_PEER_BUGs.
if (stream_id == QuicUtils::GetInvalidStreamId(transport_version())) {
QUIC_DVLOG(1) << ENDPOINT
@@ -300,7 +300,7 @@
}
void QuicSession::PendingStreamOnRstStream(const QuicRstStreamFrame& frame) {
- DCHECK(VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(VersionUsesHttp3(transport_version()));
QuicStreamId stream_id = frame.stream_id;
PendingStream* pending = GetOrCreatePendingStream(stream_id);
@@ -312,9 +312,10 @@
pending->OnRstStreamFrame(frame);
// Pending stream is currently read only. We can safely close the stream.
- DCHECK_EQ(READ_UNIDIRECTIONAL,
- QuicUtils::GetStreamType(pending->id(), perspective(),
- /*peer_initiated = */ true, version()));
+ QUICHE_DCHECK_EQ(
+ READ_UNIDIRECTIONAL,
+ QuicUtils::GetStreamType(pending->id(), perspective(),
+ /*peer_initiated = */ true, version()));
ClosePendingStream(stream_id);
}
@@ -377,7 +378,7 @@
}
void QuicSession::OnNewTokenReceived(absl::string_view token) {
- DCHECK_EQ(perspective_, Perspective::IS_CLIENT);
+ QUICHE_DCHECK_EQ(perspective_, Perspective::IS_CLIENT);
GetMutableCryptoStream()->OnNewTokenReceived(token);
}
@@ -399,7 +400,7 @@
void QuicSession::OnConnectionClosed(const QuicConnectionCloseFrame& frame,
ConnectionCloseSource source) {
- DCHECK(!connection_->connected());
+ QUICHE_DCHECK(!connection_->connected());
if (perspective() == Perspective::IS_SERVER) {
RecordConnectionCloseAtServer(frame.quic_error_code, source);
}
@@ -637,9 +638,9 @@
<< " bytes_written " << previous_bytes_written << " fin "
<< previous_fin_sent;
stream->OnCanWrite();
- DCHECK(CheckStreamWriteBlocked(stream));
- DCHECK(CheckStreamNotBusyLooping(stream, previous_bytes_written,
- previous_fin_sent));
+ QUICHE_DCHECK(CheckStreamWriteBlocked(stream));
+ QUICHE_DCHECK(CheckStreamNotBusyLooping(stream, previous_bytes_written,
+ previous_fin_sent));
}
currently_writing_stream_id_ = 0;
}
@@ -739,15 +740,16 @@
StreamSendingState state,
TransmissionType type,
absl::optional<EncryptionLevel> level) {
- DCHECK(connection_->connected())
+ QUICHE_DCHECK(connection_->connected())
<< ENDPOINT << "Try to write stream data when connection is closed.";
- DCHECK(!use_write_or_buffer_data_at_level_ || level.has_value());
+ QUICHE_DCHECK(!use_write_or_buffer_data_at_level_ || level.has_value());
if (!IsEncryptionEstablished() &&
!QuicUtils::IsCryptoStreamId(transport_version(), id)) {
// Do not let streams write without encryption. The calling stream will end
// up write blocked until OnCanWrite is next called.
if (was_zero_rtt_rejected_ && !OneRttKeysAvailable()) {
- DCHECK(version().UsesTls() && perspective() == Perspective::IS_CLIENT);
+ QUICHE_DCHECK(version().UsesTls() &&
+ perspective() == Perspective::IS_CLIENT);
QUIC_BUG_IF(type == NOT_RETRANSMISSION)
<< ENDPOINT << "Try to send new data on stream " << id
<< "before 1-RTT keys are available while 0-RTT is rejected.";
@@ -791,7 +793,7 @@
size_t write_length,
QuicStreamOffset offset,
TransmissionType type) {
- DCHECK(QuicVersionUsesCryptoFrames(transport_version()));
+ QUICHE_DCHECK(QuicVersionUsesCryptoFrames(transport_version()));
if (!connection()->framer().HasEncrypterOfEncryptionLevel(level)) {
const std::string error_details = absl::StrCat(
"Try to send crypto data with missing keys of encryption level: ",
@@ -827,7 +829,7 @@
bool QuicSession::WriteControlFrame(const QuicFrame& frame,
TransmissionType type) {
- DCHECK(connection()->connected())
+ QUICHE_DCHECK(connection()->connected())
<< ENDPOINT << "Try to write control frames when connection is closed.";
if (connection_->encrypted_control_frames()) {
QUIC_RELOADABLE_FLAG_COUNT(quic_encrypted_control_frames);
@@ -849,7 +851,7 @@
QuicRstStreamErrorCode error,
QuicStreamOffset bytes_written,
bool send_rst_only) {
- DCHECK(!split_up_send_rst());
+ QUICHE_DCHECK(!split_up_send_rst());
if (!connection()->connected()) {
return;
}
@@ -897,7 +899,7 @@
void QuicSession::MaybeSendRstStreamFrame(QuicStreamId id,
QuicRstStreamErrorCode error,
QuicStreamOffset bytes_written) {
- DCHECK(split_up_send_rst());
+ QUICHE_DCHECK(split_up_send_rst());
if (!connection()->connected()) {
return;
}
@@ -912,7 +914,7 @@
void QuicSession::MaybeSendStopSendingFrame(QuicStreamId id,
QuicRstStreamErrorCode error) {
- DCHECK(split_up_send_rst());
+ QUICHE_DCHECK(split_up_send_rst());
if (!connection()->connected()) {
return;
}
@@ -926,7 +928,7 @@
void QuicSession::SendGoAway(QuicErrorCode error_code,
const std::string& reason) {
// GOAWAY frame is not supported in IETF QUIC.
- DCHECK(!VersionHasIetfQuicFrames(transport_version()));
+ QUICHE_DCHECK(!VersionHasIetfQuicFrames(transport_version()));
if (GetQuicReloadableFlag(quic_encrypted_goaway)) {
QUIC_RELOADABLE_FLAG_COUNT_N(quic_encrypted_goaway, 1, 2);
if (!IsEncryptionEstablished()) {
@@ -942,7 +944,7 @@
}
transport_goaway_sent_ = true;
if (GetQuicReloadableFlag(quic_goaway_with_max_stream_id)) {
- DCHECK_EQ(perspective(), Perspective::IS_SERVER);
+ QUICHE_DCHECK_EQ(perspective(), Perspective::IS_SERVER);
QUIC_RELOADABLE_FLAG_COUNT_N(quic_goaway_with_max_stream_id, 2, 2);
control_frame_manager_.WriteOrBufferGoAway(
error_code,
@@ -1026,7 +1028,7 @@
// received, for accurate connection level flow control accounting.
// If this is an outgoing stream, it is technically open from peer's
// perspective. Do not inform stream Id manager yet.
- DCHECK(!stream->was_draining());
+ QUICHE_DCHECK(!stream->was_draining());
InsertLocallyClosedStreamsHighestOffset(
stream_id, stream->highest_received_byte_offset());
return;
@@ -1066,7 +1068,7 @@
void QuicSession::ClosePendingStream(QuicStreamId stream_id) {
QUIC_DVLOG(1) << ENDPOINT << "Closing stream " << stream_id;
- DCHECK(VersionHasIetfQuicFrames(transport_version()));
+ QUICHE_DCHECK(VersionHasIetfQuicFrames(transport_version()));
pending_stream_map_.erase(stream_id);
if (connection_->connected()) {
ietf_streamid_manager_.OnStreamClosed(stream_id);
@@ -1367,7 +1369,7 @@
void QuicSession::HandleFrameOnNonexistentOutgoingStream(
QuicStreamId stream_id) {
- DCHECK(!IsClosedStream(stream_id));
+ QUICHE_DCHECK(!IsClosedStream(stream_id));
// Received a frame for a locally-created stream that is not currently
// active. This is an error.
if (VersionHasIetfQuicFrames(transport_version())) {
@@ -1394,7 +1396,7 @@
}
void QuicSession::OnNewStreamFlowControlWindow(QuicStreamOffset new_window) {
- DCHECK(version().UsesQuicCrypto());
+ QUICHE_DCHECK(version().UsesQuicCrypto());
QUIC_DVLOG(1) << ENDPOINT << "OnNewStreamFlowControlWindow " << new_window;
if (new_window < kMinimumFlowControlSendWindow) {
QUIC_LOG_FIRST_N(ERROR, 1)
@@ -1427,7 +1429,7 @@
void QuicSession::OnNewStreamUnidirectionalFlowControlWindow(
QuicStreamOffset new_window) {
- DCHECK_EQ(connection_->version().handshake_protocol, PROTOCOL_TLS1_3);
+ QUICHE_DCHECK_EQ(connection_->version().handshake_protocol, PROTOCOL_TLS1_3);
QUIC_DVLOG(1) << ENDPOINT << "OnNewStreamUnidirectionalFlowControlWindow "
<< new_window;
// Inform all existing outgoing unidirectional streams about the new window.
@@ -1457,7 +1459,7 @@
void QuicSession::OnNewStreamOutgoingBidirectionalFlowControlWindow(
QuicStreamOffset new_window) {
- DCHECK_EQ(connection_->version().handshake_protocol, PROTOCOL_TLS1_3);
+ QUICHE_DCHECK_EQ(connection_->version().handshake_protocol, PROTOCOL_TLS1_3);
QUIC_DVLOG(1) << ENDPOINT
<< "OnNewStreamOutgoingBidirectionalFlowControlWindow "
<< new_window;
@@ -1488,7 +1490,7 @@
void QuicSession::OnNewStreamIncomingBidirectionalFlowControlWindow(
QuicStreamOffset new_window) {
- DCHECK_EQ(connection_->version().handshake_protocol, PROTOCOL_TLS1_3);
+ QUICHE_DCHECK_EQ(connection_->version().handshake_protocol, PROTOCOL_TLS1_3);
QUIC_DVLOG(1) << ENDPOINT
<< "OnNewStreamIncomingBidirectionalFlowControlWindow "
<< new_window;
@@ -1619,7 +1621,8 @@
}
void QuicSession::SetDefaultEncryptionLevel(EncryptionLevel level) {
- DCHECK_EQ(PROTOCOL_QUIC_CRYPTO, connection_->version().handshake_protocol);
+ QUICHE_DCHECK_EQ(PROTOCOL_QUIC_CRYPTO,
+ connection_->version().handshake_protocol);
QUIC_DVLOG(1) << ENDPOINT << "Set default encryption level to " << level;
connection()->SetDefaultEncryptionLevel(level);
@@ -1649,7 +1652,7 @@
}
void QuicSession::OnTlsHandshakeComplete() {
- DCHECK_EQ(PROTOCOL_TLS1_3, connection_->version().handshake_protocol);
+ QUICHE_DCHECK_EQ(PROTOCOL_TLS1_3, connection_->version().handshake_protocol);
QUIC_BUG_IF(!GetCryptoStream()->crypto_negotiated_params().cipher_suite)
<< ENDPOINT << "Handshake completes without cipher suite negotiation.";
QUIC_BUG_IF(!config_.negotiated())
@@ -1671,8 +1674,8 @@
}
void QuicSession::MaybeSendAddressToken() {
- DCHECK(perspective_ == Perspective::IS_SERVER &&
- connection()->version().HasIetfQuicFrames());
+ QUICHE_DCHECK(perspective_ == Perspective::IS_SERVER &&
+ connection()->version().HasIetfQuicFrames());
std::string address_token = GetCryptoStream()->GetAddressToken();
if (address_token.empty()) {
return;
@@ -1799,7 +1802,7 @@
bool is_static = stream->is_static();
QUIC_DVLOG(1) << ENDPOINT << "num_streams: " << stream_map_.size()
<< ". activating stream " << stream_id;
- DCHECK(!QuicContainsKey(stream_map_, stream_id));
+ QUICHE_DCHECK(!QuicContainsKey(stream_map_, stream_id));
stream_map_[stream_id] = std::move(stream);
if (is_static) {
++num_static_streams_;
@@ -1828,7 +1831,7 @@
bool QuicSession::CanOpenNextOutgoingBidirectionalStream() {
if (liveness_testing_in_progress_) {
- DCHECK_EQ(Perspective::IS_CLIENT, perspective());
+ QUICHE_DCHECK_EQ(Perspective::IS_CLIENT, perspective());
return false;
}
if (!VersionHasIetfQuicFrames(transport_version())) {
@@ -1874,12 +1877,12 @@
QuicStreamCount QuicSession::GetAdvertisedMaxIncomingBidirectionalStreams()
const {
- DCHECK(VersionHasIetfQuicFrames(transport_version()));
+ QUICHE_DCHECK(VersionHasIetfQuicFrames(transport_version()));
return ietf_streamid_manager_.advertised_max_incoming_bidirectional_streams();
}
QuicStream* QuicSession::GetOrCreateStream(const QuicStreamId stream_id) {
- DCHECK(!QuicContainsKey(pending_stream_map_, stream_id));
+ QUICHE_DCHECK(!QuicContainsKey(pending_stream_map_, stream_id));
if (QuicUtils::IsCryptoStreamId(transport_version(), stream_id)) {
return GetMutableCryptoStream();
}
@@ -1918,7 +1921,7 @@
}
void QuicSession::StreamDraining(QuicStreamId stream_id, bool unidirectional) {
- DCHECK(QuicContainsKey(stream_map_, stream_id));
+ QUICHE_DCHECK(QuicContainsKey(stream_map_, stream_id));
QUIC_DVLOG(1) << ENDPOINT << "Stream " << stream_id << " is draining";
if (VersionHasIetfQuicFrames(transport_version())) {
ietf_streamid_manager_.OnStreamClosed(stream_id);
@@ -1983,7 +1986,7 @@
void QuicSession::set_largest_peer_created_stream_id(
QuicStreamId largest_peer_created_stream_id) {
- DCHECK(!VersionHasIetfQuicFrames(transport_version()));
+ QUICHE_DCHECK(!VersionHasIetfQuicFrames(transport_version()));
stream_id_manager_.set_largest_peer_created_stream_id(
largest_peer_created_stream_id);
}
@@ -1991,7 +1994,7 @@
QuicStreamId QuicSession::GetLargestPeerCreatedStreamId(
bool unidirectional) const {
// This method is only used in IETF QUIC.
- DCHECK(VersionHasIetfQuicFrames(transport_version()));
+ QUICHE_DCHECK(VersionHasIetfQuicFrames(transport_version()));
return ietf_streamid_manager_.GetLargestPeerCreatedStreamId(unidirectional);
}
@@ -2015,7 +2018,7 @@
}
bool QuicSession::IsClosedStream(QuicStreamId id) {
- DCHECK_NE(QuicUtils::GetInvalidStreamId(transport_version()), id);
+ QUICHE_DCHECK_NE(QuicUtils::GetInvalidStreamId(transport_version()), id);
if (IsOpenStream(id)) {
// Stream is active
return false;
@@ -2029,7 +2032,7 @@
}
bool QuicSession::IsOpenStream(QuicStreamId id) {
- DCHECK_NE(QuicUtils::GetInvalidStreamId(transport_version()), id);
+ QUICHE_DCHECK_NE(QuicUtils::GetInvalidStreamId(transport_version()), id);
const StreamMap::iterator it = stream_map_.find(id);
if (it != stream_map_.end()) {
return !it->second->IsZombie();
@@ -2051,8 +2054,9 @@
}
size_t QuicSession::GetNumActiveStreams() const {
- DCHECK_GE(static_cast<QuicStreamCount>(stream_map_.size()),
- num_static_streams_ + num_draining_streams_ + num_zombie_streams_);
+ QUICHE_DCHECK_GE(
+ static_cast<QuicStreamCount>(stream_map_.size()),
+ num_static_streams_ + num_draining_streams_ + num_zombie_streams_);
return stream_map_.size() - num_draining_streams_ - num_static_streams_ -
num_zombie_streams_;
}
@@ -2355,7 +2359,7 @@
QuicStream* crypto_stream =
GetStream(QuicUtils::GetCryptoStreamId(transport_version()));
crypto_stream->OnCanWrite();
- DCHECK(CheckStreamWriteBlocked(crypto_stream));
+ QUICHE_DCHECK(CheckStreamWriteBlocked(crypto_stream));
if (crypto_stream->HasPendingRetransmission()) {
// Connection is write blocked.
return false;
@@ -2379,7 +2383,7 @@
QuicStream* stream = GetStream(id);
if (stream != nullptr) {
stream->OnCanWrite();
- DCHECK(CheckStreamWriteBlocked(stream));
+ QUICHE_DCHECK(CheckStreamWriteBlocked(stream));
if (stream->HasPendingRetransmission()) {
// Connection is write blocked.
break;
@@ -2419,7 +2423,7 @@
}
MessageResult QuicSession::SendMessage(QuicMemSliceSpan message, bool flush) {
- DCHECK(connection_->connected())
+ QUICHE_DCHECK(connection_->connected())
<< ENDPOINT << "Try to write messages when connection is closed.";
if (!IsEncryptionEstablished()) {
return {MESSAGE_STATUS_ENCRYPTION_NOT_ESTABLISHED, 0};
@@ -2580,7 +2584,7 @@
}
bool QuicSession::ValidateToken(absl::string_view token) const {
- DCHECK_EQ(perspective_, Perspective::IS_SERVER);
+ QUICHE_DCHECK_EQ(perspective_, Perspective::IS_SERVER);
if (token.empty() || token[0] != 0) {
// Validate the prefix for token received in NEW_TOKEN frame.
return false;
diff --git a/quic/core/quic_session_test.cc b/quic/core/quic_session_test.cc
index 7c5d9bb..7daec2b 100644
--- a/quic/core/quic_session_test.cc
+++ b/quic/core/quic_session_test.cc
@@ -367,7 +367,7 @@
}
QuicConsumedData SendLargeFakeData(QuicStream* stream, int bytes) {
- DCHECK(writev_consumes_all_data_);
+ QUICHE_DCHECK(writev_consumes_all_data_);
return WritevData(stream->id(), bytes, 0, FIN, NOT_RETRANSMISSION,
GetEncryptionLevelToSendApplicationData());
}
diff --git a/quic/core/quic_stream.cc b/quic/core/quic_stream.cc
index b5cdd31..0649428 100644
--- a/quic/core/quic_stream.cc
+++ b/quic/core/quic_stream.cc
@@ -134,7 +134,7 @@
}
void PendingStream::OnFinRead() {
- DCHECK(sequencer_.IsClosed());
+ QUICHE_DCHECK(sequencer_.IsClosed());
}
void PendingStream::AddBytesConsumed(QuicByteCount bytes) {
@@ -169,7 +169,7 @@
}
void PendingStream::OnStreamFrame(const QuicStreamFrame& frame) {
- DCHECK_EQ(frame.stream_id, id_);
+ QUICHE_DCHECK_EQ(frame.stream_id, id_);
bool is_stream_too_long =
(frame.offset > kMaxStreamLength) ||
@@ -220,7 +220,7 @@
}
void PendingStream::OnRstStreamFrame(const QuicRstStreamFrame& frame) {
- DCHECK_EQ(frame.stream_id, id_);
+ QUICHE_DCHECK_EQ(frame.stream_id, id_);
if (frame.byte_offset > kMaxStreamLength) {
// Peer are not suppose to write bytes more than maxium allowed.
@@ -403,9 +403,9 @@
}
void QuicStream::OnStreamFrame(const QuicStreamFrame& frame) {
- DCHECK_EQ(frame.stream_id, id_);
+ QUICHE_DCHECK_EQ(frame.stream_id, id_);
- DCHECK(!(read_side_closed_ && write_side_closed_));
+ QUICHE_DCHECK(!(read_side_closed_ && write_side_closed_));
if (frame.fin && is_static_) {
OnUnrecoverableError(QUIC_INVALID_STREAM_ID,
@@ -449,7 +449,7 @@
if (frame.fin && !fin_received_) {
fin_received_ = true;
if (fin_sent_) {
- DCHECK(!was_draining_);
+ QUICHE_DCHECK(!was_draining_);
session_->StreamDraining(id_,
/*unidirectional=*/type_ != BIDIRECTIONAL);
was_draining_ = true;
@@ -585,7 +585,7 @@
}
void QuicStream::OnFinRead() {
- DCHECK(sequencer_.IsClosed());
+ QUICHE_DCHECK(sequencer_.IsClosed());
// OnFinRead can be called due to a FIN flag in a headers block, so there may
// have been no OnStreamFrame call with a FIN in the frame.
fin_received_ = true;
@@ -596,7 +596,7 @@
}
void QuicStream::SetFinSent() {
- DCHECK(!VersionUsesHttp3(transport_version()));
+ QUICHE_DCHECK(!VersionUsesHttp3(transport_version()));
fin_sent_ = true;
}
@@ -714,7 +714,7 @@
bool fin,
EncryptionLevel level,
QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) {
- DCHECK(session()->use_write_or_buffer_data_at_level());
+ QUICHE_DCHECK(session()->use_write_or_buffer_data_at_level());
QUIC_RELOADABLE_FLAG_COUNT(quic_use_write_or_buffer_data_at_level);
return WriteOrBufferDataInner(data, fin, level, ack_listener);
}
@@ -872,7 +872,7 @@
}
void QuicStream::MaybeSendStopSending(QuicRstStreamErrorCode error) {
- DCHECK(session()->split_up_send_rst());
+ QUICHE_DCHECK(session()->split_up_send_rst());
if (stop_sending_sent_) {
return;
}
@@ -885,7 +885,7 @@
if (session()->version().UsesHttp3()) {
session()->MaybeSendStopSendingFrame(id(), error);
} else {
- DCHECK_EQ(QUIC_STREAM_NO_ERROR, error);
+ QUICHE_DCHECK_EQ(QUIC_STREAM_NO_ERROR, error);
session()->MaybeSendRstStreamFrame(id(), QUIC_STREAM_NO_ERROR,
stream_bytes_written());
}
@@ -894,7 +894,7 @@
}
void QuicStream::MaybeSendRstStream(QuicRstStreamErrorCode error) {
- DCHECK(session()->split_up_send_rst());
+ QUICHE_DCHECK(session()->split_up_send_rst());
if (rst_sent_) {
return;
}
@@ -910,7 +910,7 @@
}
bool QuicStream::HasBufferedData() const {
- DCHECK_GE(send_buffer_.stream_offset(), stream_bytes_written());
+ QUICHE_DCHECK_GE(send_buffer_.stream_offset(), stream_bytes_written());
return send_buffer_.stream_offset() > stream_bytes_written();
}
@@ -932,7 +932,7 @@
}
void QuicStream::OnClose() {
- DCHECK(read_side_closed_ && write_side_closed_);
+ QUICHE_DCHECK(read_side_closed_ && write_side_closed_);
if (!fin_sent_ && !rst_sent_) {
if (!session()->split_up_send_rst()) {
@@ -1061,7 +1061,7 @@
// The validation code below is for QUIC with TLS only.
if (new_offset < flow_controller_->send_window_offset()) {
- DCHECK(session()->version().UsesTls());
+ QUICHE_DCHECK(session()->version().UsesTls());
if (was_zero_rtt_rejected && new_offset < flow_controller_->bytes_sent()) {
// The client is given flow control window lower than what's written in
// 0-RTT. This QUIC implementation is unable to retransmit them.
@@ -1162,8 +1162,8 @@
QuicByteCount data_length,
bool fin,
TransmissionType type) {
- DCHECK(type == PTO_RETRANSMISSION || type == RTO_RETRANSMISSION ||
- type == TLP_RETRANSMISSION || type == PROBING_RETRANSMISSION);
+ QUICHE_DCHECK(type == PTO_RETRANSMISSION || type == RTO_RETRANSMISSION ||
+ type == TLP_RETRANSMISSION || type == PROBING_RETRANSMISSION);
if (HasDeadlinePassed()) {
OnDeadlinePassed();
return true;
@@ -1230,14 +1230,14 @@
bool QuicStream::WriteStreamData(QuicStreamOffset offset,
QuicByteCount data_length,
QuicDataWriter* writer) {
- DCHECK_LT(0u, data_length);
+ QUICHE_DCHECK_LT(0u, data_length);
QUIC_DVLOG(2) << ENDPOINT << "Write stream " << id_ << " data from offset "
<< offset << " length " << data_length;
return send_buffer_.WriteStreamData(offset, data_length, writer);
}
void QuicStream::WriteBufferedData(absl::optional<EncryptionLevel> level) {
- DCHECK(!write_side_closed_ && (HasBufferedData() || fin_buffered_));
+ QUICHE_DCHECK(!write_side_closed_ && (HasBufferedData() || fin_buffered_));
if (session_->ShouldYield(id())) {
session_->MarkConnectionLevelWriteBlocked(id());
@@ -1310,11 +1310,11 @@
MaybeSendBlocked();
}
if (fin && consumed_data.fin_consumed) {
- DCHECK(!fin_sent_);
+ QUICHE_DCHECK(!fin_sent_);
fin_sent_ = true;
fin_outstanding_ = true;
if (fin_received_) {
- DCHECK(!was_draining_);
+ QUICHE_DCHECK(!was_draining_);
session_->StreamDraining(id_,
/*unidirectional=*/type_ != BIDIRECTIONAL);
was_draining_ = true;
@@ -1332,7 +1332,7 @@
}
uint64_t QuicStream::BufferedDataBytes() const {
- DCHECK_GE(send_buffer_.stream_offset(), stream_bytes_written());
+ QUICHE_DCHECK_GE(send_buffer_.stream_offset(), stream_bytes_written());
return send_buffer_.stream_offset() - stream_bytes_written();
}
diff --git a/quic/core/quic_stream_id_manager.cc b/quic/core/quic_stream_id_manager.cc
index a6e3518..397eb71 100644
--- a/quic/core/quic_stream_id_manager.cc
+++ b/quic/core/quic_stream_id_manager.cc
@@ -47,7 +47,7 @@
bool QuicStreamIdManager::OnStreamsBlockedFrame(
const QuicStreamsBlockedFrame& frame,
std::string* error_details) {
- DCHECK_EQ(frame.unidirectional, unidirectional_);
+ QUICHE_DCHECK_EQ(frame.unidirectional, unidirectional_);
if (frame.stream_count > incoming_advertised_max_streams_) {
// Peer thinks it can send more streams that we've told it.
*error_details = absl::StrCat(
@@ -55,7 +55,8 @@
" exceeds incoming max stream ", incoming_advertised_max_streams_);
return false;
}
- DCHECK_LE(incoming_advertised_max_streams_, incoming_actual_max_streams_);
+ QUICHE_DCHECK_LE(incoming_advertised_max_streams_,
+ incoming_actual_max_streams_);
if (incoming_advertised_max_streams_ == incoming_actual_max_streams_) {
// We have told peer about current max.
return true;
@@ -118,8 +119,8 @@
}
void QuicStreamIdManager::OnStreamClosed(QuicStreamId stream_id) {
- DCHECK_NE(QuicUtils::IsBidirectionalStreamId(stream_id, version_),
- unidirectional_);
+ QUICHE_DCHECK_NE(QuicUtils::IsBidirectionalStreamId(stream_id, version_),
+ unidirectional_);
if (QuicUtils::IsOutgoingStreamId(version_, stream_id, perspective_)) {
// Nothing to do for outgoing streams.
return;
@@ -149,7 +150,7 @@
}
bool QuicStreamIdManager::CanOpenNextOutgoingStream() const {
- DCHECK(VersionHasIetfQuicFrames(version_.transport_version));
+ QUICHE_DCHECK(VersionHasIetfQuicFrames(version_.transport_version));
return outgoing_stream_count_ < outgoing_max_streams_;
}
@@ -157,11 +158,11 @@
const QuicStreamId stream_id,
std::string* error_details) {
// |stream_id| must be an incoming stream of the right directionality.
- DCHECK_NE(QuicUtils::IsBidirectionalStreamId(stream_id, version_),
- unidirectional_);
- DCHECK_NE(QuicUtils::IsServerInitiatedStreamId(version_.transport_version,
- stream_id),
- perspective_ == Perspective::IS_SERVER);
+ QUICHE_DCHECK_NE(QuicUtils::IsBidirectionalStreamId(stream_id, version_),
+ unidirectional_);
+ QUICHE_DCHECK_NE(QuicUtils::IsServerInitiatedStreamId(
+ version_.transport_version, stream_id),
+ perspective_ == Perspective::IS_SERVER);
if (available_streams_.erase(stream_id) == 1) {
// stream_id is available.
return true;
@@ -169,7 +170,7 @@
if (largest_peer_created_stream_id_ !=
QuicUtils::GetInvalidStreamId(version_.transport_version)) {
- DCHECK_GT(stream_id, largest_peer_created_stream_id_);
+ QUICHE_DCHECK_GT(stream_id, largest_peer_created_stream_id_);
}
// Calculate increment of incoming_stream_count_ by creating stream_id.
@@ -204,7 +205,8 @@
}
bool QuicStreamIdManager::IsAvailableStream(QuicStreamId id) const {
- DCHECK_NE(QuicUtils::IsBidirectionalStreamId(id, version_), unidirectional_);
+ QUICHE_DCHECK_NE(QuicUtils::IsBidirectionalStreamId(id, version_),
+ unidirectional_);
if (QuicUtils::IsOutgoingStreamId(version_, id, perspective_)) {
// Stream IDs under next_ougoing_stream_id_ are either open or previously
// open but now closed.
diff --git a/quic/core/quic_stream_id_manager_test.cc b/quic/core/quic_stream_id_manager_test.cc
index 98905ee..47ba76f 100644
--- a/quic/core/quic_stream_id_manager_test.cc
+++ b/quic/core/quic_stream_id_manager_test.cc
@@ -76,7 +76,7 @@
GetParam().version,
0,
kDefaultMaxStreamsPerConnection) {
- DCHECK(VersionHasIetfQuicFrames(transport_version()));
+ QUICHE_DCHECK(VersionHasIetfQuicFrames(transport_version()));
}
QuicTransportVersion transport_version() const {
diff --git a/quic/core/quic_stream_send_buffer.cc b/quic/core/quic_stream_send_buffer.cc
index f942229..219eacd 100644
--- a/quic/core/quic_stream_send_buffer.cc
+++ b/quic/core/quic_stream_send_buffer.cc
@@ -58,7 +58,7 @@
int iov_count,
size_t iov_offset,
QuicByteCount data_length) {
- DCHECK_LT(0u, data_length);
+ QUICHE_DCHECK_LT(0u, data_length);
// Latch the maximum data slice size.
const QuicByteCount max_data_slice_size =
GetQuicFlag(FLAGS_quic_send_buffer_max_data_slice_size);
diff --git a/quic/core/quic_stream_sequencer.cc b/quic/core/quic_stream_sequencer.cc
index ae96229..e702f71 100644
--- a/quic/core/quic_stream_sequencer.cc
+++ b/quic/core/quic_stream_sequencer.cc
@@ -47,7 +47,7 @@
}
void QuicStreamSequencer::OnStreamFrame(const QuicStreamFrame& frame) {
- DCHECK_LE(frame.offset + frame.data_length, close_offset_);
+ QUICHE_DCHECK_LE(frame.offset + frame.data_length, close_offset_);
++num_frames_received_;
const QuicStreamOffset byte_offset = frame.offset;
const size_t data_len = frame.data_length;
@@ -59,7 +59,7 @@
if (GetQuicReloadableFlag(quic_accept_empty_stream_frame_with_no_fin)) {
QUIC_RELOADABLE_FLAG_COUNT(quic_accept_empty_stream_frame_with_no_fin);
if (stream_->version().HasIetfQuicFrames() && data_len == 0) {
- DCHECK(!frame.fin);
+ QUICHE_DCHECK(!frame.fin);
// Ignore empty frame with no fin.
return;
}
@@ -178,23 +178,23 @@
}
int QuicStreamSequencer::GetReadableRegions(iovec* iov, size_t iov_len) const {
- DCHECK(!blocked_);
+ QUICHE_DCHECK(!blocked_);
return buffered_frames_.GetReadableRegions(iov, iov_len);
}
bool QuicStreamSequencer::GetReadableRegion(iovec* iov) const {
- DCHECK(!blocked_);
+ QUICHE_DCHECK(!blocked_);
return buffered_frames_.GetReadableRegion(iov);
}
bool QuicStreamSequencer::PeekRegion(QuicStreamOffset offset,
iovec* iov) const {
- DCHECK(!blocked_);
+ QUICHE_DCHECK(!blocked_);
return buffered_frames_.PeekRegion(offset, iov);
}
void QuicStreamSequencer::Read(std::string* buffer) {
- DCHECK(!blocked_);
+ QUICHE_DCHECK(!blocked_);
buffer->resize(buffer->size() + ReadableBytes());
iovec iov;
iov.iov_len = ReadableBytes();
@@ -203,7 +203,7 @@
}
size_t QuicStreamSequencer::Readv(const struct iovec* iov, size_t iov_len) {
- DCHECK(!blocked_);
+ QUICHE_DCHECK(!blocked_);
std::string error_details;
size_t bytes_read;
QuicErrorCode read_error =
@@ -232,7 +232,7 @@
}
void QuicStreamSequencer::MarkConsumed(size_t num_bytes_consumed) {
- DCHECK(!blocked_);
+ QUICHE_DCHECK(!blocked_);
bool result = buffered_frames_.MarkConsumed(num_bytes_consumed);
if (!result) {
QUIC_BUG << "Invalid argument to MarkConsumed."
@@ -274,7 +274,7 @@
}
void QuicStreamSequencer::FlushBufferedFrames() {
- DCHECK(ignore_read_data_);
+ QUICHE_DCHECK(ignore_read_data_);
size_t bytes_flushed = buffered_frames_.FlushBufferedFrames();
QUIC_DVLOG(1) << "Flushing buffered data at offset "
<< buffered_frames_.BytesConsumed() << " length "
diff --git a/quic/core/quic_stream_sequencer_buffer.cc b/quic/core/quic_stream_sequencer_buffer.cc
index f1be32c..5c85a6e 100644
--- a/quic/core/quic_stream_sequencer_buffer.cc
+++ b/quic/core/quic_stream_sequencer_buffer.cc
@@ -47,7 +47,7 @@
total_bytes_read_(0),
blocks_(nullptr) {
if (allocate_blocks_on_demand_) {
- DCHECK_GE(max_blocks_count_, kInitialBlockCount);
+ QUICHE_DCHECK_GE(max_blocks_count_, kInitialBlockCount);
}
Clear();
}
@@ -204,7 +204,7 @@
const size_t write_block_offset = GetInBlockOffset(offset);
size_t current_blocks_count =
allocate_blocks_on_demand_ ? current_blocks_count_ : max_blocks_count_;
- DCHECK_GT(current_blocks_count, write_block_num);
+ QUICHE_DCHECK_GT(current_blocks_count, write_block_num);
size_t block_capacity = GetBlockCapacity(write_block_num);
size_t bytes_avail = block_capacity - write_block_offset;
@@ -275,7 +275,7 @@
*bytes_read = 0;
for (size_t i = 0; i < dest_count && ReadableBytes() > 0; ++i) {
char* dest = reinterpret_cast<char*>(dest_iov[i].iov_base);
- DCHECK(dest != nullptr);
+ QUICHE_DCHECK(dest != nullptr);
size_t dest_remaining = dest_iov[i].iov_len;
while (dest_remaining > 0 && ReadableBytes() > 0) {
size_t block_idx = NextBlockToRead();
@@ -285,7 +285,7 @@
ReadableBytes(), block_capacity - start_offset_in_block);
size_t bytes_to_copy =
std::min<size_t>(bytes_available_in_block, dest_remaining);
- DCHECK_GT(bytes_to_copy, 0u);
+ QUICHE_DCHECK_GT(bytes_to_copy, 0u);
if (blocks_[block_idx] == nullptr || dest == nullptr) {
*error_details = absl::StrCat(
"QuicStreamSequencerBuffer error:"
@@ -328,8 +328,8 @@
int QuicStreamSequencerBuffer::GetReadableRegions(struct iovec* iov,
int iov_len) const {
- DCHECK(iov != nullptr);
- DCHECK_GT(iov_len, 0);
+ QUICHE_DCHECK(iov != nullptr);
+ QUICHE_DCHECK_GT(iov_len, 0);
if (ReadableBytes() == 0) {
iov[0].iov_base = nullptr;
@@ -339,7 +339,7 @@
size_t start_block_idx = NextBlockToRead();
QuicStreamOffset readable_offset_end = FirstMissingByte() - 1;
- DCHECK_GE(readable_offset_end + 1, total_bytes_read_);
+ QUICHE_DCHECK_GE(readable_offset_end + 1, total_bytes_read_);
size_t end_block_offset = GetInBlockOffset(readable_offset_end);
size_t end_block_idx = GetBlockIndex(readable_offset_end);
@@ -356,7 +356,7 @@
iov[0].iov_len = GetBlockCapacity(start_block_idx) - ReadOffset();
QUIC_DVLOG(1) << "Got first block " << start_block_idx << " with len "
<< iov[0].iov_len;
- DCHECK_GT(readable_offset_end + 1, total_bytes_read_ + iov[0].iov_len)
+ QUICHE_DCHECK_GT(readable_offset_end + 1, total_bytes_read_ + iov[0].iov_len)
<< "there should be more available data";
// Get readable regions of the rest blocks till either 2nd to last block
@@ -365,7 +365,7 @@
int iov_used = 1;
size_t block_idx = (start_block_idx + iov_used) % max_blocks_count_;
while (block_idx != end_block_idx && iov_used < iov_len) {
- DCHECK(nullptr != blocks_[block_idx]);
+ QUICHE_DCHECK(nullptr != blocks_[block_idx]);
iov[iov_used].iov_base = blocks_[block_idx]->buffer;
iov[iov_used].iov_len = GetBlockCapacity(block_idx);
QUIC_DVLOG(1) << "Got block with index: " << block_idx;
@@ -375,7 +375,7 @@
// Deal with last block if |iov| can hold more.
if (iov_used < iov_len) {
- DCHECK(nullptr != blocks_[block_idx]);
+ QUICHE_DCHECK(nullptr != blocks_[block_idx]);
iov[iov_used].iov_base = blocks_[end_block_idx]->buffer;
iov[iov_used].iov_len = end_block_offset + 1;
QUIC_DVLOG(1) << "Got last block with index: " << end_block_idx;
@@ -390,7 +390,7 @@
bool QuicStreamSequencerBuffer::PeekRegion(QuicStreamOffset offset,
iovec* iov) const {
- DCHECK(iov);
+ QUICHE_DCHECK(iov);
if (offset < total_bytes_read_) {
// Data at |offset| has already been consumed.
@@ -491,7 +491,8 @@
}
bool QuicStreamSequencerBuffer::RetireBlockIfEmpty(size_t block_index) {
- DCHECK(ReadableBytes() == 0 || GetInBlockOffset(total_bytes_read_) == 0)
+ QUICHE_DCHECK(ReadableBytes() == 0 ||
+ GetInBlockOffset(total_bytes_read_) == 0)
<< "RetireBlockIfEmpty() should only be called when advancing to next "
<< "block or a gap has been reached.";
// If the whole buffer becomes empty, the last piece of data has been read.
diff --git a/quic/core/quic_stream_sequencer_buffer_test.cc b/quic/core/quic_stream_sequencer_buffer_test.cc
index 3c46c41..dc21a09 100644
--- a/quic/core/quic_stream_sequencer_buffer_test.cc
+++ b/quic/core/quic_stream_sequencer_buffer_test.cc
@@ -900,7 +900,7 @@
start_chopping_offset += chunk_size;
++iterations;
}
- DCHECK(start_chopping_offset == bytes_to_buffer_);
+ QUICHE_DCHECK(start_chopping_offset == bytes_to_buffer_);
size_t chunk_num = iterations;
// Randomly change the sequence of in-ordered OffsetSizePairs to make a
diff --git a/quic/core/quic_time_wait_list_manager.cc b/quic/core/quic_time_wait_list_manager.cc
index 7725eb9..641f5c9 100644
--- a/quic/core/quic_time_wait_list_manager.cc
+++ b/quic/core/quic_time_wait_list_manager.cc
@@ -135,13 +135,13 @@
QuicConnectionId connection_id,
TimeWaitAction action,
TimeWaitConnectionInfo info) {
- DCHECK(!info.active_connection_ids.empty());
+ QUICHE_DCHECK(!info.active_connection_ids.empty());
const QuicConnectionId& canonical_connection_id =
use_indirect_connection_id_map_ ? info.active_connection_ids.front()
: connection_id;
- DCHECK(action != SEND_TERMINATION_PACKETS ||
- !info.termination_packets.empty());
- DCHECK(action != DO_NOTHING || info.ietf_quic);
+ QUICHE_DCHECK(action != SEND_TERMINATION_PACKETS ||
+ !info.termination_packets.empty());
+ QUICHE_DCHECK(action != DO_NOTHING || info.ietf_quic);
int num_packets = 0;
auto it = FindConnectionIdDataInMap(canonical_connection_id);
const bool new_connection_id = it == connection_id_map_.end();
@@ -152,8 +152,8 @@
TrimTimeWaitListIfNeeded();
int64_t max_connections =
GetQuicFlag(FLAGS_quic_time_wait_list_max_connections);
- DCHECK(connection_id_map_.empty() ||
- num_connections() < static_cast<size_t>(max_connections));
+ QUICHE_DCHECK(connection_id_map_.empty() ||
+ num_connections() < static_cast<size_t>(max_connections));
if (use_indirect_connection_id_map_ && new_connection_id) {
QUIC_RESTART_FLAG_COUNT_N(quic_time_wait_list_support_multiple_cid_v2, 3,
3);
@@ -193,11 +193,11 @@
QuicConnectionId connection_id,
PacketHeaderFormat header_format,
std::unique_ptr<QuicPerPacketContext> packet_context) {
- DCHECK(IsConnectionIdInTimeWait(connection_id));
+ QUICHE_DCHECK(IsConnectionIdInTimeWait(connection_id));
// TODO(satyamshekhar): Think about handling packets from different peer
// addresses.
auto it = FindConnectionIdDataInMap(connection_id);
- DCHECK(it != connection_id_map_.end());
+ QUICHE_DCHECK(it != connection_id_map_.end());
// Increment the received packet count.
ConnectionIdData* connection_data = &it->second;
++(connection_data->num_packets);
@@ -278,7 +278,7 @@
return;
case DO_NOTHING:
QUIC_CODE_COUNT(quic_time_wait_list_do_nothing);
- DCHECK(connection_data->info.ietf_quic);
+ QUICHE_DCHECK(connection_data->info.ietf_quic);
}
}
@@ -402,7 +402,7 @@
if (IsWriteBlockedStatus(result.status)) {
// If blocked and unbuffered, return false to retry sending.
- DCHECK(writer_->IsWriteBlocked());
+ QUICHE_DCHECK(writer_->IsWriteBlocked());
visitor_->OnWriteBlocked(this);
return result.status == WRITE_STATUS_BLOCKED_DATA_BUFFERED;
} else if (IsWriteError(result.status)) {
diff --git a/quic/core/quic_trace_visitor_test.cc b/quic/core/quic_trace_visitor_test.cc
index 0371982..5ebaea8 100644
--- a/quic/core/quic_trace_visitor_test.cc
+++ b/quic/core/quic_trace_visitor_test.cc
@@ -48,11 +48,11 @@
client.AddBytesToTransfer(kTransferSize);
bool simulator_result = simulator.RunUntilOrTimeout(
[&]() { return server.bytes_received() >= kTransferSize; }, kDeadline);
- CHECK(simulator_result);
+ QUICHE_CHECK(simulator_result);
// Save the trace and ensure some loss was observed.
trace_.Swap(visitor.trace());
- CHECK_NE(0u, client.connection()->GetStats().packets_retransmitted);
+ QUICHE_CHECK_NE(0u, client.connection()->GetStats().packets_retransmitted);
packets_sent_ = client.connection()->GetStats().packets_sent;
}
diff --git a/quic/core/quic_udp_socket_posix.cc b/quic/core/quic_udp_socket_posix.cc
index 8b3060d..e410635 100644
--- a/quic/core/quic_udp_socket_posix.cc
+++ b/quic/core/quic_udp_socket_posix.cc
@@ -102,7 +102,7 @@
void SetV4SelfIpInControlMessage(const QuicIpAddress& self_address,
cmsghdr* cmsg) {
- DCHECK(self_address.IsIPv4());
+ QUICHE_DCHECK(self_address.IsIPv4());
in_pktinfo* pktinfo = reinterpret_cast<in_pktinfo*>(CMSG_DATA(cmsg));
memset(pktinfo, 0, sizeof(in_pktinfo));
pktinfo->ipi_ifindex = 0;
@@ -113,7 +113,7 @@
void SetV6SelfIpInControlMessage(const QuicIpAddress& self_address,
cmsghdr* cmsg) {
- DCHECK(self_address.IsIPv6());
+ QUICHE_DCHECK(self_address.IsIPv6());
in6_pktinfo* pktinfo = reinterpret_cast<in6_pktinfo*>(CMSG_DATA(cmsg));
memset(pktinfo, 0, sizeof(in6_pktinfo));
std::string address_string = self_address.ToPackedString();
@@ -212,12 +212,12 @@
}
if ((*cmsg) == nullptr) {
- DCHECK_EQ(nullptr, hdr->msg_control);
+ QUICHE_DCHECK_EQ(nullptr, hdr->msg_control);
memset(control_buffer, 0, control_buffer_len);
hdr->msg_control = control_buffer;
(*cmsg) = CMSG_FIRSTHDR(hdr);
} else {
- DCHECK_NE(nullptr, hdr->msg_control);
+ QUICHE_DCHECK_NE(nullptr, hdr->msg_control);
(*cmsg) = CMSG_NXTHDR(hdr, (*cmsg));
}
@@ -237,10 +237,10 @@
int receive_buffer_size,
int send_buffer_size,
bool ipv6_only) {
- // DCHECK here so the program exits early(before reading packets) in debug
- // mode. This should have been a static_assert, however it can't be done on
- // ios/osx because CMSG_SPACE isn't a constant expression there.
- DCHECK_GE(kDefaultUdpPacketControlBufferSize, kMinCmsgSpaceForRead);
+ // QUICHE_DCHECK here so the program exits early(before reading packets) in
+ // debug mode. This should have been a static_assert, however it can't be done
+ // on ios/osx because CMSG_SPACE isn't a constant expression there.
+ QUICHE_DCHECK_GE(kDefaultUdpPacketControlBufferSize, kMinCmsgSpaceForRead);
QuicUdpSocketFd fd = CreateNonblockingSocket(address_family);
if (fd == kQuicInvalidSocketFd) {
@@ -383,7 +383,7 @@
BufferSpan& control_buffer = result->control_buffer;
QuicUdpPacketInfo* packet_info = &result->packet_info;
- DCHECK_GE(control_buffer.buffer_len, kMinCmsgSpaceForRead);
+ QUICHE_DCHECK_GE(control_buffer.buffer_len, kMinCmsgSpaceForRead);
struct iovec iov = {packet_buffer.buffer, packet_buffer.buffer_len};
struct sockaddr_storage raw_peer_address;
@@ -488,7 +488,7 @@
hdr->msg_control = (*results)[i].control_buffer.buffer;
hdr->msg_controllen = (*results)[i].control_buffer.buffer_len;
- DCHECK_GE(hdr->msg_controllen, kMinCmsgSpaceForRead);
+ QUICHE_DCHECK_GE(hdr->msg_controllen, kMinCmsgSpaceForRead);
}
// If MSG_TRUNC is set on Linux, recvmmsg will return the real packet size in
// |hdrs[i].msg_len| even if packet buffer is too small to receive it.
diff --git a/quic/core/quic_unacked_packet_map.cc b/quic/core/quic_unacked_packet_map.cc
index acb30d5..b6872ff 100644
--- a/quic/core/quic_unacked_packet_map.cc
+++ b/quic/core/quic_unacked_packet_map.cc
@@ -153,7 +153,7 @@
largest_sent_packet_ >= packet_number)
<< "largest_sent_packet_: " << largest_sent_packet_
<< ", packet_number: " << packet_number;
- DCHECK_GE(packet_number, least_unacked_ + unacked_packets_size());
+ QUICHE_DCHECK_GE(packet_number, least_unacked_ + unacked_packets_size());
while (least_unacked_ + unacked_packets_size() < packet_number) {
unacked_packets_push_back(QuicTransmissionInfo());
unacked_packets_back().state = NEVER_SENT;
@@ -207,8 +207,8 @@
bool QuicUnackedPacketMap::HasRetransmittableFrames(
QuicPacketNumber packet_number) const {
- DCHECK_GE(packet_number, least_unacked_);
- DCHECK_LT(packet_number, least_unacked_ + unacked_packets_size());
+ QUICHE_DCHECK_GE(packet_number, least_unacked_);
+ QUICHE_DCHECK_LT(packet_number, least_unacked_ + unacked_packets_size());
return HasRetransmittableFrames(
unacked_packets_at(packet_number - least_unacked_));
}
@@ -235,8 +235,8 @@
void QuicUnackedPacketMap::RemoveRetransmittability(
QuicPacketNumber packet_number) {
- DCHECK_GE(packet_number, least_unacked_);
- DCHECK_LT(packet_number, least_unacked_ + unacked_packets_size());
+ QUICHE_DCHECK_GE(packet_number, least_unacked_);
+ QUICHE_DCHECK_LT(packet_number, least_unacked_ + unacked_packets_size());
QuicTransmissionInfo* info =
&unacked_packets_at(packet_number - least_unacked_);
RemoveRetransmittability(info);
@@ -244,7 +244,8 @@
void QuicUnackedPacketMap::IncreaseLargestAcked(
QuicPacketNumber largest_acked) {
- DCHECK(!largest_acked_.IsInitialized() || largest_acked_ <= largest_acked);
+ QUICHE_DCHECK(!largest_acked_.IsInitialized() ||
+ largest_acked_ <= largest_acked);
largest_acked_ = largest_acked;
}
@@ -325,8 +326,8 @@
}
void QuicUnackedPacketMap::RemoveFromInFlight(QuicPacketNumber packet_number) {
- DCHECK_GE(packet_number, least_unacked_);
- DCHECK_LT(packet_number, least_unacked_ + unacked_packets_size());
+ QUICHE_DCHECK_GE(packet_number, least_unacked_);
+ QUICHE_DCHECK_LT(packet_number, least_unacked_ + unacked_packets_size());
QuicTransmissionInfo* info =
&unacked_packets_at(packet_number - least_unacked_);
RemoveFromInFlight(info);
@@ -351,11 +352,12 @@
// send algorithm).
// TODO(b/148868195): use NotifyFramesNeutered.
NotifyFramesAcked(*it, QuicTime::Delta::Zero(), QuicTime::Zero());
- DCHECK(!HasRetransmittableFrames(*it));
+ QUICHE_DCHECK(!HasRetransmittableFrames(*it));
}
}
- DCHECK(!supports_multiple_packet_number_spaces_ ||
- last_inflight_packets_sent_time_[INITIAL_DATA] == QuicTime::Zero());
+ QUICHE_DCHECK(!supports_multiple_packet_number_spaces_ ||
+ last_inflight_packets_sent_time_[INITIAL_DATA] ==
+ QuicTime::Zero());
return neutered_packets;
}
@@ -377,8 +379,9 @@
NotifyFramesAcked(*it, QuicTime::Delta::Zero(), QuicTime::Zero());
}
}
- DCHECK(!supports_multiple_packet_number_spaces() ||
- last_inflight_packets_sent_time_[HANDSHAKE_DATA] == QuicTime::Zero());
+ QUICHE_DCHECK(!supports_multiple_packet_number_spaces() ||
+ last_inflight_packets_sent_time_[HANDSHAKE_DATA] ==
+ QuicTime::Zero());
return neutered_packets;
}
@@ -593,13 +596,13 @@
const QuicTransmissionInfo*
QuicUnackedPacketMap::GetFirstInFlightTransmissionInfo() const {
- DCHECK(HasInFlightPackets());
+ QUICHE_DCHECK(HasInFlightPackets());
for (auto it = begin(); it != end(); ++it) {
if (it->in_flight) {
return &(*it);
}
}
- DCHECK(false);
+ QUICHE_DCHECK(false);
return nullptr;
}
diff --git a/quic/core/quic_unacked_packet_map_test.cc b/quic/core/quic_unacked_packet_map_test.cc
index a024fe8..eb6b0a6 100644
--- a/quic/core/quic_unacked_packet_map_test.cc
+++ b/quic/core/quic_unacked_packet_map_test.cc
@@ -136,7 +136,7 @@
void RetransmitAndSendPacket(uint64_t old_packet_number,
uint64_t new_packet_number,
TransmissionType transmission_type) {
- DCHECK(unacked_packets_.HasRetransmittableFrames(
+ QUICHE_DCHECK(unacked_packets_.HasRetransmittableFrames(
QuicPacketNumber(old_packet_number)));
QuicTransmissionInfo* info = unacked_packets_.GetMutableTransmissionInfo(
QuicPacketNumber(old_packet_number));
diff --git a/quic/core/quic_utils.cc b/quic/core/quic_utils.cc
index f044cef..7eff759 100644
--- a/quic/core/quic_utils.cc
+++ b/quic/core/quic_utils.cc
@@ -244,8 +244,8 @@
iov_offset -= iov[iovnum].iov_len;
++iovnum;
}
- DCHECK_LE(iovnum, iov_count);
- DCHECK_LE(iov_offset, iov[iovnum].iov_len);
+ QUICHE_DCHECK_LE(iovnum, iov_count);
+ QUICHE_DCHECK_LE(iov_offset, iov[iovnum].iov_len);
if (iovnum >= iov_count || buffer_length == 0) {
return;
}
@@ -397,7 +397,7 @@
// static
QuicStreamId QuicUtils::GetHeadersStreamId(QuicTransportVersion version) {
- DCHECK(!VersionUsesHttp3(version));
+ QUICHE_DCHECK(!VersionUsesHttp3(version));
return GetFirstBidirectionalStreamId(version, Perspective::IS_CLIENT);
}
@@ -435,7 +435,7 @@
// static
bool QuicUtils::IsBidirectionalStreamId(QuicStreamId id,
ParsedQuicVersion version) {
- DCHECK(version.HasIetfQuicFrames());
+ QUICHE_DCHECK(version.HasIetfQuicFrames());
return id % 4 < 2;
}
@@ -444,26 +444,26 @@
Perspective perspective,
bool peer_initiated,
ParsedQuicVersion version) {
- DCHECK(version.HasIetfQuicFrames());
+ QUICHE_DCHECK(version.HasIetfQuicFrames());
if (IsBidirectionalStreamId(id, version)) {
return BIDIRECTIONAL;
}
if (peer_initiated) {
if (perspective == Perspective::IS_SERVER) {
- DCHECK_EQ(2u, id % 4);
+ QUICHE_DCHECK_EQ(2u, id % 4);
} else {
- DCHECK_EQ(Perspective::IS_CLIENT, perspective);
- DCHECK_EQ(3u, id % 4);
+ QUICHE_DCHECK_EQ(Perspective::IS_CLIENT, perspective);
+ QUICHE_DCHECK_EQ(3u, id % 4);
}
return READ_UNIDIRECTIONAL;
}
if (perspective == Perspective::IS_SERVER) {
- DCHECK_EQ(3u, id % 4);
+ QUICHE_DCHECK_EQ(3u, id % 4);
} else {
- DCHECK_EQ(Perspective::IS_CLIENT, perspective);
- DCHECK_EQ(2u, id % 4);
+ QUICHE_DCHECK_EQ(Perspective::IS_CLIENT, perspective);
+ QUICHE_DCHECK_EQ(2u, id % 4);
}
return WRITE_UNIDIRECTIONAL;
}
@@ -665,7 +665,7 @@
case APPLICATION_DATA:
return ENCRYPTION_FORWARD_SECURE;
default:
- DCHECK(false);
+ QUICHE_DCHECK(false);
return NUM_ENCRYPTION_LEVELS;
}
}
diff --git a/quic/core/quic_utils_test.cc b/quic/core/quic_utils_test.cc
index 9b61f0f..a5249d7 100644
--- a/quic/core/quic_utils_test.cc
+++ b/quic/core/quic_utils_test.cc
@@ -141,7 +141,7 @@
} else if (i == ALL_INITIAL_RETRANSMISSION) {
EXPECT_EQ(UNACKABLE, state);
} else {
- DCHECK(false)
+ QUICHE_DCHECK(false)
<< "No corresponding packet state according to transmission type: "
<< i;
}
diff --git a/quic/core/quic_versions.cc b/quic/core/quic_versions.cc
index 5dee155..5320dd9 100644
--- a/quic/core/quic_versions.cc
+++ b/quic/core/quic_versions.cc
@@ -65,121 +65,121 @@
} // namespace
bool ParsedQuicVersion::IsKnown() const {
- DCHECK(ParsedQuicVersionIsValid(handshake_protocol, transport_version))
+ QUICHE_DCHECK(ParsedQuicVersionIsValid(handshake_protocol, transport_version))
<< QuicVersionToString(transport_version) << " "
<< HandshakeProtocolToString(handshake_protocol);
return transport_version != QUIC_VERSION_UNSUPPORTED;
}
bool ParsedQuicVersion::KnowsWhichDecrypterToUse() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
return transport_version > QUIC_VERSION_46;
}
bool ParsedQuicVersion::UsesInitialObfuscators() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
// Initial obfuscators were added in version 50.
return transport_version > QUIC_VERSION_46;
}
bool ParsedQuicVersion::AllowsLowFlowControlLimits() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
// Low flow-control limits are used for all IETF versions.
return UsesHttp3();
}
bool ParsedQuicVersion::HasHeaderProtection() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
// Header protection was added in version 50.
return transport_version > QUIC_VERSION_46;
}
bool ParsedQuicVersion::SupportsRetry() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
// Retry was added in version 47.
return transport_version > QUIC_VERSION_46;
}
bool ParsedQuicVersion::SendsVariableLengthPacketNumberInLongHeader() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
return transport_version > QUIC_VERSION_46;
}
bool ParsedQuicVersion::AllowsVariableLengthConnectionIds() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
return VersionAllowsVariableLengthConnectionIds(transport_version);
}
bool ParsedQuicVersion::SupportsClientConnectionIds() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
// Client connection IDs were added in version 49.
return transport_version > QUIC_VERSION_46;
}
bool ParsedQuicVersion::HasLengthPrefixedConnectionIds() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
return VersionHasLengthPrefixedConnectionIds(transport_version);
}
bool ParsedQuicVersion::SupportsAntiAmplificationLimit() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
// The anti-amplification limit is used for all IETF versions.
return UsesHttp3();
}
bool ParsedQuicVersion::CanSendCoalescedPackets() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
return HasLongHeaderLengths() && UsesTls();
}
bool ParsedQuicVersion::SupportsGoogleAltSvcFormat() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
return VersionSupportsGoogleAltSvcFormat(transport_version);
}
bool ParsedQuicVersion::HasIetfInvariantHeader() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
return VersionHasIetfInvariantHeader(transport_version);
}
bool ParsedQuicVersion::SupportsMessageFrames() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
return VersionSupportsMessageFrames(transport_version);
}
bool ParsedQuicVersion::UsesHttp3() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
return VersionUsesHttp3(transport_version);
}
bool ParsedQuicVersion::HasLongHeaderLengths() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
return QuicVersionHasLongHeaderLengths(transport_version);
}
bool ParsedQuicVersion::UsesCryptoFrames() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
return QuicVersionUsesCryptoFrames(transport_version);
}
bool ParsedQuicVersion::HasIetfQuicFrames() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
return VersionHasIetfQuicFrames(transport_version);
}
bool ParsedQuicVersion::UsesTls() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
return handshake_protocol == PROTOCOL_TLS1_3;
}
bool ParsedQuicVersion::UsesQuicCrypto() const {
- DCHECK(IsKnown());
+ QUICHE_DCHECK(IsKnown());
return handshake_protocol == PROTOCOL_QUIC_CRYPTO;
}
bool VersionHasLengthPrefixedConnectionIds(
QuicTransportVersion transport_version) {
- DCHECK(transport_version != QUIC_VERSION_UNSUPPORTED);
+ QUICHE_DCHECK(transport_version != QUIC_VERSION_UNSUPPORTED);
// Length-prefixed connection IDs were added in version 49.
return transport_version > QUIC_VERSION_46;
}
@@ -479,7 +479,7 @@
return "0";
}
if (version == ParsedQuicVersion::Draft29()) {
- DCHECK(version.UsesHttp3());
+ QUICHE_DCHECK(version.UsesHttp3());
return "draft29";
}
@@ -522,7 +522,7 @@
bool VersionAllowsVariableLengthConnectionIds(
QuicTransportVersion transport_version) {
- DCHECK_NE(transport_version, QUIC_VERSION_UNSUPPORTED);
+ QUICHE_DCHECK_NE(transport_version, QUIC_VERSION_UNSUPPORTED);
return transport_version > QUIC_VERSION_46;
}
diff --git a/quic/core/quic_write_blocked_list.cc b/quic/core/quic_write_blocked_list.cc
index 02b72e3..084241d 100644
--- a/quic/core/quic_write_blocked_list.cc
+++ b/quic/core/quic_write_blocked_list.cc
@@ -66,9 +66,9 @@
QuicStreamId stream_id,
bool is_static_stream,
const spdy::SpdyStreamPrecedence& precedence) {
- DCHECK(!priority_write_scheduler_.StreamRegistered(stream_id))
+ QUICHE_DCHECK(!priority_write_scheduler_.StreamRegistered(stream_id))
<< "stream " << stream_id << " already registered";
- DCHECK(precedence.is_spdy3_priority());
+ QUICHE_DCHECK(precedence.is_spdy3_priority());
if (is_static_stream) {
static_stream_collection_.Register(stream_id);
return;
@@ -89,8 +89,8 @@
void QuicWriteBlockedList::UpdateStreamPriority(
QuicStreamId stream_id,
const spdy::SpdyStreamPrecedence& new_precedence) {
- DCHECK(!static_stream_collection_.IsRegistered(stream_id));
- DCHECK(new_precedence.is_spdy3_priority());
+ QUICHE_DCHECK(!static_stream_collection_.IsRegistered(stream_id));
+ QUICHE_DCHECK(new_precedence.is_spdy3_priority());
priority_write_scheduler_.UpdateStreamPrecedence(stream_id, new_precedence);
}
@@ -126,7 +126,7 @@
}
void QuicWriteBlockedList::StaticStreamCollection::Register(QuicStreamId id) {
- DCHECK(!IsRegistered(id));
+ QUICHE_DCHECK(!IsRegistered(id));
streams_.push_back({id, false});
}
@@ -150,7 +150,7 @@
return;
}
}
- DCHECK(false) << "Erasing a non-exist stream with id " << id;
+ QUICHE_DCHECK(false) << "Erasing a non-exist stream with id " << id;
}
bool QuicWriteBlockedList::StaticStreamCollection::SetBlocked(QuicStreamId id) {
diff --git a/quic/core/tls_chlo_extractor.cc b/quic/core/tls_chlo_extractor.cc
index 89aaea8..e03d7db 100644
--- a/quic/core/tls_chlo_extractor.cc
+++ b/quic/core/tls_chlo_extractor.cc
@@ -43,7 +43,7 @@
std::pair<SSL_CTX*, int> shared_handles = GetSharedSslHandles();
int ex_data_index = shared_handles.second;
const int rv = SSL_set_ex_data(ssl_.get(), ex_data_index, this);
- CHECK_EQ(rv, 1) << "Internal allocation failure in SSL_set_ex_data";
+ QUICHE_CHECK_EQ(rv, 1) << "Internal allocation failure in SSL_set_ex_data";
}
state_ = other.state_;
error_details_ = std::move(other.error_details_);
@@ -355,7 +355,7 @@
ssl_ = bssl::UniquePtr<SSL>(SSL_new(ssl_ctx));
const int rv = SSL_set_ex_data(ssl_.get(), ex_data_index, this);
- CHECK_EQ(rv, 1) << "Internal allocation failure in SSL_set_ex_data";
+ QUICHE_CHECK_EQ(rv, 1) << "Internal allocation failure in SSL_set_ex_data";
SSL_set_accept_state(ssl_.get());
}
diff --git a/quic/core/tls_client_handshaker.cc b/quic/core/tls_client_handshaker.cc
index e82e94d..b878ab8 100644
--- a/quic/core/tls_client_handshaker.cc
+++ b/quic/core/tls_client_handshaker.cc
@@ -223,7 +223,7 @@
session()->connection()->version(), Perspective::IS_SERVER,
param_bytes, param_bytes_len, received_transport_params_.get(),
&parse_error_details)) {
- DCHECK(!parse_error_details.empty());
+ QUICHE_DCHECK(!parse_error_details.empty());
*error_details =
"Unable to parse server's transport parameters: " + parse_error_details;
return false;
@@ -256,7 +256,7 @@
handshaker_delegate()->ProcessTransportParameters(
*received_transport_params_, /* is_resumption = */ false,
error_details) != QUIC_NO_ERROR) {
- DCHECK(!error_details->empty());
+ QUICHE_DCHECK(!error_details->empty());
return false;
}
@@ -395,7 +395,7 @@
}
void TlsClientHandshaker::OnHandshakeConfirmed() {
- DCHECK(one_rtt_keys_available());
+ QUICHE_DCHECK(one_rtt_keys_available());
if (state_ >= HANDSHAKE_CONFIRMED) {
return;
}
@@ -457,7 +457,7 @@
std::string error_details;
if (!ProcessTransportParameters(&error_details)) {
- DCHECK(!error_details.empty());
+ QUICHE_DCHECK(!error_details.empty());
CloseConnection(QUIC_HANDSHAKE_FAILED, error_details);
return;
}
@@ -528,7 +528,7 @@
void TlsClientHandshaker::HandleZeroRttReject() {
QUIC_LOG(INFO) << "0-RTT handshake attempted but was rejected by the server";
- DCHECK(session_cache_);
+ QUICHE_DCHECK(session_cache_);
// Disable encrytion to block outgoing data until 1-RTT keys are available.
encryption_established_ = false;
handshaker_delegate()->OnZeroRttRejected(EarlyDataReason());
@@ -569,7 +569,7 @@
void TlsClientHandshaker::SetServerApplicationStateForResumption(
std::unique_ptr<ApplicationState> application_state) {
- DCHECK(one_rtt_keys_available());
+ QUICHE_DCHECK(one_rtt_keys_available());
received_application_state_ = std::move(application_state);
// At least one tls session is cached before application state is received. So
// insert now.
diff --git a/quic/core/tls_handshaker.cc b/quic/core/tls_handshaker.cc
index d0079c5..133c85c 100644
--- a/quic/core/tls_handshaker.cc
+++ b/quic/core/tls_handshaker.cc
@@ -114,7 +114,7 @@
void TlsHandshaker::CloseConnection(QuicErrorCode error,
const std::string& reason_phrase) {
- DCHECK(!reason_phrase.empty());
+ QUICHE_DCHECK(!reason_phrase.empty());
stream()->OnUnrecoverableError(error, reason_phrase);
is_connection_closed_ = true;
}
@@ -122,7 +122,7 @@
void TlsHandshaker::CloseConnection(QuicErrorCode error,
QuicIetfTransportErrorCodes ietf_error,
const std::string& reason_phrase) {
- DCHECK(!reason_phrase.empty());
+ QUICHE_DCHECK(!reason_phrase.empty());
stream()->OnUnrecoverableError(error, ietf_error, reason_phrase);
is_connection_closed_ = true;
}
@@ -212,7 +212,7 @@
absl::string_view(reinterpret_cast<char*>(header_protection_key.data()),
header_protection_key.size()));
if (level == ENCRYPTION_FORWARD_SECURE) {
- DCHECK(latest_write_secret_.empty());
+ QUICHE_DCHECK(latest_write_secret_.empty());
latest_write_secret_ = write_secret;
one_rtt_write_header_protection_key_ = header_protection_key;
}
@@ -235,7 +235,7 @@
absl::string_view(reinterpret_cast<char*>(header_protection_key.data()),
header_protection_key.size()));
if (level == ENCRYPTION_FORWARD_SECURE) {
- DCHECK(latest_read_secret_.empty());
+ QUICHE_DCHECK(latest_read_secret_.empty());
latest_read_secret_ = read_secret;
one_rtt_read_header_protection_key_ = header_protection_key;
}
diff --git a/quic/core/tls_server_handshaker.cc b/quic/core/tls_server_handshaker.cc
index 48710c1..02fceed 100644
--- a/quic/core/tls_server_handshaker.cc
+++ b/quic/core/tls_server_handshaker.cc
@@ -111,7 +111,7 @@
TlsServerHandshaker::SignatureCallback::SignatureCallback(
TlsServerHandshaker* handshaker)
: handshaker_(handshaker) {
- DCHECK(!handshaker_->use_proof_source_handle_);
+ QUICHE_DCHECK(!handshaker_->use_proof_source_handle_);
}
void TlsServerHandshaker::SignatureCallback::Run(
@@ -169,7 +169,7 @@
}
void TlsServerHandshaker::DecryptCallback::Cancel() {
- DCHECK(handshaker_);
+ QUICHE_DCHECK(handshaker_);
handshaker_ = nullptr;
}
@@ -183,8 +183,8 @@
crypto_negotiated_params_(new QuicCryptoNegotiatedParameters),
tls_connection_(crypto_config->ssl_ctx(), this),
crypto_config_(crypto_config) {
- DCHECK_EQ(PROTOCOL_TLS1_3,
- session->connection()->version().handshake_protocol);
+ QUICHE_DCHECK_EQ(PROTOCOL_TLS1_3,
+ session->connection()->version().handshake_protocol);
// Configure the SSL to be a server.
SSL_set_accept_state(ssl());
@@ -214,7 +214,7 @@
std::unique_ptr<ProofSourceHandle>
TlsServerHandshaker::MaybeCreateProofSourceHandle() {
- DCHECK(use_proof_source_handle_);
+ QUICHE_DCHECK(use_proof_source_handle_);
return std::make_unique<DefaultProofSourceHandle>(this, proof_source_);
}
@@ -263,11 +263,11 @@
}
void TlsServerHandshaker::OnHandshakeDoneReceived() {
- DCHECK(false);
+ QUICHE_DCHECK(false);
}
void TlsServerHandshaker::OnNewTokenReceived(absl::string_view /*token*/) {
- DCHECK(false);
+ QUICHE_DCHECK(false);
}
std::string TlsServerHandshaker::GetAddressToken() const {
@@ -388,7 +388,7 @@
params_bytes_len = 0;
}
} else {
- DCHECK_EQ(client_hello, nullptr);
+ QUICHE_DCHECK_EQ(client_hello, nullptr);
SSL_get_peer_quic_transport_params(ssl(), &client_params_bytes,
¶ms_bytes_len);
}
@@ -402,7 +402,7 @@
Perspective::IS_CLIENT, client_params_bytes,
params_bytes_len, &client_params,
&parse_error_details)) {
- DCHECK(!parse_error_details.empty());
+ QUICHE_DCHECK(!parse_error_details.empty());
*error_details =
"Unable to parse client's transport parameters: " + parse_error_details;
return false;
@@ -451,7 +451,7 @@
TlsServerHandshaker::SetTransportParametersResult
TlsServerHandshaker::SetTransportParameters() {
SetTransportParametersResult result;
- DCHECK(!result.success);
+ QUICHE_DCHECK(!result.success);
TransportParameters server_params;
server_params.perspective = Perspective::IS_SERVER;
@@ -580,7 +580,7 @@
size_t max_out,
uint16_t sig_alg,
absl::string_view in) {
- DCHECK_EQ(expected_ssl_error(), SSL_ERROR_WANT_READ);
+ QUICHE_DCHECK_EQ(expected_ssl_error(), SSL_ERROR_WANT_READ);
if (use_proof_source_handle_) {
QUIC_RELOADABLE_FLAG_COUNT_N(quic_tls_use_per_handshaker_proof_source, 2,
3);
@@ -631,7 +631,7 @@
QUIC_DVLOG(1) << "OnComputeSignatureDone. ok:" << ok
<< ", is_sync:" << is_sync
<< ", len(signature):" << signature.size();
- DCHECK(use_proof_source_handle_);
+ QUICHE_DCHECK(use_proof_source_handle_);
if (ok) {
cert_verify_sig_ = std::move(signature);
proof_source_details_ = std::move(details);
@@ -639,7 +639,8 @@
const int last_expected_ssl_error = expected_ssl_error();
set_expected_ssl_error(SSL_ERROR_WANT_READ);
if (!is_sync) {
- DCHECK_EQ(last_expected_ssl_error, SSL_ERROR_WANT_PRIVATE_KEY_OPERATION);
+ QUICHE_DCHECK_EQ(last_expected_ssl_error,
+ SSL_ERROR_WANT_PRIVATE_KEY_OPERATION);
AdvanceHandshakeFromCallback();
}
}
@@ -650,7 +651,7 @@
}
size_t TlsServerHandshaker::SessionTicketMaxOverhead() {
- DCHECK(proof_source_->GetTicketCrypter());
+ QUICHE_DCHECK(proof_source_->GetTicketCrypter());
return proof_source_->GetTicketCrypter()->MaxOverhead();
}
@@ -658,7 +659,7 @@
size_t* out_len,
size_t max_out_len,
absl::string_view in) {
- DCHECK(proof_source_->GetTicketCrypter());
+ QUICHE_DCHECK(proof_source_->GetTicketCrypter());
std::vector<uint8_t> ticket = proof_source_->GetTicketCrypter()->Encrypt(in);
if (max_out_len < ticket.size()) {
QUIC_BUG
@@ -677,7 +678,7 @@
size_t* out_len,
size_t max_out_len,
absl::string_view in) {
- DCHECK(proof_source_->GetTicketCrypter());
+ QUICHE_DCHECK(proof_source_->GetTicketCrypter());
if (!ticket_decryption_callback_) {
ticket_received_ = true;
@@ -788,7 +789,7 @@
set_transport_params_result.quic_transport_params,
set_transport_params_result.early_data_context);
- DCHECK_EQ(status, select_cert_status().value());
+ QUICHE_DCHECK_EQ(status, select_cert_status().value());
if (status == QUIC_PENDING) {
set_expected_ssl_error(SSL_ERROR_PENDING_CERTIFICATE);
@@ -838,7 +839,7 @@
const ProofSource::Chain* chain) {
QUIC_DVLOG(1) << "OnSelectCertificateDone. ok:" << ok
<< ", is_sync:" << is_sync;
- DCHECK(use_proof_source_handle_);
+ QUICHE_DCHECK(use_proof_source_handle_);
select_cert_status_ = QUIC_FAILURE;
if (ok) {
@@ -852,7 +853,7 @@
const int last_expected_ssl_error = expected_ssl_error();
set_expected_ssl_error(SSL_ERROR_WANT_READ);
if (!is_sync) {
- DCHECK_EQ(last_expected_ssl_error, SSL_ERROR_PENDING_CERTIFICATE);
+ QUICHE_DCHECK_EQ(last_expected_ssl_error, SSL_ERROR_PENDING_CERTIFICATE);
AdvanceHandshakeFromCallback();
}
}
diff --git a/quic/core/tls_server_handshaker_test.cc b/quic/core/tls_server_handshaker_test.cc
index e2cb745..cf1bbc0 100644
--- a/quic/core/tls_server_handshaker_test.cc
+++ b/quic/core/tls_server_handshaker_test.cc
@@ -125,8 +125,8 @@
crypto_config);
}
- CHECK(false) << "Unsupported handshake protocol: "
- << connection()->version().handshake_protocol;
+ QUICHE_CHECK(false) << "Unsupported handshake protocol: "
+ << connection()->version().handshake_protocol;
return nullptr;
}
};
@@ -191,7 +191,7 @@
// strike register worries that we've just overflowed a uint32_t time.
server_connection_->AdvanceTime(QuicTime::Delta::FromSeconds(100000));
- CHECK(server_session);
+ QUICHE_CHECK(server_session);
server_session_.reset(server_session);
}
@@ -226,7 +226,7 @@
helpers_.back().get(), alarm_factories_.back().get(),
server_crypto_config_.get(), &server_compressed_certs_cache_,
&server_connection_, &server_session);
- CHECK(server_session);
+ QUICHE_CHECK(server_session);
server_session_.reset(server_session);
server_handshaker_ = nullptr;
EXPECT_CALL(*server_session_->helper(), CanAcceptClientHello(_, _, _, _, _))
@@ -264,7 +264,7 @@
AlpnForVersion(client_connection_->version());
ON_CALL(*client_session, GetAlpnsToOffer())
.WillByDefault(Return(std::vector<std::string>({default_alpn})));
- CHECK(client_session);
+ QUICHE_CHECK(client_session);
client_session_.reset(client_session);
moved_messages_counts_ = {0, 0};
}
@@ -282,8 +282,8 @@
// Performs a single round of handshake message-exchange between the
// client and server.
void AdvanceHandshakeWithFakeClient() {
- CHECK(server_connection_);
- CHECK(client_session_ != nullptr);
+ QUICHE_CHECK(server_connection_);
+ QUICHE_CHECK(client_session_ != nullptr);
EXPECT_CALL(*client_session_, OnProofValid(_)).Times(testing::AnyNumber());
EXPECT_CALL(*client_session_, OnProofVerifyDetailsAvailable(_))
diff --git a/quic/core/uber_received_packet_manager.cc b/quic/core/uber_received_packet_manager.cc
index 432c357..7235edf 100644
--- a/quic/core/uber_received_packet_manager.cc
+++ b/quic/core/uber_received_packet_manager.cc
@@ -189,7 +189,7 @@
QuicPacketNumber UberReceivedPacketManager::peer_least_packet_awaiting_ack()
const {
- DCHECK(!supports_multiple_packet_number_spaces_);
+ QUICHE_DCHECK(!supports_multiple_packet_number_spaces_);
return received_packet_managers_[0].peer_least_packet_awaiting_ack();
}
@@ -211,13 +211,13 @@
}
const QuicAckFrame& UberReceivedPacketManager::ack_frame() const {
- DCHECK(!supports_multiple_packet_number_spaces_);
+ QUICHE_DCHECK(!supports_multiple_packet_number_spaces_);
return received_packet_managers_[0].ack_frame();
}
const QuicAckFrame& UberReceivedPacketManager::GetAckFrame(
PacketNumberSpace packet_number_space) const {
- DCHECK(supports_multiple_packet_number_spaces_);
+ QUICHE_DCHECK(supports_multiple_packet_number_spaces_);
return received_packet_managers_[packet_number_space].ack_frame();
}
diff --git a/quic/core/uber_received_packet_manager_test.cc b/quic/core/uber_received_packet_manager_test.cc
index 0f8959a..05e4a33 100644
--- a/quic/core/uber_received_packet_manager_test.cc
+++ b/quic/core/uber_received_packet_manager_test.cc
@@ -89,17 +89,17 @@
}
void CheckAckTimeout(QuicTime time) {
- DCHECK(HasPendingAck());
+ QUICHE_DCHECK(HasPendingAck());
if (!manager_->supports_multiple_packet_number_spaces()) {
- DCHECK(manager_->GetAckTimeout(APPLICATION_DATA) == time);
+ QUICHE_DCHECK(manager_->GetAckTimeout(APPLICATION_DATA) == time);
if (time <= clock_.ApproximateNow()) {
// ACK timeout expires, send an ACK.
manager_->ResetAckStates(ENCRYPTION_FORWARD_SECURE);
- DCHECK(!HasPendingAck());
+ QUICHE_DCHECK(!HasPendingAck());
}
return;
}
- DCHECK(manager_->GetEarliestAckTimeout() == time);
+ QUICHE_DCHECK(manager_->GetEarliestAckTimeout() == time);
// Send all expired ACKs.
for (int8_t i = INITIAL_DATA; i < NUM_PACKET_NUMBER_SPACES; ++i) {
const QuicTime ack_timeout =