Skip to content

Commit 4d56cdc

Browse files
asedenocopybara-github
authored andcommitted
Use absl::down_cast in quiche / quic
Upgrade absl to 20260107.0 so we have a version that supports absl::down_cast. Upgrade rules_cc to 0.2.9 to match absl. PiperOrigin-RevId: 865498655
1 parent 0e51c2f commit 4d56cdc

24 files changed

+99
-88
lines changed

MODULE.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ module(name = "quiche")
77
# Last updated 2025-09-09
88
bazel_dep(name = "bazel_skylib", version = "1.8.1")
99

10-
# Last updated 2025-09-09
11-
bazel_dep(name = "rules_cc", version = "0.2.4")
10+
# Last updated 2026-02-04
11+
bazel_dep(name = "rules_cc", version = "0.2.9")
1212

13-
# Last updated 2025-12-15
14-
bazel_dep(name = "abseil-cpp", version = "20250814.1", repo_name = "com_google_absl")
13+
# Last updated 2026-02-04
14+
bazel_dep(name = "abseil-cpp", version = "20260107.0", repo_name = "com_google_absl")
1515

1616
# Last updated 2025-05-29
1717
bazel_dep(name = "protobuf", version = "31.1", repo_name = "com_google_protobuf")

MODULE.bazel.lock

Lines changed: 4 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

quiche/BUILD.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ cc_library(
130130
"@boringssl//:crypto",
131131
"@boringssl//:ssl",
132132
"@com_google_absl//absl/algorithm:container",
133+
"@com_google_absl//absl/base",
133134
"@com_google_absl//absl/base:core_headers",
134135
"@com_google_absl//absl/base:log_severity",
135136
"@com_google_absl//absl/base:nullability",
@@ -195,6 +196,7 @@ cc_library(
195196
deps = [
196197
":quiche_core",
197198
"@boringssl//:crypto",
199+
"@com_google_absl//absl/base",
198200
"@com_google_absl//absl/base:core_headers",
199201
"@com_google_absl//absl/container:flat_hash_map",
200202
"@com_google_absl//absl/container:flat_hash_set",
@@ -229,6 +231,7 @@ cc_library(
229231
":quiche_tool_support",
230232
"@boringssl//:crypto",
231233
"@boringssl//:ssl",
234+
"@com_google_absl//absl/base",
232235
"@com_google_absl//absl/base:core_headers",
233236
"@com_google_absl//absl/base:nullability",
234237
"@com_google_absl//absl/container:flat_hash_map",
@@ -383,6 +386,7 @@ cc_library(
383386
"@boringssl//:crypto",
384387
"@boringssl//:ssl",
385388
"@com_google_absl//absl/algorithm:container",
389+
"@com_google_absl//absl/base",
386390
"@com_google_absl//absl/base:core_headers",
387391
"@com_google_absl//absl/base:nullability",
388392
"@com_google_absl//absl/cleanup",
@@ -445,6 +449,7 @@ cc_library(
445449
":quiche_tool_support",
446450
"@boringssl//:crypto",
447451
"@com_google_absl//absl/algorithm:container",
452+
"@com_google_absl//absl/base",
448453
"@com_google_absl//absl/base:core_headers",
449454
"@com_google_absl//absl/cleanup",
450455
"@com_google_absl//absl/container:flat_hash_map",
@@ -479,6 +484,7 @@ test_suite_from_source_list(
479484
"@boringssl//:crypto",
480485
"@boringssl//:ssl",
481486
"@com_google_absl//absl/algorithm:container",
487+
"@com_google_absl//absl/base",
482488
"@com_google_absl//absl/base:core_headers",
483489
"@com_google_absl//absl/cleanup",
484490
"@com_google_absl//absl/container:flat_hash_map",
@@ -533,6 +539,7 @@ test_suite_from_source_list(
533539
":quiche_core",
534540
":quiche_test_support",
535541
":quiche_tool_support",
542+
"@com_google_absl//absl/base",
536543
"@com_google_absl//absl/base:nullability",
537544
"@com_google_absl//absl/functional:bind_front",
538545
"@com_google_absl//absl/hash",

quiche/quic/core/http/end_to_end_test.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <utility>
1919
#include <vector>
2020

21-
21+
#include "absl/base/casts.h"
2222
#include "absl/strings/str_cat.h"
2323
#include "absl/strings/string_view.h"
2424
#include "absl/synchronization/notification.h"
@@ -477,7 +477,7 @@ class EndToEndTest : public QuicTestWithParam<TestParams> {
477477
return nullptr;
478478
}
479479
EXPECT_EQ(1u, dispatcher->NumSessions());
480-
return static_cast<QuicSpdySession*>(
480+
return absl::down_cast<QuicSpdySession*>(
481481
QuicDispatcherPeer::GetFirstSessionIfAny(dispatcher));
482482
}
483483

@@ -658,7 +658,7 @@ class EndToEndTest : public QuicTestWithParam<TestParams> {
658658
QuicDispatcherPeer::GetAlarmFactory(dispatcher),
659659
std::make_unique<ServerDelegate>(dispatcher));
660660
if (stream_factory_ != nullptr) {
661-
static_cast<QuicTestServer*>(server_thread_->server())
661+
absl::down_cast<QuicTestServer*>(server_thread_->server())
662662
->SetSpdyStreamFactory(stream_factory_);
663663
}
664664

@@ -1053,7 +1053,7 @@ class EndToEndTest : public QuicTestWithParam<TestParams> {
10531053

10541054
QuicConfig PauseServerAndGetLastNegotiatedConfigFromDispatcher() {
10551055
server_thread_->Pause();
1056-
QuicSimpleDispatcher* dispatcher = static_cast<QuicSimpleDispatcher*>(
1056+
QuicSimpleDispatcher* dispatcher = absl::down_cast<QuicSimpleDispatcher*>(
10571057
QuicServerPeer::GetDispatcher(server_thread_->server()));
10581058
std::optional<QuicConfig> config = dispatcher->last_negotiated_config();
10591059
if (!config.has_value()) {
@@ -2385,7 +2385,7 @@ TEST_P(EndToEndTest, QUICHE_SLOW_TEST(AddressTokenNotReusedByClient)) {
23852385
client_->Disconnect();
23862386

23872387
QuicClientSessionCache* session_cache =
2388-
static_cast<QuicClientSessionCache*>(
2388+
absl::down_cast<QuicClientSessionCache*>(
23892389
client_crypto_config->session_cache());
23902390
ASSERT_TRUE(
23912391
!QuicClientSessionCachePeer::GetToken(session_cache, server_id).empty());

quiche/quic/core/http/quic_receive_control_stream_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class QuicReceiveControlStreamTest : public QuicTestWithParam<TestParams> {
9292
session_(connection_) {
9393
EXPECT_CALL(session_, OnCongestionWindowChange(_)).Times(AnyNumber());
9494
session_.Initialize();
95-
EXPECT_CALL(static_cast<const MockQuicCryptoStream&>(
95+
EXPECT_CALL(absl::down_cast<const MockQuicCryptoStream&>(
9696
*session_.GetCryptoStream()),
9797
encryption_established())
9898
.WillRepeatedly(testing::Return(true));

quiche/quic/core/http/quic_server_session_base_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ TEST_P(QuicServerSessionBaseTest, BandwidthResumptionExperiment) {
668668
QuicTime::Delta::FromSeconds(kNumSecondsPerHour + 1));
669669

670670
QuicCryptoServerStreamBase* crypto_stream =
671-
static_cast<QuicCryptoServerStreamBase*>(
671+
absl::down_cast<QuicCryptoServerStreamBase*>(
672672
QuicSessionPeer::GetMutableCryptoStream(session_.get()));
673673

674674
// No effect if no CachedNetworkParameters provided.
@@ -804,7 +804,7 @@ class StreamMemberLifetimeTest : public QuicServerSessionBaseTest {
804804
}
805805

806806
FakeProofSource* GetFakeProofSource() const {
807-
return static_cast<FakeProofSource*>(
807+
return absl::down_cast<FakeProofSource*>(
808808
crypto_config_peer_.GetProofSource());
809809
}
810810

quiche/quic/core/http/quic_spdy_session.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#include <string>
1414
#include <utility>
1515

16-
1716
#include "absl/base/attributes.h"
17+
#include "absl/base/casts.h"
1818
#include "absl/strings/numbers.h"
1919
#include "absl/strings/str_cat.h"
2020
#include "absl/strings/string_view.h"
@@ -864,7 +864,7 @@ void QuicSpdySession::OnHttp3GoAway(uint64_t id) {
864864
stream->version().transport_version, stream->id())) {
865865
return true;
866866
}
867-
QuicSpdyStream* spdy_stream = static_cast<QuicSpdyStream*>(stream);
867+
QuicSpdyStream* spdy_stream = absl::down_cast<QuicSpdyStream*>(stream);
868868
WebTransportHttp3* web_transport = spdy_stream->web_transport();
869869
if (web_transport == nullptr) {
870870
return true;
@@ -981,7 +981,7 @@ QuicSpdyStream* QuicSpdySession::GetOrCreateSpdyDataStream(
981981
ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
982982
return nullptr;
983983
}
984-
return static_cast<QuicSpdyStream*>(stream);
984+
return absl::down_cast<QuicSpdyStream*>(stream);
985985
}
986986

987987
void QuicSpdySession::OnNewEncryptionKeyAvailable(
@@ -1858,7 +1858,7 @@ void QuicSpdySession::OnDatagramReceived(absl::string_view datagram) {
18581858
stream_id64 *= kHttpDatagramStreamIdDivisor;
18591859
QuicStreamId stream_id = static_cast<QuicStreamId>(stream_id64);
18601860
QuicSpdyStream* stream =
1861-
static_cast<QuicSpdyStream*>(GetActiveStream(stream_id));
1861+
absl::down_cast<QuicSpdyStream*>(GetActiveStream(stream_id));
18621862
if (stream == nullptr) {
18631863
QUIC_DLOG(INFO) << "Received HTTP/3 datagram for unknown stream ID "
18641864
<< stream_id;

quiche/quic/core/http/web_transport_http3.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#include <utility>
1212
#include <vector>
1313

14-
1514
#include "absl/algorithm/container.h"
15+
#include "absl/base/casts.h"
1616
#include "absl/status/statusor.h"
1717
#include "absl/strings/string_view.h"
1818
#include "quiche/quic/core/http/quic_spdy_session.h"
@@ -222,7 +222,7 @@ WebTransportStream* WebTransportHttp3::AcceptIncomingUnidirectionalStream() {
222222
// receieved and the time the client has polled for them.
223223
continue;
224224
}
225-
return static_cast<WebTransportHttp3UnidirectionalStream*>(stream)
225+
return absl::down_cast<WebTransportHttp3UnidirectionalStream*>(stream)
226226
->interface();
227227
}
228228
return nullptr;
@@ -264,9 +264,9 @@ webtransport::Stream* WebTransportHttp3::GetStreamById(
264264
const bool bidi = QuicUtils::IsBidirectionalStreamId(
265265
id, ParsedQuicVersion::RFCv1()); // Assume IETF QUIC for WebTransport
266266
if (bidi) {
267-
return static_cast<QuicSpdyStream*>(stream)->web_transport_stream();
267+
return absl::down_cast<QuicSpdyStream*>(stream)->web_transport_stream();
268268
} else {
269-
return static_cast<WebTransportHttp3UnidirectionalStream*>(stream)
269+
return absl::down_cast<WebTransportHttp3UnidirectionalStream*>(stream)
270270
->interface();
271271
}
272272
}

quiche/quic/core/qpack/qpack_receive_stream_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class QpackReceiveStreamTest : public QuicTestWithParam<TestParams> {
5858
session_(connection_) {
5959
EXPECT_CALL(session_, OnCongestionWindowChange(_)).Times(AnyNumber());
6060
session_.Initialize();
61-
EXPECT_CALL(static_cast<const MockQuicCryptoStream&>(
61+
EXPECT_CALL(absl::down_cast<const MockQuicCryptoStream&>(
6262
*session_.GetCryptoStream()),
6363
encryption_established())
6464
.WillRepeatedly(testing::Return(true));

quiche/quic/core/quic_connection_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ class TestConnection : public QuicConnection {
543543

544544
private:
545545
TestPacketWriter* writer() {
546-
return static_cast<TestPacketWriter*>(QuicConnection::writer());
546+
return absl::down_cast<TestPacketWriter*>(QuicConnection::writer());
547547
}
548548

549549
SimpleDataProducer producer_;

0 commit comments

Comments
 (0)