Replace QuicheOptional with absl::optional.
PiperOrigin-RevId: 336947387
Change-Id: I20fa90b62347b2fbb08e68db34a22cd182ef2b64
diff --git a/http2/test_tools/frame_parts.cc b/http2/test_tools/frame_parts.cc
index 95ea34d..bb975e2 100644
--- a/http2/test_tools/frame_parts.cc
+++ b/http2/test_tools/frame_parts.cc
@@ -506,10 +506,9 @@
return AssertionSuccess();
}
-AssertionResult FrameParts::AppendString(
- absl::string_view source,
- std::string* target,
- quiche::QuicheOptional<size_t>* opt_length) {
+AssertionResult FrameParts::AppendString(absl::string_view source,
+ std::string* target,
+ absl::optional<size_t>* opt_length) {
target->append(source.data(), source.size());
if (opt_length != nullptr) {
VERIFY_TRUE(*opt_length) << "Length is not set yet\n" << *this;
diff --git a/http2/test_tools/frame_parts.h b/http2/test_tools/frame_parts.h
index ca242b1..349d499 100644
--- a/http2/test_tools/frame_parts.h
+++ b/http2/test_tools/frame_parts.h
@@ -17,11 +17,11 @@
#include <vector>
#include "absl/strings/string_view.h"
+#include "absl/types/optional.h"
#include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h"
#include "net/third_party/quiche/src/http2/http2_constants.h"
#include "net/third_party/quiche/src/http2/http2_structures.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_test.h"
namespace http2 {
@@ -114,78 +114,70 @@
const Http2FrameHeader& GetFrameHeader() const { return frame_header_; }
- quiche::QuicheOptional<Http2PriorityFields> GetOptPriority() const {
+ absl::optional<Http2PriorityFields> GetOptPriority() const {
return opt_priority_;
}
- quiche::QuicheOptional<Http2ErrorCode> GetOptRstStreamErrorCode() const {
+ absl::optional<Http2ErrorCode> GetOptRstStreamErrorCode() const {
return opt_rst_stream_error_code_;
}
- quiche::QuicheOptional<Http2PushPromiseFields> GetOptPushPromise() const {
+ absl::optional<Http2PushPromiseFields> GetOptPushPromise() const {
return opt_push_promise_;
}
- quiche::QuicheOptional<Http2PingFields> GetOptPing() const {
- return opt_ping_;
- }
- quiche::QuicheOptional<Http2GoAwayFields> GetOptGoaway() const {
- return opt_goaway_;
- }
- quiche::QuicheOptional<size_t> GetOptPadLength() const {
- return opt_pad_length_;
- }
- quiche::QuicheOptional<size_t> GetOptPayloadLength() const {
+ absl::optional<Http2PingFields> GetOptPing() const { return opt_ping_; }
+ absl::optional<Http2GoAwayFields> GetOptGoaway() const { return opt_goaway_; }
+ absl::optional<size_t> GetOptPadLength() const { return opt_pad_length_; }
+ absl::optional<size_t> GetOptPayloadLength() const {
return opt_payload_length_;
}
- quiche::QuicheOptional<size_t> GetOptMissingLength() const {
+ absl::optional<size_t> GetOptMissingLength() const {
return opt_missing_length_;
}
- quiche::QuicheOptional<size_t> GetOptAltsvcOriginLength() const {
+ absl::optional<size_t> GetOptAltsvcOriginLength() const {
return opt_altsvc_origin_length_;
}
- quiche::QuicheOptional<size_t> GetOptAltsvcValueLength() const {
+ absl::optional<size_t> GetOptAltsvcValueLength() const {
return opt_altsvc_value_length_;
}
- quiche::QuicheOptional<size_t> GetOptWindowUpdateIncrement() const {
+ absl::optional<size_t> GetOptWindowUpdateIncrement() const {
return opt_window_update_increment_;
}
bool GetHasFrameSizeError() const { return has_frame_size_error_; }
- void SetOptPriority(
- quiche::QuicheOptional<Http2PriorityFields> opt_priority) {
+ void SetOptPriority(absl::optional<Http2PriorityFields> opt_priority) {
opt_priority_ = opt_priority;
}
void SetOptRstStreamErrorCode(
- quiche::QuicheOptional<Http2ErrorCode> opt_rst_stream_error_code) {
+ absl::optional<Http2ErrorCode> opt_rst_stream_error_code) {
opt_rst_stream_error_code_ = opt_rst_stream_error_code;
}
void SetOptPushPromise(
- quiche::QuicheOptional<Http2PushPromiseFields> opt_push_promise) {
+ absl::optional<Http2PushPromiseFields> opt_push_promise) {
opt_push_promise_ = opt_push_promise;
}
- void SetOptPing(quiche::QuicheOptional<Http2PingFields> opt_ping) {
+ void SetOptPing(absl::optional<Http2PingFields> opt_ping) {
opt_ping_ = opt_ping;
}
- void SetOptGoaway(quiche::QuicheOptional<Http2GoAwayFields> opt_goaway) {
+ void SetOptGoaway(absl::optional<Http2GoAwayFields> opt_goaway) {
opt_goaway_ = opt_goaway;
}
- void SetOptPadLength(quiche::QuicheOptional<size_t> opt_pad_length) {
+ void SetOptPadLength(absl::optional<size_t> opt_pad_length) {
opt_pad_length_ = opt_pad_length;
}
- void SetOptPayloadLength(quiche::QuicheOptional<size_t> opt_payload_length) {
+ void SetOptPayloadLength(absl::optional<size_t> opt_payload_length) {
opt_payload_length_ = opt_payload_length;
}
- void SetOptMissingLength(quiche::QuicheOptional<size_t> opt_missing_length) {
+ void SetOptMissingLength(absl::optional<size_t> opt_missing_length) {
opt_missing_length_ = opt_missing_length;
}
void SetOptAltsvcOriginLength(
- quiche::QuicheOptional<size_t> opt_altsvc_origin_length) {
+ absl::optional<size_t> opt_altsvc_origin_length) {
opt_altsvc_origin_length_ = opt_altsvc_origin_length;
}
- void SetOptAltsvcValueLength(
- quiche::QuicheOptional<size_t> opt_altsvc_value_length) {
+ void SetOptAltsvcValueLength(absl::optional<size_t> opt_altsvc_value_length) {
opt_altsvc_value_length_ = opt_altsvc_value_length;
}
void SetOptWindowUpdateIncrement(
- quiche::QuicheOptional<size_t> opt_window_update_increment) {
+ absl::optional<size_t> opt_window_update_increment) {
opt_window_update_increment_ = opt_window_update_increment;
}
@@ -215,10 +207,9 @@
// Append source to target. If opt_length is not nullptr, then verifies that
// the optional has a value (i.e. that the necessary On*Start method has been
// called), and that target is not longer than opt_length->value().
- ::testing::AssertionResult AppendString(
- absl::string_view source,
- std::string* target,
- quiche::QuicheOptional<size_t>* opt_length);
+ ::testing::AssertionResult AppendString(absl::string_view source,
+ std::string* target,
+ absl::optional<size_t>* opt_length);
const Http2FrameHeader frame_header_;
@@ -227,19 +218,19 @@
std::string altsvc_origin_;
std::string altsvc_value_;
- quiche::QuicheOptional<Http2PriorityFields> opt_priority_;
- quiche::QuicheOptional<Http2ErrorCode> opt_rst_stream_error_code_;
- quiche::QuicheOptional<Http2PushPromiseFields> opt_push_promise_;
- quiche::QuicheOptional<Http2PingFields> opt_ping_;
- quiche::QuicheOptional<Http2GoAwayFields> opt_goaway_;
+ absl::optional<Http2PriorityFields> opt_priority_;
+ absl::optional<Http2ErrorCode> opt_rst_stream_error_code_;
+ absl::optional<Http2PushPromiseFields> opt_push_promise_;
+ absl::optional<Http2PingFields> opt_ping_;
+ absl::optional<Http2GoAwayFields> opt_goaway_;
- quiche::QuicheOptional<size_t> opt_pad_length_;
- quiche::QuicheOptional<size_t> opt_payload_length_;
- quiche::QuicheOptional<size_t> opt_missing_length_;
- quiche::QuicheOptional<size_t> opt_altsvc_origin_length_;
- quiche::QuicheOptional<size_t> opt_altsvc_value_length_;
+ absl::optional<size_t> opt_pad_length_;
+ absl::optional<size_t> opt_payload_length_;
+ absl::optional<size_t> opt_missing_length_;
+ absl::optional<size_t> opt_altsvc_origin_length_;
+ absl::optional<size_t> opt_altsvc_value_length_;
- quiche::QuicheOptional<size_t> opt_window_update_increment_;
+ absl::optional<size_t> opt_window_update_increment_;
bool has_frame_size_error_ = false;