Replace absl::optional with std::optional in QUICHE.
Chrome has switched to those two types being the same, so we don't have any reason to use the Abseil version anymore.
PiperOrigin-RevId: 580345251
diff --git a/quiche/quic/core/quic_stream_test.cc b/quiche/quic/core/quic_stream_test.cc
index 7afbb19..e1e607d 100644
--- a/quiche/quic/core/quic_stream_test.cc
+++ b/quiche/quic/core/quic_stream_test.cc
@@ -5,13 +5,13 @@
#include "quiche/quic/core/quic_stream.h"
#include <memory>
+#include <optional>
#include <string>
#include <utility>
#include "absl/base/macros.h"
#include "absl/memory/memory.h"
#include "absl/strings/string_view.h"
-#include "absl/types/optional.h"
#include "quiche/quic/core/crypto/null_encrypter.h"
#include "quiche/quic/core/frames/quic_rst_stream_frame.h"
#include "quiche/quic/core/quic_connection.h"
@@ -137,7 +137,7 @@
QuicConsumedData CloseStreamOnWriteError(
QuicStreamId id, QuicByteCount /*write_length*/,
QuicStreamOffset /*offset*/, StreamSendingState /*state*/,
- TransmissionType /*type*/, absl::optional<EncryptionLevel> /*level*/) {
+ TransmissionType /*type*/, std::optional<EncryptionLevel> /*level*/) {
session_->ResetStream(id, QUIC_STREAM_CANCELLED);
return QuicConsumedData(1, false);
}
@@ -378,7 +378,7 @@
EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this]() {
return session_->ConsumeData(stream_->id(), 1u, 0u, NO_FIN,
- NOT_RETRANSMISSION, absl::nullopt);
+ NOT_RETRANSMISSION, std::nullopt);
}));
stream_->WriteOrBufferData(absl::string_view(kData1, 2), false, nullptr);
EXPECT_TRUE(session_->HasUnackedStreamData());
@@ -396,7 +396,7 @@
EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this]() {
return session_->ConsumeData(stream_->id(), 2u, 0u, NO_FIN,
- NOT_RETRANSMISSION, absl::nullopt);
+ NOT_RETRANSMISSION, std::nullopt);
}));
stream_->WriteOrBufferData(absl::string_view(kData1, 2), true, nullptr);
EXPECT_TRUE(session_->HasUnackedStreamData());
@@ -442,7 +442,7 @@
EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this]() {
return session_->ConsumeData(stream_->id(), kDataLen - 1, 0u, NO_FIN,
- NOT_RETRANSMISSION, absl::nullopt);
+ NOT_RETRANSMISSION, std::nullopt);
}));
stream_->WriteOrBufferData(kData1, false, nullptr);
@@ -458,7 +458,7 @@
EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this]() {
return session_->ConsumeData(stream_->id(), kDataLen - 1, kDataLen - 1,
- NO_FIN, NOT_RETRANSMISSION, absl::nullopt);
+ NO_FIN, NOT_RETRANSMISSION, std::nullopt);
}));
EXPECT_CALL(*stream_, OnCanWriteNewData());
stream_->OnCanWrite();
@@ -468,7 +468,7 @@
EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this]() {
return session_->ConsumeData(stream_->id(), 2u, 2 * kDataLen - 2,
- NO_FIN, NOT_RETRANSMISSION, absl::nullopt);
+ NO_FIN, NOT_RETRANSMISSION, std::nullopt);
}));
EXPECT_CALL(*stream_, OnCanWriteNewData());
stream_->OnCanWrite();
@@ -527,7 +527,7 @@
EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this]() {
return session_->ConsumeData(stream_->id(), 1u, 0u, NO_FIN,
- NOT_RETRANSMISSION, absl::nullopt);
+ NOT_RETRANSMISSION, std::nullopt);
}));
stream_->WriteOrBufferData(absl::string_view(kData1, 1), false, nullptr);
EXPECT_TRUE(session_->HasUnackedStreamData());
@@ -564,7 +564,7 @@
EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this]() {
return session_->ConsumeData(stream_->id(), 1u, 0u, FIN,
- NOT_RETRANSMISSION, absl::nullopt);
+ NOT_RETRANSMISSION, std::nullopt);
}));
stream_->WriteOrBufferData(absl::string_view(kData1, 1), true, nullptr);
EXPECT_TRUE(fin_sent());
@@ -827,7 +827,7 @@
EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this]() {
return session_->ConsumeData(stream_->id(), 2u, 0u, FIN,
- NOT_RETRANSMISSION, absl::nullopt);
+ NOT_RETRANSMISSION, std::nullopt);
}));
stream_->WriteOrBufferData(absl::string_view(kData1, 2), true, nullptr);
EXPECT_TRUE(stream_->write_side_closed());
@@ -844,7 +844,7 @@
EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this]() {
return session_->ConsumeData(stream_->id(), 2u, 0u, FIN,
- NOT_RETRANSMISSION, absl::nullopt);
+ NOT_RETRANSMISSION, std::nullopt);
}));
stream_->WriteOrBufferData(absl::string_view(kData1, 2), true, nullptr);
EXPECT_TRUE(stream_->write_side_closed());
@@ -1130,7 +1130,7 @@
EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this]() {
return session_->ConsumeData(stream_->id(), 100u, 0u, NO_FIN,
- NOT_RETRANSMISSION, absl::nullopt);
+ NOT_RETRANSMISSION, std::nullopt);
}));
stream_->WriteOrBufferData(data, false, nullptr);
stream_->WriteOrBufferData(data, false, nullptr);
@@ -1143,7 +1143,7 @@
EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this]() {
return session_->ConsumeData(stream_->id(), 100, 100u, NO_FIN,
- NOT_RETRANSMISSION, absl::nullopt);
+ NOT_RETRANSMISSION, std::nullopt);
}));
// Buffered data size > threshold, do not ask upper layer for more data.
EXPECT_CALL(*stream_, OnCanWriteNewData()).Times(0);
@@ -1157,7 +1157,7 @@
EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this, data_to_write]() {
return session_->ConsumeData(stream_->id(), data_to_write, 200u, NO_FIN,
- NOT_RETRANSMISSION, absl::nullopt);
+ NOT_RETRANSMISSION, std::nullopt);
}));
// Buffered data size < threshold, ask upper layer for more data.
EXPECT_CALL(*stream_, OnCanWriteNewData()).Times(1);
@@ -1206,7 +1206,7 @@
EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this, data_to_write]() {
return session_->ConsumeData(stream_->id(), data_to_write, 0u, NO_FIN,
- NOT_RETRANSMISSION, absl::nullopt);
+ NOT_RETRANSMISSION, std::nullopt);
}));
EXPECT_CALL(*stream_, OnCanWriteNewData()).Times(1);
@@ -1279,7 +1279,7 @@
EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this]() {
return session_->ConsumeData(stream_->id(), 100u, 0u, NO_FIN,
- NOT_RETRANSMISSION, absl::nullopt);
+ NOT_RETRANSMISSION, std::nullopt);
}));
// There is no buffered data before, all data should be consumed.
QuicConsumedData consumed = stream_->WriteMemSlices(span1, false);
@@ -1301,7 +1301,7 @@
EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this, data_to_write]() {
return session_->ConsumeData(stream_->id(), data_to_write, 100u, NO_FIN,
- NOT_RETRANSMISSION, absl::nullopt);
+ NOT_RETRANSMISSION, std::nullopt);
}));
EXPECT_CALL(*stream_, OnCanWriteNewData()).Times(1);
stream_->OnCanWrite();
@@ -1334,7 +1334,7 @@
EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this]() {
return session_->ConsumeData(stream_->id(), 5u, 0u, NO_FIN,
- NOT_RETRANSMISSION, absl::nullopt);
+ NOT_RETRANSMISSION, std::nullopt);
}));
// There is no buffered data before, all data should be consumed.
QuicConsumedData consumed = stream_->WriteMemSlice(std::move(slice1), false);
@@ -1474,7 +1474,7 @@
EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this]() {
return session_->ConsumeData(stream_->id(), 9u, 18u, FIN,
- NOT_RETRANSMISSION, absl::nullopt);
+ NOT_RETRANSMISSION, std::nullopt);
}));
stream_->OnCanWrite();
EXPECT_FALSE(stream_->HasPendingRetransmission());
@@ -1504,7 +1504,7 @@
EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs([this]() {
return session_->ConsumeData(stream_->id(), 9u, 0u, NO_FIN,
- NOT_RETRANSMISSION, absl::nullopt);
+ NOT_RETRANSMISSION, std::nullopt);
}));
EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
.WillOnce(Return(QuicConsumedData(0, true)));
@@ -1591,7 +1591,7 @@
EXPECT_CALL(*session_, WritevData(stream_->id(), 10, 0, NO_FIN, _, _))
.WillOnce(InvokeWithoutArgs([this]() {
return session_->ConsumeData(stream_->id(), 8, 0u, NO_FIN,
- NOT_RETRANSMISSION, absl::nullopt);
+ NOT_RETRANSMISSION, std::nullopt);
}));
EXPECT_FALSE(stream_->RetransmitStreamData(0, 18, true, PTO_RETRANSMISSION));