Replace QuicheOptional with absl::optional. PiperOrigin-RevId: 336947387 Change-Id: I20fa90b62347b2fbb08e68db34a22cd182ef2b64
diff --git a/common/platform/api/quiche_optional.h b/common/platform/api/quiche_optional.h deleted file mode 100644 index d5d3dac..0000000 --- a/common/platform/api/quiche_optional.h +++ /dev/null
@@ -1,21 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_OPTIONAL_H_ -#define QUICHE_COMMON_PLATFORM_API_QUICHE_OPTIONAL_H_ - -#include <utility> - -#include "net/quiche/common/platform/impl/quiche_optional_impl.h" - -namespace quiche { - -template <typename T> -using QuicheOptional = QuicheOptionalImpl<T>; - -#define QUICHE_NULLOPT QUICHE_NULLOPT_IMPL - -} // namespace quiche - -#endif // QUICHE_COMMON_PLATFORM_API_QUICHE_OPTIONAL_H_
diff --git a/common/platform/api/quiche_text_utils.h b/common/platform/api/quiche_text_utils.h index 0aab251..3e83063 100644 --- a/common/platform/api/quiche_text_utils.h +++ b/common/platform/api/quiche_text_utils.h
@@ -8,8 +8,8 @@ #include <string> #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "net/third_party/quiche/src/common/platform/api/quiche_export.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" #include "net/quiche/common/platform/impl/quiche_text_utils_impl.h" namespace quiche { @@ -107,7 +107,7 @@ // Decodes a base64-encoded |input|. Returns nullopt when the input is // invalid. - static QuicheOptional<std::string> Base64Decode(absl::string_view input) { + static absl::optional<std::string> Base64Decode(absl::string_view input) { return quiche::QuicheTextUtilsImpl::Base64Decode(input); }
diff --git a/common/platform/api/quiche_time_utils.h b/common/platform/api/quiche_time_utils.h index 7319568..e1e59f0 100644 --- a/common/platform/api/quiche_time_utils.h +++ b/common/platform/api/quiche_time_utils.h
@@ -16,7 +16,7 @@ // instance, it will reject February 29 on non-leap years, or 25 hours in a day. // As a notable exception, 60 seconds is accepted to deal with potential leap // seconds. If the date predates Unix epoch, nullopt will be returned. -inline QuicheOptional<int64_t> QuicheUtcDateTimeToUnixSeconds(int year, +inline absl::optional<int64_t> QuicheUtcDateTimeToUnixSeconds(int year, int month, int day, int hour,
diff --git a/common/platform/api/quiche_time_utils_test.cc b/common/platform/api/quiche_time_utils_test.cc index 3ae296d..e32b8b2 100644 --- a/common/platform/api/quiche_time_utils_test.cc +++ b/common/platform/api/quiche_time_utils_test.cc
@@ -4,7 +4,7 @@ #include "net/third_party/quiche/src/common/platform/api/quiche_time_utils.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" +#include "absl/types/optional.h" #include "net/third_party/quiche/src/common/platform/api/quiche_test.h" namespace quiche { @@ -19,26 +19,24 @@ QuicheUtcDateTimeToUnixSeconds(2006, 7, 15, 12, 34, 56)); EXPECT_EQ(1591130001, QuicheUtcDateTimeToUnixSeconds(2020, 6, 2, 20, 33, 21)); - EXPECT_EQ(QUICHE_NULLOPT, + EXPECT_EQ(absl::nullopt, QuicheUtcDateTimeToUnixSeconds(1970, 2, 29, 0, 0, 1)); - EXPECT_NE(QUICHE_NULLOPT, + EXPECT_NE(absl::nullopt, QuicheUtcDateTimeToUnixSeconds(1972, 2, 29, 0, 0, 1)); } TEST(QuicheTimeUtilsTest, Bounds) { - EXPECT_EQ(QUICHE_NULLOPT, + EXPECT_EQ(absl::nullopt, QuicheUtcDateTimeToUnixSeconds(1970, 1, 32, 0, 0, 1)); - EXPECT_EQ(QUICHE_NULLOPT, + EXPECT_EQ(absl::nullopt, QuicheUtcDateTimeToUnixSeconds(1970, 4, 31, 0, 0, 1)); - EXPECT_EQ(QUICHE_NULLOPT, - QuicheUtcDateTimeToUnixSeconds(1970, 1, 0, 0, 0, 1)); - EXPECT_EQ(QUICHE_NULLOPT, + EXPECT_EQ(absl::nullopt, QuicheUtcDateTimeToUnixSeconds(1970, 1, 0, 0, 0, 1)); + EXPECT_EQ(absl::nullopt, QuicheUtcDateTimeToUnixSeconds(1970, 13, 1, 0, 0, 1)); - EXPECT_EQ(QUICHE_NULLOPT, - QuicheUtcDateTimeToUnixSeconds(1970, 0, 1, 0, 0, 1)); - EXPECT_EQ(QUICHE_NULLOPT, + EXPECT_EQ(absl::nullopt, QuicheUtcDateTimeToUnixSeconds(1970, 0, 1, 0, 0, 1)); + EXPECT_EQ(absl::nullopt, QuicheUtcDateTimeToUnixSeconds(1970, 1, 1, 24, 0, 0)); - EXPECT_EQ(QUICHE_NULLOPT, + EXPECT_EQ(absl::nullopt, QuicheUtcDateTimeToUnixSeconds(1970, 1, 1, 0, 60, 0)); } @@ -46,7 +44,7 @@ EXPECT_EQ(QuicheUtcDateTimeToUnixSeconds(2015, 6, 30, 23, 59, 60), QuicheUtcDateTimeToUnixSeconds(2015, 7, 1, 0, 0, 0)); EXPECT_EQ(QuicheUtcDateTimeToUnixSeconds(2015, 6, 30, 25, 59, 60), - QUICHE_NULLOPT); + absl::nullopt); } } // namespace
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;
diff --git a/quic/core/congestion_control/bbr2_simulator_test.cc b/quic/core/congestion_control/bbr2_simulator_test.cc index ca8ac7e..43a4fd7 100644 --- a/quic/core/congestion_control/bbr2_simulator_test.cc +++ b/quic/core/congestion_control/bbr2_simulator_test.cc
@@ -6,6 +6,7 @@ #include <sstream> #include <utility> +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/congestion_control/bbr2_misc.h" #include "net/third_party/quiche/src/quic/core/congestion_control/bbr2_sender.h" #include "net/third_party/quiche/src/quic/core/congestion_control/bbr_sender.h" @@ -27,7 +28,6 @@ #include "net/third_party/quiche/src/quic/test_tools/simulator/simulator.h" #include "net/third_party/quiche/src/quic/test_tools/simulator/switch.h" #include "net/third_party/quiche/src/quic/test_tools/simulator/traffic_policer.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" #include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" using testing::AllOf; @@ -91,7 +91,7 @@ // Network switch queue capacity, in number of BDPs. float switch_queue_capacity_in_bdp = 2; - quiche::QuicheOptional<TrafficPolicerParams> sender_policer_params; + absl::optional<TrafficPolicerParams> sender_policer_params; QuicBandwidth BottleneckBandwidth() const { return std::min(local_link.bandwidth, test_link.bandwidth);
diff --git a/quic/core/congestion_control/general_loss_algorithm_test.cc b/quic/core/congestion_control/general_loss_algorithm_test.cc index 42b97bf..6d89cb9 100644 --- a/quic/core/congestion_control/general_loss_algorithm_test.cc +++ b/quic/core/congestion_control/general_loss_algorithm_test.cc
@@ -62,16 +62,15 @@ const AckedPacketVector& packets_acked, const std::vector<uint64_t>& losses_expected) { return VerifyLosses(largest_newly_acked, packets_acked, losses_expected, - quiche::QuicheOptional<QuicPacketCount>(), - quiche::QuicheOptional<QuicPacketCount>()); + absl::nullopt, absl::nullopt); } void VerifyLosses( uint64_t largest_newly_acked, const AckedPacketVector& packets_acked, const std::vector<uint64_t>& losses_expected, - quiche::QuicheOptional<QuicPacketCount> max_sequence_reordering_expected, - quiche::QuicheOptional<QuicPacketCount> + absl::optional<QuicPacketCount> max_sequence_reordering_expected, + absl::optional<QuicPacketCount> num_borderline_time_reorderings_expected) { unacked_packets_.MaybeUpdateLargestAckedOfPacketNumberSpace( APPLICATION_DATA, QuicPacketNumber(largest_newly_acked));
diff --git a/quic/core/congestion_control/uber_loss_algorithm.h b/quic/core/congestion_control/uber_loss_algorithm.h index c20cb78..169972e 100644 --- a/quic/core/congestion_control/uber_loss_algorithm.h +++ b/quic/core/congestion_control/uber_loss_algorithm.h
@@ -5,10 +5,10 @@ #ifndef QUICHE_QUIC_CORE_CONGESTION_CONTROL_UBER_LOSS_ALGORITHM_H_ #define QUICHE_QUIC_CORE_CONGESTION_CONTROL_UBER_LOSS_ALGORITHM_H_ +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/congestion_control/general_loss_algorithm.h" #include "net/third_party/quiche/src/quic/core/quic_types.h" #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" namespace quic { @@ -20,8 +20,8 @@ struct QUIC_EXPORT_PRIVATE LossDetectionParameters { // See GeneralLossAlgorithm for the meaning of reordering_(shift|threshold). - quiche::QuicheOptional<int> reordering_shift; - quiche::QuicheOptional<QuicPacketCount> reordering_threshold; + absl::optional<int> reordering_shift; + absl::optional<QuicPacketCount> reordering_threshold; }; class QUIC_EXPORT_PRIVATE LossDetectionTunerInterface {
diff --git a/quic/core/congestion_control/uber_loss_algorithm_test.cc b/quic/core/congestion_control/uber_loss_algorithm_test.cc index 7a9d37e..788d101 100644 --- a/quic/core/congestion_control/uber_loss_algorithm_test.cc +++ b/quic/core/congestion_control/uber_loss_algorithm_test.cc
@@ -7,6 +7,7 @@ #include <memory> #include <utility> +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/congestion_control/rtt_stats.h" #include "net/third_party/quiche/src/quic/core/crypto/crypto_protocol.h" #include "net/third_party/quiche/src/quic/core/quic_types.h" @@ -14,7 +15,6 @@ #include "net/third_party/quiche/src/quic/platform/api/quic_test.h" #include "net/third_party/quiche/src/quic/test_tools/mock_clock.h" #include "net/third_party/quiche/src/quic/test_tools/quic_unacked_packet_map_peer.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" namespace quic { namespace test { @@ -69,14 +69,14 @@ const AckedPacketVector& packets_acked, const std::vector<uint64_t>& losses_expected) { return VerifyLosses(largest_newly_acked, packets_acked, losses_expected, - quiche::QuicheOptional<QuicPacketCount>()); + absl::nullopt); } - void VerifyLosses(uint64_t largest_newly_acked, - const AckedPacketVector& packets_acked, - const std::vector<uint64_t>& losses_expected, - quiche::QuicheOptional<QuicPacketCount> - max_sequence_reordering_expected) { + void VerifyLosses( + uint64_t largest_newly_acked, + const AckedPacketVector& packets_acked, + const std::vector<uint64_t>& losses_expected, + absl::optional<QuicPacketCount> max_sequence_reordering_expected) { LostPacketVector lost_packets; LossDetectionInterface::DetectionStats stats = loss_algorithm_.DetectLosses( *unacked_packets_, clock_.Now(), rtt_stats_,
diff --git a/quic/core/crypto/certificate_view.cc b/quic/core/crypto/certificate_view.cc index 1fe0052..cc5aea7 100644 --- a/quic/core/crypto/certificate_view.cc +++ b/quic/core/crypto/certificate_view.cc
@@ -10,6 +10,7 @@ #include <string> #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "third_party/boringssl/src/include/openssl/base.h" #include "third_party/boringssl/src/include/openssl/bytestring.h" #include "third_party/boringssl/src/include/openssl/digest.h" @@ -25,7 +26,6 @@ #include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h" #include "net/third_party/quiche/src/quic/platform/api/quic_ip_address.h" #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" #include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" #include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h" #include "net/third_party/quiche/src/common/platform/api/quiche_time_utils.h" @@ -33,7 +33,6 @@ namespace { -using ::quiche::QuicheOptional; using ::quiche::QuicheTextUtils; // The literals below were encoded using `ascii2der | xxd -i`. The comments @@ -104,11 +103,11 @@ namespace quic { -QuicheOptional<quic::QuicWallTime> ParseDerTime(unsigned tag, +absl::optional<quic::QuicWallTime> ParseDerTime(unsigned tag, absl::string_view payload) { if (tag != CBS_ASN1_GENERALIZEDTIME && tag != CBS_ASN1_UTCTIME) { QUIC_BUG << "Invalid tag supplied for a DER timestamp"; - return QUICHE_NULLOPT; + return absl::nullopt; } const size_t year_length = tag == CBS_ASN1_GENERALIZEDTIME ? 4 : 2; @@ -120,7 +119,7 @@ !reader.ReadDecimal64(2, &second) || reader.ReadRemainingPayload() != "Z") { QUIC_DLOG(WARNING) << "Failed to parse the DER timestamp"; - return QUICHE_NULLOPT; + return absl::nullopt; } if (tag == CBS_ASN1_UTCTIME) { @@ -128,11 +127,11 @@ year += (year >= 50) ? 1900 : 2000; } - const QuicheOptional<int64_t> unix_time = + const absl::optional<int64_t> unix_time = quiche::QuicheUtcDateTimeToUnixSeconds(year, month, day, hour, minute, second); if (!unix_time.has_value() || *unix_time < 0) { - return QUICHE_NULLOPT; + return absl::nullopt; } return QuicWallTime::FromUNIXSeconds(*unix_time); } @@ -162,7 +161,7 @@ // Handle END lines. if (pending_message && line == expected_end) { - QuicheOptional<std::string> data = + absl::optional<std::string> data = QuicheTextUtils::Base64Decode(encoded_message_contents); if (data.has_value()) { result.status = PemReadResult::kOk; @@ -265,9 +264,9 @@ QUIC_DLOG(WARNING) << "Failed to extract the validity dates"; return nullptr; } - QuicheOptional<QuicWallTime> not_before_parsed = + absl::optional<QuicWallTime> not_before_parsed = ParseDerTime(not_before_tag, CbsToStringPiece(not_before)); - QuicheOptional<QuicWallTime> not_after_parsed = + absl::optional<QuicWallTime> not_after_parsed = ParseDerTime(not_after_tag, CbsToStringPiece(not_after)); if (!not_before_parsed.has_value() || !not_after_parsed.has_value()) { QUIC_DLOG(WARNING) << "Failed to parse validity dates";
diff --git a/quic/core/crypto/certificate_view.h b/quic/core/crypto/certificate_view.h index 18f62f0..8ec292b 100644 --- a/quic/core/crypto/certificate_view.h +++ b/quic/core/crypto/certificate_view.h
@@ -10,6 +10,7 @@ #include <vector> #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "third_party/boringssl/src/include/openssl/base.h" #include "third_party/boringssl/src/include/openssl/bytestring.h" #include "third_party/boringssl/src/include/openssl/evp.h" @@ -18,7 +19,6 @@ #include "net/third_party/quiche/src/quic/core/quic_types.h" #include "net/third_party/quiche/src/quic/platform/api/quic_export.h" #include "net/third_party/quiche/src/quic/platform/api/quic_ip_address.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" namespace quic { @@ -120,7 +120,7 @@ // Parses a DER time based on the specified ASN.1 tag. Exposed primarily for // testing. -QUIC_EXPORT_PRIVATE quiche::QuicheOptional<quic::QuicWallTime> ParseDerTime( +QUIC_EXPORT_PRIVATE absl::optional<quic::QuicWallTime> ParseDerTime( unsigned tag, absl::string_view payload);
diff --git a/quic/core/crypto/certificate_view_test.cc b/quic/core/crypto/certificate_view_test.cc index c205360..7f8b60c 100644 --- a/quic/core/crypto/certificate_view_test.cc +++ b/quic/core/crypto/certificate_view_test.cc
@@ -148,27 +148,27 @@ Optional(QuicWallTime::FromUNIXSeconds(24))); EXPECT_TRUE(ParseDerTime(CBS_ASN1_UTCTIME, "200101000024Z").has_value()); - EXPECT_EQ(ParseDerTime(CBS_ASN1_GENERALIZEDTIME, ""), QUICHE_NULLOPT); + EXPECT_EQ(ParseDerTime(CBS_ASN1_GENERALIZEDTIME, ""), absl::nullopt); EXPECT_EQ(ParseDerTime(CBS_ASN1_GENERALIZEDTIME, "19700101000024.001Z"), - QUICHE_NULLOPT); + absl::nullopt); EXPECT_EQ(ParseDerTime(CBS_ASN1_GENERALIZEDTIME, "19700101000024Q"), - QUICHE_NULLOPT); + absl::nullopt); EXPECT_EQ(ParseDerTime(CBS_ASN1_GENERALIZEDTIME, "19700101000024-0500"), - QUICHE_NULLOPT); + absl::nullopt); EXPECT_EQ(ParseDerTime(CBS_ASN1_GENERALIZEDTIME, "700101000024ZZ"), - QUICHE_NULLOPT); + absl::nullopt); EXPECT_EQ(ParseDerTime(CBS_ASN1_GENERALIZEDTIME, "19700101000024.00Z"), - QUICHE_NULLOPT); + absl::nullopt); EXPECT_EQ(ParseDerTime(CBS_ASN1_GENERALIZEDTIME, "19700101000024.Z"), - QUICHE_NULLOPT); + absl::nullopt); EXPECT_EQ(ParseDerTime(CBS_ASN1_GENERALIZEDTIME, "197O0101000024Z"), - QUICHE_NULLOPT); + absl::nullopt); EXPECT_EQ(ParseDerTime(CBS_ASN1_GENERALIZEDTIME, "19700101000024.0O1Z"), - QUICHE_NULLOPT); + absl::nullopt); EXPECT_EQ(ParseDerTime(CBS_ASN1_GENERALIZEDTIME, "-9700101000024Z"), - QUICHE_NULLOPT); + absl::nullopt); EXPECT_EQ(ParseDerTime(CBS_ASN1_GENERALIZEDTIME, "1970-101000024Z"), - QUICHE_NULLOPT); + absl::nullopt); EXPECT_TRUE(ParseDerTime(CBS_ASN1_UTCTIME, "490101000024Z").has_value()); // This should parse as 1950, which predates UNIX epoch. @@ -177,7 +177,7 @@ EXPECT_THAT(ParseDerTime(CBS_ASN1_GENERALIZEDTIME, "19700101230000Z"), Optional(QuicWallTime::FromUNIXSeconds(23 * 3600))); EXPECT_EQ(ParseDerTime(CBS_ASN1_GENERALIZEDTIME, "19700101240000Z"), - QUICHE_NULLOPT); + absl::nullopt); } } // namespace
diff --git a/quic/core/crypto/transport_parameters.h b/quic/core/crypto/transport_parameters.h index 0ec57e2..8c7970c 100644 --- a/quic/core/crypto/transport_parameters.h +++ b/quic/core/crypto/transport_parameters.h
@@ -9,6 +9,7 @@ #include <vector> #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/quic_connection_id.h" #include "net/third_party/quiche/src/quic/core/quic_data_reader.h" #include "net/third_party/quiche/src/quic/core/quic_data_writer.h" @@ -17,7 +18,6 @@ #include "net/third_party/quiche/src/quic/core/quic_versions.h" #include "net/third_party/quiche/src/quic/platform/api/quic_containers.h" #include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" namespace quic { @@ -133,7 +133,7 @@ // The value of the Destination Connection ID field from the first // Initial packet sent by the client. - quiche::QuicheOptional<QuicConnectionId> original_destination_connection_id; + absl::optional<QuicConnectionId> original_destination_connection_id; // Maximum idle timeout expressed in milliseconds. IntegerParameter max_idle_timeout_ms; @@ -187,11 +187,11 @@ // The value that the endpoint included in the Source Connection ID field of // the first Initial packet it sent. - quiche::QuicheOptional<QuicConnectionId> initial_source_connection_id; + absl::optional<QuicConnectionId> initial_source_connection_id; // The value that the server included in the Source Connection ID field of a // Retry packet it sent. - quiche::QuicheOptional<QuicConnectionId> retry_source_connection_id; + absl::optional<QuicConnectionId> retry_source_connection_id; // Indicates support for the DATAGRAM frame and the maximum frame size that // the sender accepts. See draft-ietf-quic-datagram. @@ -202,10 +202,10 @@ IntegerParameter initial_round_trip_time_us; // Google-specific connection options. - quiche::QuicheOptional<QuicTagVector> google_connection_options; + absl::optional<QuicTagVector> google_connection_options; // Google-specific user agent identifier. - quiche::QuicheOptional<std::string> user_agent_id; + absl::optional<std::string> user_agent_id; // Google-specific handshake done support. This is only used for T050. bool support_handshake_done;
diff --git a/quic/core/crypto/transport_parameters_test.cc b/quic/core/crypto/transport_parameters_test.cc index 63adb63..65ade06 100644 --- a/quic/core/crypto/transport_parameters_test.cc +++ b/quic/core/crypto/transport_parameters_test.cc
@@ -202,7 +202,7 @@ // Test comparison on connection IDs. orig_params.initial_source_connection_id = CreateFakeInitialSourceConnectionId(); - new_params.initial_source_connection_id = QUICHE_NULLOPT; + new_params.initial_source_connection_id = absl::nullopt; EXPECT_NE(orig_params, new_params); EXPECT_FALSE(orig_params == new_params); EXPECT_TRUE(orig_params != new_params);
diff --git a/quic/core/http/quic_send_control_stream_test.cc b/quic/core/http/quic_send_control_stream_test.cc index a9077a9..bc49107 100644 --- a/quic/core/http/quic_send_control_stream_test.cc +++ b/quic/core/http/quic_send_control_stream_test.cc
@@ -138,7 +138,7 @@ [&writer, this](QuicStreamId /*id*/, size_t write_length, QuicStreamOffset offset, StreamSendingState /*state*/, TransmissionType /*type*/, - quiche::QuicheOptional<EncryptionLevel> /*level*/) { + absl::optional<EncryptionLevel> /*level*/) { send_control_stream_->WriteStreamData(offset, write_length, &writer); return QuicConsumedData(/* bytes_consumed = */ write_length, /* fin_consumed = */ false);
diff --git a/quic/core/http/quic_spdy_client_session_test.cc b/quic/core/http/quic_spdy_client_session_test.cc index 3f946f6..39ee3d0 100644 --- a/quic/core/http/quic_spdy_client_session_test.cc +++ b/quic/core/http/quic_spdy_client_session_test.cc
@@ -281,7 +281,7 @@ char data[] = "hello world"; EXPECT_QUIC_BUG( session_->WritevData(stream->id(), QUICHE_ARRAYSIZE(data), 0, NO_FIN, - NOT_RETRANSMISSION, QUICHE_NULLOPT), + NOT_RETRANSMISSION, absl::nullopt), "Client: Try to send data of stream"); }
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc index eacfe00..36a122e 100644 --- a/quic/core/http/quic_spdy_session.cc +++ b/quic/core/http/quic_spdy_session.cc
@@ -1408,7 +1408,7 @@ QUIC_DVLOG(1) << "Setting max_push_id to: " << max_push_id << " from unset"; } - quiche::QuicheOptional<PushId> old_max_push_id = max_push_id_; + absl::optional<PushId> old_max_push_id = max_push_id_; max_push_id_ = max_push_id; if (!old_max_push_id.has_value() || max_push_id > old_max_push_id.value()) {
diff --git a/quic/core/http/quic_spdy_session.h b/quic/core/http/quic_spdy_session.h index f51072d..bd9500c 100644 --- a/quic/core/http/quic_spdy_session.h +++ b/quic/core/http/quic_spdy_session.h
@@ -10,6 +10,7 @@ #include <string> #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/http/http_frames.h" #include "net/third_party/quiche/src/quic/core/http/quic_header_list.h" #include "net/third_party/quiche/src/quic/core/http/quic_headers_stream.h" @@ -27,7 +28,6 @@ #include "net/third_party/quiche/src/quic/core/quic_types.h" #include "net/third_party/quiche/src/quic/core/quic_versions.h" #include "net/third_party/quiche/src/quic/platform/api/quic_export.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" #include "net/third_party/quiche/src/spdy/core/http2_frame_decoder_adapter.h" namespace quic { @@ -564,7 +564,7 @@ // after encryption is established, the push ID in the most recently sent // MAX_PUSH_ID frame. // Once set, never goes back to unset. - quiche::QuicheOptional<PushId> max_push_id_; + absl::optional<PushId> max_push_id_; // Not owned by the session. Http3DebugVisitor* debug_visitor_; @@ -589,10 +589,10 @@ // The identifier in the most recently received GOAWAY frame. Unset if no // GOAWAY frame has been received yet. - quiche::QuicheOptional<uint64_t> last_received_http3_goaway_id_; + absl::optional<uint64_t> last_received_http3_goaway_id_; // The identifier in the most recently sent GOAWAY frame. Unset if no GOAWAY // frame has been sent yet. - quiche::QuicheOptional<uint64_t> last_sent_http3_goaway_id_; + absl::optional<uint64_t> last_sent_http3_goaway_id_; // Only used by a client, only with IETF QUIC. True if a MAX_PUSH_ID frame // has been sent, in which case |max_push_id_| has the value sent in the most
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc index bb081b3..345d1b5 100644 --- a/quic/core/http/quic_spdy_session_test.cc +++ b/quic/core/http/quic_spdy_session_test.cc
@@ -295,13 +295,12 @@ return QuicSpdySession::GetOrCreateStream(stream_id); } - QuicConsumedData WritevData( - QuicStreamId id, - size_t write_length, - QuicStreamOffset offset, - StreamSendingState state, - TransmissionType type, - quiche::QuicheOptional<EncryptionLevel> level) override { + QuicConsumedData WritevData(QuicStreamId id, + size_t write_length, + QuicStreamOffset offset, + StreamSendingState state, + TransmissionType type, + absl::optional<EncryptionLevel> level) override { bool fin = state != NO_FIN; QuicConsumedData consumed(write_length, fin); if (!writev_consumes_all_data_) { @@ -327,7 +326,7 @@ MakeIOVector("not empty", &iov); QuicStreamPeer::SendBuffer(stream).SaveStreamData(&iov, 1, 0, 9); QuicConsumedData consumed = - WritevData(stream->id(), 9, 0, FIN, NOT_RETRANSMISSION, QUICHE_NULLOPT); + WritevData(stream->id(), 9, 0, FIN, NOT_RETRANSMISSION, absl::nullopt); QuicStreamPeer::SendBuffer(stream).OnStreamDataConsumed( consumed.bytes_consumed); return consumed; @@ -336,7 +335,7 @@ QuicConsumedData SendLargeFakeData(QuicStream* stream, int bytes) { DCHECK(writev_consumes_all_data_); return WritevData(stream->id(), bytes, 0, FIN, NOT_RETRANSMISSION, - QUICHE_NULLOPT); + absl::nullopt); } using QuicSession::closed_streams;
diff --git a/quic/core/quic_config.h b/quic/core/quic_config.h index 0ce577a..0fa3a1e 100644 --- a/quic/core/quic_config.h +++ b/quic/core/quic_config.h
@@ -9,13 +9,13 @@ #include <cstdint> #include <string> +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/crypto/transport_parameters.h" #include "net/third_party/quiche/src/quic/core/quic_connection_id.h" #include "net/third_party/quiche/src/quic/core/quic_packets.h" #include "net/third_party/quiche/src/quic/core/quic_time.h" #include "net/third_party/quiche/src/quic/platform/api/quic_export.h" #include "net/third_party/quiche/src/quic/platform/api/quic_uint128.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" namespace quic { @@ -533,7 +533,7 @@ // Note that received_max_idle_timeout_ is only populated if we receive the // peer's value, which isn't guaranteed in IETF QUIC as sending is optional. QuicTime::Delta max_idle_timeout_to_send_; - quiche::QuicheOptional<QuicTime::Delta> received_max_idle_timeout_; + absl::optional<QuicTime::Delta> received_max_idle_timeout_; // Maximum number of dynamic streams that a Google QUIC connection // can support or the maximum number of bidirectional streams that // an IETF QUIC connection can support. @@ -640,24 +640,20 @@ // Initial packet sent by the client. // Uses the original_destination_connection_id transport parameter in // IETF QUIC. - quiche::QuicheOptional<QuicConnectionId> - original_destination_connection_id_to_send_; - quiche::QuicheOptional<QuicConnectionId> - received_original_destination_connection_id_; + absl::optional<QuicConnectionId> original_destination_connection_id_to_send_; + absl::optional<QuicConnectionId> received_original_destination_connection_id_; // The value that the endpoint included in the Source Connection ID field of // the first Initial packet it sent. // Uses the initial_source_connection_id transport parameter in IETF QUIC. - quiche::QuicheOptional<QuicConnectionId> - initial_source_connection_id_to_send_; - quiche::QuicheOptional<QuicConnectionId> - received_initial_source_connection_id_; + absl::optional<QuicConnectionId> initial_source_connection_id_to_send_; + absl::optional<QuicConnectionId> received_initial_source_connection_id_; // The value that the server included in the Source Connection ID field of a // Retry packet it sent. // Uses the retry_source_connection_id transport parameter in IETF QUIC. - quiche::QuicheOptional<QuicConnectionId> retry_source_connection_id_to_send_; - quiche::QuicheOptional<QuicConnectionId> received_retry_source_connection_id_; + absl::optional<QuicConnectionId> retry_source_connection_id_to_send_; + absl::optional<QuicConnectionId> received_retry_source_connection_id_; // Custom transport parameters that can be sent and received in the TLS // handshake.
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h index f6496c7..c9f366c 100644 --- a/quic/core/quic_connection.h +++ b/quic/core/quic_connection.h
@@ -25,6 +25,7 @@ #include <vector> #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/crypto/quic_decrypter.h" #include "net/third_party/quiche/src/quic/core/crypto/quic_encrypter.h" #include "net/third_party/quiche/src/quic/core/crypto/transport_parameters.h" @@ -51,7 +52,6 @@ #include "net/third_party/quiche/src/quic/platform/api/quic_containers.h" #include "net/third_party/quiche/src/quic/platform/api/quic_export.h" #include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" #include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" namespace quic { @@ -1771,11 +1771,11 @@ // |server_connection_id_| with the value from that packet and save off the // original value of |server_connection_id_| into // |original_destination_connection_id_| for validation. - quiche::QuicheOptional<QuicConnectionId> original_destination_connection_id_; + absl::optional<QuicConnectionId> original_destination_connection_id_; // After we receive a RETRY packet, |retry_source_connection_id_| contains // the source connection ID from that packet. - quiche::QuicheOptional<QuicConnectionId> retry_source_connection_id_; + absl::optional<QuicConnectionId> retry_source_connection_id_; // Indicates whether received RETRY packets should be dropped. bool drop_incoming_retry_packets_;
diff --git a/quic/core/quic_crypto_stream.cc b/quic/core/quic_crypto_stream.cc index 6d41f0e..688b585 100644 --- a/quic/core/quic_crypto_stream.cc +++ b/quic/core/quic_crypto_stream.cc
@@ -7,6 +7,7 @@ #include <string> #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/crypto/crypto_handshake.h" #include "net/third_party/quiche/src/quic/core/crypto/crypto_utils.h" #include "net/third_party/quiche/src/quic/core/quic_connection.h" @@ -16,7 +17,6 @@ #include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h" #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h" #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" namespace quic {
diff --git a/quic/core/quic_crypto_stream_test.cc b/quic/core/quic_crypto_stream_test.cc index 4fc9ac3..c67a5dc 100644 --- a/quic/core/quic_crypto_stream_test.cc +++ b/quic/core/quic_crypto_stream_test.cc
@@ -441,7 +441,7 @@ .WillOnce(InvokeWithoutArgs([this]() { return session_.ConsumeData( QuicUtils::GetCryptoStreamId(connection_->transport_version()), 150, - 1350, NO_FIN, HANDSHAKE_RETRANSMISSION, QUICHE_NULLOPT); + 1350, NO_FIN, HANDSHAKE_RETRANSMISSION, absl::nullopt); })); EXPECT_FALSE(stream_->RetransmitStreamData(1350, 1350, false,
diff --git a/quic/core/quic_datagram_queue.cc b/quic/core/quic_datagram_queue.cc index 22a57cd..e10a919 100644 --- a/quic/core/quic_datagram_queue.cc +++ b/quic/core/quic_datagram_queue.cc
@@ -12,7 +12,6 @@ namespace quic { -using quiche::QuicheOptional; constexpr float kExpiryInMinRtts = 1.25; constexpr float kMinPacingWindows = 4; @@ -37,10 +36,10 @@ return MESSAGE_STATUS_BLOCKED; } -QuicheOptional<MessageStatus> QuicDatagramQueue::TrySendingNextDatagram() { +absl::optional<MessageStatus> QuicDatagramQueue::TrySendingNextDatagram() { RemoveExpiredDatagrams(); if (queue_.empty()) { - return QuicheOptional<MessageStatus>(); + return absl::nullopt; } QuicMemSliceSpan span(&queue_.front().datagram); @@ -54,7 +53,7 @@ size_t QuicDatagramQueue::SendDatagrams() { size_t num_datagrams = 0; for (;;) { - QuicheOptional<MessageStatus> status = TrySendingNextDatagram(); + absl::optional<MessageStatus> status = TrySendingNextDatagram(); if (!status.has_value()) { break; }
diff --git a/quic/core/quic_datagram_queue.h b/quic/core/quic_datagram_queue.h index ac78ad4..0952402 100644 --- a/quic/core/quic_datagram_queue.h +++ b/quic/core/quic_datagram_queue.h
@@ -5,11 +5,11 @@ #ifndef QUICHE_QUIC_CORE_QUIC_DATAGRAM_QUEUE_H_ #define QUICHE_QUIC_CORE_QUIC_DATAGRAM_QUEUE_H_ +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/quic_circular_deque.h" #include "net/third_party/quiche/src/quic/core/quic_time.h" #include "net/third_party/quiche/src/quic/core/quic_types.h" #include "net/third_party/quiche/src/quic/platform/api/quic_mem_slice.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" namespace quic { @@ -29,7 +29,7 @@ // Attempts to send a single datagram from the queue. Returns the result of // SendMessage(), or nullopt if there were no unexpired datagrams to send. - quiche::QuicheOptional<MessageStatus> TrySendingNextDatagram(); + absl::optional<MessageStatus> TrySendingNextDatagram(); // Sends all of the unexpired datagrams until either the connection becomes // write-blocked or the queue is empty. Returns the number of datagrams sent.
diff --git a/quic/core/quic_datagram_queue_test.cc b/quic/core/quic_datagram_queue_test.cc index fb31e30..1fd451c 100644 --- a/quic/core/quic_datagram_queue_test.cc +++ b/quic/core/quic_datagram_queue_test.cc
@@ -5,19 +5,18 @@ #include "net/third_party/quiche/src/quic/core/quic_datagram_queue.h" #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/quic_buffer_allocator.h" #include "net/third_party/quiche/src/quic/core/quic_time.h" #include "net/third_party/quiche/src/quic/core/quic_types.h" #include "net/third_party/quiche/src/quic/platform/api/quic_mem_slice.h" #include "net/third_party/quiche/src/quic/platform/api/quic_test.h" #include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" namespace quic { namespace test { namespace { -using quiche::QuicheOptional; using testing::_; using testing::ElementsAre; @@ -75,7 +74,7 @@ // Verify getting write blocked does not remove the datagram from the queue. EXPECT_CALL(*connection_, SendMessage(_, _, _)) .WillOnce(Return(MESSAGE_STATUS_BLOCKED)); - QuicheOptional<MessageStatus> status = queue_.TrySendingNextDatagram(); + absl::optional<MessageStatus> status = queue_.TrySendingNextDatagram(); ASSERT_TRUE(status.has_value()); EXPECT_EQ(MESSAGE_STATUS_BLOCKED, *status); EXPECT_EQ(1u, queue_.queue_size()); @@ -89,7 +88,7 @@ } TEST_F(QuicDatagramQueueTest, EmptyBuffer) { - QuicheOptional<MessageStatus> status = queue_.TrySendingNextDatagram(); + absl::optional<MessageStatus> status = queue_.TrySendingNextDatagram(); EXPECT_FALSE(status.has_value()); size_t num_messages = queue_.SendDatagrams();
diff --git a/quic/core/quic_interval_deque.h b/quic/core/quic_interval_deque.h index 0ac9827..d469a08 100644 --- a/quic/core/quic_interval_deque.h +++ b/quic/core/quic_interval_deque.h
@@ -7,13 +7,13 @@ #include <algorithm> +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/quic_circular_deque.h" #include "net/third_party/quiche/src/quic/core/quic_interval.h" #include "net/third_party/quiche/src/quic/core/quic_types.h" #include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h" #include "net/third_party/quiche/src/quic/platform/api/quic_export.h" #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" namespace quic { @@ -260,7 +260,7 @@ friend class test::QuicIntervalDequePeer; C container_; - quiche::QuicheOptional<std::size_t> cached_index_; + absl::optional<std::size_t> cached_index_; }; template <class T, class C>
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc index a6c6e6c..34489e0 100644 --- a/quic/core/quic_session.cc +++ b/quic/core/quic_session.cc
@@ -719,7 +719,7 @@ QuicStreamOffset offset, StreamSendingState state, TransmissionType type, - quiche::QuicheOptional<EncryptionLevel> level) { + absl::optional<EncryptionLevel> level) { DCHECK(connection_->connected()) << ENDPOINT << "Try to write stream data when connection is closed."; if (!IsEncryptionEstablished() &&
diff --git a/quic/core/quic_session.h b/quic/core/quic_session.h index 42f1b04..8f26290 100644 --- a/quic/core/quic_session.h +++ b/quic/core/quic_session.h
@@ -15,6 +15,7 @@ #include <vector> #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/handshaker_delegate_interface.h" #include "net/third_party/quiche/src/quic/core/legacy_quic_stream_id_manager.h" #include "net/third_party/quiche/src/quic/core/quic_connection.h" @@ -34,7 +35,6 @@ #include "net/third_party/quiche/src/quic/platform/api/quic_containers.h" #include "net/third_party/quiche/src/quic/platform/api/quic_export.h" #include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" namespace quic { @@ -291,13 +291,12 @@ // indicating if the fin bit was consumed. This does not indicate the data // has been sent on the wire: it may have been turned into a packet and queued // if the socket was unexpectedly blocked. - QuicConsumedData WritevData( - QuicStreamId id, - size_t write_length, - QuicStreamOffset offset, - StreamSendingState state, - TransmissionType type, - quiche::QuicheOptional<EncryptionLevel> level) override; + QuicConsumedData WritevData(QuicStreamId id, + size_t write_length, + QuicStreamOffset offset, + StreamSendingState state, + TransmissionType type, + absl::optional<EncryptionLevel> level) override; size_t SendCryptoData(EncryptionLevel level, size_t write_length, @@ -474,7 +473,7 @@ return true; } - const quiche::QuicheOptional<std::string> user_agent_id() const { + const absl::optional<std::string> user_agent_id() const { return user_agent_id_; } @@ -817,7 +816,7 @@ // list may be a superset of the connection framer's supported versions. ParsedQuicVersionVector supported_versions_; - quiche::QuicheOptional<std::string> user_agent_id_; + absl::optional<std::string> user_agent_id_; // If true, write_blocked_streams_ uses HTTP2 (tree-style) priority write // scheduler.
diff --git a/quic/core/quic_session_test.cc b/quic/core/quic_session_test.cc index a11e6f0..be2136b 100644 --- a/quic/core/quic_session_test.cc +++ b/quic/core/quic_session_test.cc
@@ -10,6 +10,7 @@ #include <utility> #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/crypto/crypto_protocol.h" #include "net/third_party/quiche/src/quic/core/crypto/null_decrypter.h" #include "net/third_party/quiche/src/quic/core/crypto/null_encrypter.h" @@ -39,7 +40,6 @@ #include "net/third_party/quiche/src/quic/test_tools/quic_stream_send_buffer_peer.h" #include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h" #include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" #include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" using spdy::kV3HighestPriority; @@ -304,13 +304,12 @@ return GetNumActiveStreams() > 0; } - QuicConsumedData WritevData( - QuicStreamId id, - size_t write_length, - QuicStreamOffset offset, - StreamSendingState state, - TransmissionType type, - quiche::QuicheOptional<EncryptionLevel> level) override { + QuicConsumedData WritevData(QuicStreamId id, + size_t write_length, + QuicStreamOffset offset, + StreamSendingState state, + TransmissionType type, + absl::optional<EncryptionLevel> level) override { bool fin = state != NO_FIN; QuicConsumedData consumed(write_length, fin); if (!writev_consumes_all_data_) { @@ -341,7 +340,7 @@ MakeIOVector("not empty", &iov); QuicStreamPeer::SendBuffer(stream).SaveStreamData(&iov, 1, 0, 9); QuicConsumedData consumed = - WritevData(stream->id(), 9, 0, FIN, NOT_RETRANSMISSION, QUICHE_NULLOPT); + WritevData(stream->id(), 9, 0, FIN, NOT_RETRANSMISSION, absl::nullopt); QuicStreamPeer::SendBuffer(stream).OnStreamDataConsumed( consumed.bytes_consumed); return consumed; @@ -358,7 +357,7 @@ QuicConsumedData SendLargeFakeData(QuicStream* stream, int bytes) { DCHECK(writev_consumes_all_data_); return WritevData(stream->id(), bytes, 0, FIN, NOT_RETRANSMISSION, - QUICHE_NULLOPT); + absl::nullopt); } bool UsesPendingStreams() const override { return uses_pending_streams_; }
diff --git a/quic/core/quic_stream.cc b/quic/core/quic_stream.cc index b6d2cfd..f84df2b 100644 --- a/quic/core/quic_stream.cc +++ b/quic/core/quic_stream.cc
@@ -8,6 +8,7 @@ #include <string> #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/quic_error_codes.h" #include "net/third_party/quiche/src/quic/core/quic_flow_controller.h" #include "net/third_party/quiche/src/quic/core/quic_session.h" @@ -17,10 +18,8 @@ #include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h" #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h" #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" #include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" -using quiche::QuicheOptional; using spdy::SpdyPriority; namespace quic { @@ -281,7 +280,7 @@ namespace { -QuicheOptional<QuicFlowController> FlowController(QuicStreamId id, +absl::optional<QuicFlowController> FlowController(QuicStreamId id, QuicSession* session, StreamType type) { if (type == CRYPTO) { @@ -289,7 +288,7 @@ // it is using crypto frames instead of stream frames. The QuicCryptoStream // doesn't have any flow control in that case, so we don't create a // QuicFlowController for it. - return QuicheOptional<QuicFlowController>(); + return absl::nullopt; } return QuicFlowController( session, id, @@ -324,7 +323,7 @@ StreamType type, uint64_t stream_bytes_read, bool fin_received, - QuicheOptional<QuicFlowController> flow_controller, + absl::optional<QuicFlowController> flow_controller, QuicFlowController* connection_flow_controller) : sequencer_(std::move(sequencer)), id_(id), @@ -1073,7 +1072,7 @@ stream_bytes_written()); consumed = stream_delegate_->WritevData( id_, retransmission_length, retransmission_offset, - can_bundle_fin ? FIN : NO_FIN, type, QUICHE_NULLOPT); + can_bundle_fin ? FIN : NO_FIN, type, absl::nullopt); QUIC_DVLOG(1) << ENDPOINT << "stream " << id_ << " is forced to retransmit stream data [" << retransmission_offset << ", " @@ -1095,7 +1094,7 @@ QUIC_DVLOG(1) << ENDPOINT << "stream " << id_ << " retransmits fin only frame."; consumed = stream_delegate_->WritevData(id_, 0, stream_bytes_written(), FIN, - type, QUICHE_NULLOPT); + type, absl::nullopt); if (!consumed.fin_consumed) { return false; } @@ -1173,7 +1172,7 @@ } QuicConsumedData consumed_data = stream_delegate_->WritevData(id(), write_length, stream_bytes_written(), - state, NOT_RETRANSMISSION, QUICHE_NULLOPT); + state, NOT_RETRANSMISSION, absl::nullopt); OnStreamDataConsumed(consumed_data.bytes_consumed); @@ -1249,7 +1248,7 @@ << " retransmits fin only frame."; consumed = stream_delegate_->WritevData(id_, 0, stream_bytes_written(), FIN, - LOSS_RETRANSMISSION, QUICHE_NULLOPT); + LOSS_RETRANSMISSION, absl::nullopt); fin_lost_ = !consumed.fin_consumed; if (fin_lost_) { // Connection is write blocked. @@ -1264,7 +1263,7 @@ (pending.offset + pending.length == stream_bytes_written()); consumed = stream_delegate_->WritevData( id_, pending.length, pending.offset, can_bundle_fin ? FIN : NO_FIN, - LOSS_RETRANSMISSION, QUICHE_NULLOPT); + LOSS_RETRANSMISSION, absl::nullopt); QUIC_DVLOG(1) << ENDPOINT << "stream " << id_ << " tries to retransmit stream data [" << pending.offset << ", " << pending.offset + pending.length
diff --git a/quic/core/quic_stream.h b/quic/core/quic_stream.h index 89d1a85..89178c4 100644 --- a/quic/core/quic_stream.h +++ b/quic/core/quic_stream.h
@@ -23,6 +23,7 @@ #include <string> #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/quic_flow_controller.h" #include "net/third_party/quiche/src/quic/core/quic_packets.h" #include "net/third_party/quiche/src/quic/core/quic_stream_send_buffer.h" @@ -33,7 +34,6 @@ #include "net/third_party/quiche/src/quic/platform/api/quic_export.h" #include "net/third_party/quiche/src/quic/platform/api/quic_mem_slice_span.h" #include "net/third_party/quiche/src/quic/platform/api/quic_reference_counted.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" #include "net/third_party/quiche/src/spdy/core/spdy_protocol.h" namespace quic { @@ -440,7 +440,7 @@ StreamType type, uint64_t stream_bytes_read, bool fin_received, - quiche::QuicheOptional<QuicFlowController> flow_controller, + absl::optional<QuicFlowController> flow_controller, QuicFlowController* connection_flow_controller); // Calls MaybeSendBlocked on the stream's flow controller and the connection @@ -509,7 +509,7 @@ // True if this stream has received a RST_STREAM frame. bool rst_received_; - quiche::QuicheOptional<QuicFlowController> flow_controller_; + absl::optional<QuicFlowController> flow_controller_; // The connection level flow controller. Not owned. QuicFlowController* connection_flow_controller_;
diff --git a/quic/core/quic_stream_test.cc b/quic/core/quic_stream_test.cc index 77b548a..29bbaf5 100644 --- a/quic/core/quic_stream_test.cc +++ b/quic/core/quic_stream_test.cc
@@ -9,6 +9,7 @@ #include <utility> #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/frames/quic_rst_stream_frame.h" #include "net/third_party/quiche/src/quic/core/quic_connection.h" #include "net/third_party/quiche/src/quic/core/quic_constants.h" @@ -32,7 +33,6 @@ #include "net/third_party/quiche/src/quic/test_tools/quic_stream_sequencer_peer.h" #include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h" #include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" using testing::_; using testing::AnyNumber; @@ -132,7 +132,7 @@ QuicStreamOffset /*offset*/, StreamSendingState /*state*/, TransmissionType /*type*/, - quiche::QuicheOptional<EncryptionLevel> /*level*/) { + absl::optional<EncryptionLevel> /*level*/) { session_->ResetStream(id, QUIC_STREAM_CANCELLED); return QuicConsumedData(1, false); } @@ -307,7 +307,7 @@ EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this]() { return session_->ConsumeData(stream_->id(), 1u, 0u, NO_FIN, - NOT_RETRANSMISSION, QUICHE_NULLOPT); + NOT_RETRANSMISSION, absl::nullopt); })); stream_->WriteOrBufferData(absl::string_view(kData1, 2), false, nullptr); EXPECT_TRUE(session_->HasUnackedStreamData()); @@ -325,7 +325,7 @@ EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this]() { return session_->ConsumeData(stream_->id(), 2u, 0u, NO_FIN, - NOT_RETRANSMISSION, QUICHE_NULLOPT); + NOT_RETRANSMISSION, absl::nullopt); })); stream_->WriteOrBufferData(absl::string_view(kData1, 2), true, nullptr); EXPECT_TRUE(session_->HasUnackedStreamData()); @@ -371,7 +371,7 @@ EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this]() { return session_->ConsumeData(stream_->id(), kDataLen - 1, 0u, NO_FIN, - NOT_RETRANSMISSION, QUICHE_NULLOPT); + NOT_RETRANSMISSION, absl::nullopt); })); stream_->WriteOrBufferData(kData1, false, nullptr); @@ -387,8 +387,7 @@ EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this]() { return session_->ConsumeData(stream_->id(), kDataLen - 1, kDataLen - 1, - NO_FIN, NOT_RETRANSMISSION, - QUICHE_NULLOPT); + NO_FIN, NOT_RETRANSMISSION, absl::nullopt); })); EXPECT_CALL(*stream_, OnCanWriteNewData()); stream_->OnCanWrite(); @@ -398,8 +397,7 @@ EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this]() { return session_->ConsumeData(stream_->id(), 2u, 2 * kDataLen - 2, - NO_FIN, NOT_RETRANSMISSION, - QUICHE_NULLOPT); + NO_FIN, NOT_RETRANSMISSION, absl::nullopt); })); EXPECT_CALL(*stream_, OnCanWriteNewData()); stream_->OnCanWrite(); @@ -446,7 +444,7 @@ EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this]() { return session_->ConsumeData(stream_->id(), 1u, 0u, NO_FIN, - NOT_RETRANSMISSION, QUICHE_NULLOPT); + NOT_RETRANSMISSION, absl::nullopt); })); stream_->WriteOrBufferData(absl::string_view(kData1, 1), false, nullptr); EXPECT_TRUE(session_->HasUnackedStreamData()); @@ -475,7 +473,7 @@ EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this]() { return session_->ConsumeData(stream_->id(), 1u, 0u, FIN, - NOT_RETRANSMISSION, QUICHE_NULLOPT); + NOT_RETRANSMISSION, absl::nullopt); })); stream_->WriteOrBufferData(absl::string_view(kData1, 1), true, nullptr); EXPECT_TRUE(fin_sent()); @@ -738,7 +736,7 @@ EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this]() { return session_->ConsumeData(stream_->id(), 2u, 0u, FIN, - NOT_RETRANSMISSION, QUICHE_NULLOPT); + NOT_RETRANSMISSION, absl::nullopt); })); stream_->WriteOrBufferData(absl::string_view(kData1, 2), true, nullptr); EXPECT_TRUE(stream_->write_side_closed()); @@ -755,7 +753,7 @@ EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this]() { return session_->ConsumeData(stream_->id(), 2u, 0u, FIN, - NOT_RETRANSMISSION, QUICHE_NULLOPT); + NOT_RETRANSMISSION, absl::nullopt); })); stream_->WriteOrBufferData(absl::string_view(kData1, 2), true, nullptr); EXPECT_TRUE(stream_->write_side_closed()); @@ -1031,7 +1029,7 @@ EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this]() { return session_->ConsumeData(stream_->id(), 100u, 0u, NO_FIN, - NOT_RETRANSMISSION, QUICHE_NULLOPT); + NOT_RETRANSMISSION, absl::nullopt); })); stream_->WriteOrBufferData(data, false, nullptr); stream_->WriteOrBufferData(data, false, nullptr); @@ -1044,7 +1042,7 @@ EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this]() { return session_->ConsumeData(stream_->id(), 100, 100u, NO_FIN, - NOT_RETRANSMISSION, QUICHE_NULLOPT); + NOT_RETRANSMISSION, absl::nullopt); })); // Buffered data size > threshold, do not ask upper layer for more data. EXPECT_CALL(*stream_, OnCanWriteNewData()).Times(0); @@ -1059,7 +1057,7 @@ EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this, data_to_write]() { return session_->ConsumeData(stream_->id(), data_to_write, 200u, NO_FIN, - NOT_RETRANSMISSION, QUICHE_NULLOPT); + NOT_RETRANSMISSION, absl::nullopt); })); // Buffered data size < threshold, ask upper layer for more data. EXPECT_CALL(*stream_, OnCanWriteNewData()).Times(1); @@ -1109,7 +1107,7 @@ EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this, data_to_write]() { return session_->ConsumeData(stream_->id(), data_to_write, 0u, NO_FIN, - NOT_RETRANSMISSION, QUICHE_NULLOPT); + NOT_RETRANSMISSION, absl::nullopt); })); EXPECT_CALL(*stream_, OnCanWriteNewData()).Times(1); @@ -1171,7 +1169,7 @@ EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this]() { return session_->ConsumeData(stream_->id(), 100u, 0u, NO_FIN, - NOT_RETRANSMISSION, QUICHE_NULLOPT); + NOT_RETRANSMISSION, absl::nullopt); })); // There is no buffered data before, all data should be consumed. QuicConsumedData consumed = stream_->WriteMemSlices(span1, false); @@ -1194,7 +1192,7 @@ EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this, data_to_write]() { return session_->ConsumeData(stream_->id(), data_to_write, 100u, NO_FIN, - NOT_RETRANSMISSION, QUICHE_NULLOPT); + NOT_RETRANSMISSION, absl::nullopt); })); EXPECT_CALL(*stream_, OnCanWriteNewData()).Times(1); stream_->OnCanWrite(); @@ -1231,7 +1229,7 @@ EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this]() { return session_->ConsumeData(stream_->id(), 5u, 0u, NO_FIN, - NOT_RETRANSMISSION, QUICHE_NULLOPT); + NOT_RETRANSMISSION, absl::nullopt); })); // There is no buffered data before, all data should be consumed. QuicConsumedData consumed = stream_->WriteMemSlices(span1, false); @@ -1369,7 +1367,7 @@ EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this]() { return session_->ConsumeData(stream_->id(), 9u, 18u, FIN, - NOT_RETRANSMISSION, QUICHE_NULLOPT); + NOT_RETRANSMISSION, absl::nullopt); })); stream_->OnCanWrite(); EXPECT_FALSE(stream_->HasPendingRetransmission()); @@ -1399,7 +1397,7 @@ EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)) .WillOnce(InvokeWithoutArgs([this]() { return session_->ConsumeData(stream_->id(), 9u, 0u, NO_FIN, - NOT_RETRANSMISSION, QUICHE_NULLOPT); + NOT_RETRANSMISSION, absl::nullopt); })); EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)) .WillOnce(Return(QuicConsumedData(0, true))); @@ -1488,7 +1486,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, QUICHE_NULLOPT); + NOT_RETRANSMISSION, absl::nullopt); })); EXPECT_FALSE(stream_->RetransmitStreamData(0, 18, true, PTO_RETRANSMISSION));
diff --git a/quic/core/stream_delegate_interface.h b/quic/core/stream_delegate_interface.h index 9f27147..7c36c91 100644 --- a/quic/core/stream_delegate_interface.h +++ b/quic/core/stream_delegate_interface.h
@@ -6,8 +6,8 @@ #define QUICHE_QUIC_CORE_STREAM_DELEGATE_INTERFACE_H_ #include <cstddef> +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/quic_types.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" #include "net/third_party/quiche/src/spdy/core/spdy_protocol.h" namespace quic { @@ -32,7 +32,7 @@ QuicStreamOffset offset, StreamSendingState state, TransmissionType type, - quiche::QuicheOptional<EncryptionLevel> level) = 0; + absl::optional<EncryptionLevel> level) = 0; // Called to write crypto data. virtual size_t SendCryptoData(EncryptionLevel level, size_t write_length,
diff --git a/quic/qbone/qbone_stream_test.cc b/quic/qbone/qbone_stream_test.cc index 702b2a4..c2b28ca 100644 --- a/quic/qbone/qbone_stream_test.cc +++ b/quic/qbone/qbone_stream_test.cc
@@ -40,13 +40,12 @@ ~MockQuicSession() override {} // Writes outgoing data from QuicStream to a string. - QuicConsumedData WritevData( - QuicStreamId id, - size_t write_length, - QuicStreamOffset offset, - StreamSendingState state, - TransmissionType type, - quiche::QuicheOptional<EncryptionLevel> level) override { + QuicConsumedData WritevData(QuicStreamId id, + size_t write_length, + QuicStreamOffset offset, + StreamSendingState state, + TransmissionType type, + absl::optional<EncryptionLevel> level) override { if (!writable_) { return QuicConsumedData(0, false); }
diff --git a/quic/test_tools/quic_test_utils.cc b/quic/test_tools/quic_test_utils.cc index 605fe80..35edea2 100644 --- a/quic/test_tools/quic_test_utils.cc +++ b/quic/test_tools/quic_test_utils.cc
@@ -629,7 +629,7 @@ QuicStreamOffset offset, StreamSendingState state, TransmissionType /*type*/, - quiche::QuicheOptional<EncryptionLevel> /*level*/) { + absl::optional<EncryptionLevel> /*level*/) { if (write_length > 0) { auto buf = std::make_unique<char[]>(write_length); QuicStream* stream = GetOrCreateStream(id); @@ -718,7 +718,7 @@ QuicStreamOffset offset, StreamSendingState state, TransmissionType /*type*/, - quiche::QuicheOptional<EncryptionLevel> /*level*/) { + absl::optional<EncryptionLevel> /*level*/) { if (write_length > 0) { auto buf = std::make_unique<char[]>(write_length); QuicStream* stream = GetOrCreateStream(id);
diff --git a/quic/test_tools/quic_test_utils.h b/quic/test_tools/quic_test_utils.h index c4e440b..b0052d8 100644 --- a/quic/test_tools/quic_test_utils.h +++ b/quic/test_tools/quic_test_utils.h
@@ -826,7 +826,7 @@ QuicStreamOffset offset, StreamSendingState state, TransmissionType type, - quiche::QuicheOptional<EncryptionLevel> level), + absl::optional<EncryptionLevel> level), (override)); MOCK_METHOD(void, @@ -858,7 +858,7 @@ QuicStreamOffset offset, StreamSendingState state, TransmissionType type, - quiche::QuicheOptional<EncryptionLevel> level); + absl::optional<EncryptionLevel> level); void ReallySendRstStream(QuicStreamId id, QuicRstStreamErrorCode error, @@ -958,7 +958,7 @@ QuicStreamOffset offset, StreamSendingState state, TransmissionType type, - quiche::QuicheOptional<EncryptionLevel> level), + absl::optional<EncryptionLevel> level), (override)); MOCK_METHOD(void, SendRstStream, @@ -1004,7 +1004,7 @@ QuicStreamOffset offset, StreamSendingState state, TransmissionType type, - quiche::QuicheOptional<EncryptionLevel> level); + absl::optional<EncryptionLevel> level); using QuicSession::ActivateStream;
diff --git a/quic/tools/quic_simple_server_stream_test.cc b/quic/tools/quic_simple_server_stream_test.cc index 8a59139..c5d989a 100644 --- a/quic/tools/quic_simple_server_stream_test.cc +++ b/quic/tools/quic_simple_server_stream_test.cc
@@ -9,6 +9,7 @@ #include <utility> #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "net/third_party/quiche/src/quic/core/http/http_encoder.h" #include "net/third_party/quiche/src/quic/core/http/spdy_utils.h" #include "net/third_party/quiche/src/quic/core/quic_types.h" @@ -28,7 +29,6 @@ #include "net/third_party/quiche/src/quic/tools/quic_memory_cache_backend.h" #include "net/third_party/quiche/src/quic/tools/quic_simple_server_session.h" #include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" using testing::_; using testing::AnyNumber; @@ -137,7 +137,7 @@ QuicStreamOffset offset, StreamSendingState state, TransmissionType type, - quiche::QuicheOptional<EncryptionLevel> level), + absl::optional<EncryptionLevel> level), (override)); MOCK_METHOD(void, OnStreamHeaderList, @@ -180,13 +180,12 @@ using QuicSession::ActivateStream; - QuicConsumedData ConsumeData( - QuicStreamId id, - size_t write_length, - QuicStreamOffset offset, - StreamSendingState state, - TransmissionType /*type*/, - quiche::QuicheOptional<EncryptionLevel> /*level*/) { + QuicConsumedData ConsumeData(QuicStreamId id, + size_t write_length, + QuicStreamOffset offset, + StreamSendingState state, + TransmissionType /*type*/, + absl::optional<EncryptionLevel> /*level*/) { if (write_length > 0) { auto buf = std::make_unique<char[]>(write_length); QuicStream* stream = GetOrCreateStream(id);
diff --git a/spdy/core/http2_frame_decoder_adapter.h b/spdy/core/http2_frame_decoder_adapter.h index a75ab23..89d7fdc 100644 --- a/spdy/core/http2_frame_decoder_adapter.h +++ b/spdy/core/http2_frame_decoder_adapter.h
@@ -12,9 +12,9 @@ #include <string> #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder.h" #include "net/third_party/quiche/src/common/platform/api/quiche_export.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h" #include "net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter.h" #include "net/third_party/quiche/src/spdy/core/hpack/hpack_header_table.h" #include "net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format.h" @@ -269,7 +269,7 @@ // Amount of trailing padding. Currently used just as an indicator of whether // OnPadLength has been called. - quiche::QuicheOptional<size_t> opt_pad_length_; + absl::optional<size_t> opt_pad_length_; // Temporary buffers for the AltSvc fields. std::string alt_svc_origin_;