Internal QUICHE change PiperOrigin-RevId: 336856926 Change-Id: Id3698422550e4ffa6353d533a0a42b2eaa62485e
diff --git a/http2/decoder/payload_decoders/payload_decoder_base_test_util.cc b/http2/decoder/payload_decoders/payload_decoder_base_test_util.cc index 12dc577..56b3527 100644 --- a/http2/decoder/payload_decoders/payload_decoder_base_test_util.cc +++ b/http2/decoder/payload_decoders/payload_decoder_base_test_util.cc
@@ -76,7 +76,7 @@ ::testing::AssertionResult PayloadDecoderBaseTest::DecodePayloadAndValidateSeveralWays( - absl::string_view payload, + quiche::QuicheStringPiece payload, Validator validator) { VERIFY_TRUE(frame_header_is_set_); // Cap the payload to be decoded at the declared payload length. This is @@ -86,7 +86,8 @@ // Note that it is OK if the payload is too short; the validator may be // designed to check for that. if (payload.size() > frame_header_.payload_length) { - payload = absl::string_view(payload.data(), frame_header_.payload_length); + payload = + quiche::QuicheStringPiece(payload.data(), frame_header_.payload_length); } DecodeBuffer db(payload); ResetDecodeSpeedCounters();
diff --git a/http2/decoder/payload_decoders/payload_decoder_base_test_util.h b/http2/decoder/payload_decoders/payload_decoder_base_test_util.h index c907714..e46ab58 100644 --- a/http2/decoder/payload_decoders/payload_decoder_base_test_util.h +++ b/http2/decoder/payload_decoders/payload_decoder_base_test_util.h
@@ -11,7 +11,6 @@ #include <string> -#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/http2/decoder/decode_buffer.h" #include "net/third_party/quiche/src/http2/decoder/decode_status.h" #include "net/third_party/quiche/src/http2/decoder/frame_decoder_state.h" @@ -23,6 +22,7 @@ #include "net/third_party/quiche/src/http2/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/tools/http2_frame_builder.h" #include "net/third_party/quiche/src/http2/tools/random_decoder_test.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { namespace test { @@ -80,7 +80,7 @@ // Given the specified payload (without the common frame header), decode // it with several partitionings of the payload. ::testing::AssertionResult DecodePayloadAndValidateSeveralWays( - absl::string_view payload, + quiche::QuicheStringPiece payload, Validator validator); // TODO(jamessynge): Add helper method for verifying these are both non-zero, @@ -189,7 +189,7 @@ // will be decoded several times with different partitionings of the payload, // and after each the validator will be called. AssertionResult DecodePayloadAndValidateSeveralWays( - absl::string_view payload, + quiche::QuicheStringPiece payload, const FrameParts& expected) { auto validator = [&expected, this]() -> AssertionResult { VERIFY_FALSE(listener_.IsInProgress()); @@ -208,7 +208,7 @@ // std::nullptr_t (not extra validation). template <typename WrappedValidator> ::testing::AssertionResult VerifyDetectsFrameSizeError( - absl::string_view payload, + quiche::QuicheStringPiece payload, const Http2FrameHeader& header, WrappedValidator wrapped_validator) { set_frame_header(header); @@ -247,7 +247,7 @@ // randomly selected flag bits not excluded by FlagsAffectingPayloadDecoding. ::testing::AssertionResult VerifyDetectsMultipleFrameSizeErrors( uint8_t required_flags, - absl::string_view unpadded_payload, + quiche::QuicheStringPiece unpadded_payload, ApproveSize approve_size, int total_pad_length) { // required_flags should come from those that are defined for the frame @@ -305,7 +305,7 @@ // As above, but for frames without padding. ::testing::AssertionResult VerifyDetectsFrameSizeError( uint8_t required_flags, - absl::string_view unpadded_payload, + quiche::QuicheStringPiece unpadded_payload, const ApproveSize& approve_size) { Http2FrameType frame_type = DecoderPeer::FrameType(); uint8_t known_flags = KnownFlagsMaskForFrameType(frame_type); @@ -378,7 +378,7 @@ // amount of missing padding is as specified. header.IsPadded must be true, // and the payload must be empty or the PadLength field must be too large. ::testing::AssertionResult VerifyDetectsPaddingTooLong( - absl::string_view payload, + quiche::QuicheStringPiece payload, const Http2FrameHeader& header, size_t expected_missing_length) { set_frame_header(header);
diff --git a/http2/hpack/varint/hpack_varint_decoder_test.cc b/http2/hpack/varint/hpack_varint_decoder_test.cc index 5b22f8b..06554e9 100644 --- a/http2/hpack/varint/hpack_varint_decoder_test.cc +++ b/http2/hpack/varint/hpack_varint_decoder_test.cc
@@ -8,11 +8,11 @@ #include <stddef.h> -#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string_utils.h" #include "net/third_party/quiche/src/http2/tools/random_decoder_test.h" #include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" #include "net/third_party/quiche/src/common/platform/api/quiche_test.h" using ::testing::AssertionFailure; @@ -31,7 +31,7 @@ suffix_(Http2HexDecode(::testing::get<1>(GetParam()))), prefix_length_(0) {} - void DecodeExpectSuccess(absl::string_view data, + void DecodeExpectSuccess(quiche::QuicheStringPiece data, uint32_t prefix_length, uint64_t expected_value) { Validator validator = [expected_value, this]( @@ -52,7 +52,8 @@ EXPECT_EQ(expected_value, decoder_.value()); } - void DecodeExpectError(absl::string_view data, uint32_t prefix_length) { + void DecodeExpectError(quiche::QuicheStringPiece data, + uint32_t prefix_length) { Validator validator = [](const DecodeBuffer& /*db*/, DecodeStatus status) -> AssertionResult { VERIFY_EQ(DecodeStatus::kDecodeError, status); @@ -63,7 +64,7 @@ } private: - AssertionResult Decode(absl::string_view data, + AssertionResult Decode(quiche::QuicheStringPiece data, uint32_t prefix_length, const Validator validator) { prefix_length_ = prefix_length;
diff --git a/http2/hpack/varint/hpack_varint_round_trip_test.cc b/http2/hpack/varint/hpack_varint_round_trip_test.cc index 957683f..e8a0964 100644 --- a/http2/hpack/varint/hpack_varint_round_trip_test.cc +++ b/http2/hpack/varint/hpack_varint_round_trip_test.cc
@@ -13,12 +13,12 @@ #include <set> #include <vector> -#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/http2/hpack/tools/hpack_block_builder.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string_utils.h" #include "net/third_party/quiche/src/http2/tools/random_decoder_test.h" #include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" #include "net/third_party/quiche/src/common/platform/api/quiche_test.h" using ::testing::AssertionFailure; @@ -292,7 +292,7 @@ } TEST_F(HpackVarintRoundTripTest, FromSpec1337) { - DecodeBuffer b(absl::string_view("\x1f\x9a\x0a")); + DecodeBuffer b(quiche::QuicheStringPiece("\x1f\x9a\x0a")); uint32_t prefix_length = 5; uint8_t p = b.DecodeUInt8(); EXPECT_EQ(1u, b.Offset());
diff --git a/http2/http2_constants.cc b/http2/http2_constants.cc index 08351c4..daed778 100644 --- a/http2/http2_constants.cc +++ b/http2/http2_constants.cc
@@ -4,10 +4,10 @@ #include "net/third_party/quiche/src/http2/http2_constants.h" -#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string_utils.h" #include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { @@ -47,7 +47,8 @@ std::string s; // Closure to append flag name |v| to the std::string |s|, // and to clear |bit| from |flags|. - auto append_and_clear = [&s, &flags](absl::string_view v, uint8_t bit) { + auto append_and_clear = [&s, &flags](quiche::QuicheStringPiece v, + uint8_t bit) { if (!s.empty()) { s.push_back('|'); }
diff --git a/http2/platform/api/http2_string_utils.h b/http2/platform/api/http2_string_utils.h index ec421b7..f14d93a 100644 --- a/http2/platform/api/http2_string_utils.h +++ b/http2/platform/api/http2_string_utils.h
@@ -9,8 +9,8 @@ #include <type_traits> #include <utility> -#include "absl/strings/string_view.h" #include "net/http2/platform/impl/http2_string_utils_impl.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { @@ -28,15 +28,15 @@ return Http2HexEncodeImpl(bytes, size); } -inline std::string Http2HexDecode(absl::string_view data) { +inline std::string Http2HexDecode(quiche::QuicheStringPiece data) { return Http2HexDecodeImpl(data); } -inline std::string Http2HexDump(absl::string_view data) { +inline std::string Http2HexDump(quiche::QuicheStringPiece data) { return Http2HexDumpImpl(data); } -inline std::string Http2HexEscape(absl::string_view data) { +inline std::string Http2HexEscape(quiche::QuicheStringPiece data) { return Http2HexEscapeImpl(data); }
diff --git a/http2/platform/api/http2_string_utils_test.cc b/http2/platform/api/http2_string_utils_test.cc index 5cb019d..e3d499c 100644 --- a/http2/platform/api/http2_string_utils_test.cc +++ b/http2/platform/api/http2_string_utils_test.cc
@@ -6,8 +6,8 @@ #include <cstdint> -#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" #include "net/third_party/quiche/src/common/platform/api/quiche_test.h" namespace http2 { @@ -23,7 +23,7 @@ // Single string-like argument. const char kFoo[] = "foo"; const std::string string_foo(kFoo); - const absl::string_view stringpiece_foo(string_foo); + const quiche::QuicheStringPiece stringpiece_foo(string_foo); Http2StrAppend(&output, kFoo); EXPECT_EQ("foo", output); Http2StrAppend(&output, string_foo); @@ -39,7 +39,7 @@ // Two string-like arguments. const char kBar[] = "bar"; - const absl::string_view stringpiece_bar(kBar); + const quiche::QuicheStringPiece stringpiece_bar(kBar); const std::string string_bar(kBar); Http2StrAppend(&output, kFoo, kBar); EXPECT_EQ("foobar", output);
diff --git a/quic/test_tools/quic_test_utils.cc b/quic/test_tools/quic_test_utils.cc index 605fe80..12befe4 100644 --- a/quic/test_tools/quic_test_utils.cc +++ b/quic/test_tools/quic_test_utils.cc
@@ -1585,7 +1585,7 @@ QuicVersionLabel version_label; ParsedQuicVersion parsed_version = ParsedQuicVersion::Unsupported(); QuicConnectionId destination_connection_id, source_connection_id; - absl::string_view retry_token; + quiche::QuicheStringPiece retry_token; std::string detailed_error; QuicErrorCode error = QuicFramer::ParsePublicHeaderDispatcher( encrypted_packet,
diff --git a/spdy/platform/api/spdy_string_utils.h b/spdy/platform/api/spdy_string_utils.h index e7ee6a9..b023f73 100644 --- a/spdy/platform/api/spdy_string_utils.h +++ b/spdy/platform/api/spdy_string_utils.h
@@ -14,7 +14,7 @@ // non-test code. #include "net/third_party/quiche/src/spdy/platform/api/spdy_mem_slice.h" -#include "absl/strings/string_view.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" #include "net/spdy/platform/impl/spdy_string_utils_impl.h" namespace spdy { @@ -28,11 +28,12 @@ return SpdyHexDigitToIntImpl(c); } -inline std::string SpdyHexDecode(absl::string_view data) { +inline std::string SpdyHexDecode(quiche::QuicheStringPiece data) { return SpdyHexDecodeImpl(data); } -inline bool SpdyHexDecodeToUInt32(absl::string_view data, uint32_t* out) { +inline bool SpdyHexDecodeToUInt32(quiche::QuicheStringPiece data, + uint32_t* out) { return SpdyHexDecodeToUInt32Impl(data, out); } @@ -44,7 +45,7 @@ return SpdyHexEncodeUInt32AndTrimImpl(data); } -inline std::string SpdyHexDump(absl::string_view data) { +inline std::string SpdyHexDump(quiche::QuicheStringPiece data) { return SpdyHexDumpImpl(data); }
diff --git a/spdy/platform/api/spdy_string_utils_test.cc b/spdy/platform/api/spdy_string_utils_test.cc index 2f8c022..4848bf0 100644 --- a/spdy/platform/api/spdy_string_utils_test.cc +++ b/spdy/platform/api/spdy_string_utils_test.cc
@@ -6,7 +6,7 @@ #include <cstdint> -#include "absl/strings/string_view.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" #include "net/third_party/quiche/src/common/platform/api/quiche_test.h" namespace spdy { @@ -22,7 +22,7 @@ // Single string-like argument. const char kFoo[] = "foo"; const std::string string_foo(kFoo); - const absl::string_view stringpiece_foo(string_foo); + const quiche::QuicheStringPiece stringpiece_foo(string_foo); SpdyStrAppend(&output, kFoo); EXPECT_EQ("foo", output); SpdyStrAppend(&output, string_foo); @@ -38,7 +38,7 @@ // Two string-like arguments. const char kBar[] = "bar"; - const absl::string_view stringpiece_bar(kBar); + const quiche::QuicheStringPiece stringpiece_bar(kBar); const std::string string_bar(kBar); SpdyStrAppend(&output, kFoo, kBar); EXPECT_EQ("foobar", output);