Remove quiche::QuicheStringPiece and quiche::QuicheStringPieceHash. Also replace some MOCK_METHOD1 with MOCK_METHOD to make the linter happy. PiperOrigin-RevId: 336909722 Change-Id: I68bcc1a674815934fb271870eac2dff9028d980d
diff --git a/common/platform/api/quiche_string_piece.h b/common/platform/api/quiche_string_piece.h index 35d5021..ca58aae 100644 --- a/common/platform/api/quiche_string_piece.h +++ b/common/platform/api/quiche_string_piece.h
@@ -5,15 +5,12 @@ #ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_STRING_PIECE_H_ #define QUICHE_COMMON_PLATFORM_API_QUICHE_STRING_PIECE_H_ +#include "absl/strings/string_view.h" #include "net/quiche/common/platform/impl/quiche_string_piece_impl.h" namespace quiche { -using QuicheStringPiece = QuicheStringPieceImpl; - -using QuicheStringPieceHash = QuicheStringPieceHashImpl; - -inline size_t QuicheHashStringPair(QuicheStringPiece a, QuicheStringPiece b) { +inline size_t QuicheHashStringPair(absl::string_view a, absl::string_view b) { return QuicheHashStringPairImpl(a, b); }
diff --git a/http2/decoder/decode_buffer.h b/http2/decoder/decode_buffer.h index 241c553..2bf8243 100644 --- a/http2/decoder/decode_buffer.h +++ b/http2/decoder/decode_buffer.h
@@ -17,9 +17,9 @@ #include <algorithm> #include <cstdint> +#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/common/platform/api/quiche_export.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { class DecodeBufferSubset; @@ -35,7 +35,7 @@ const size_t kMaxDecodeBufferLength = 1 << 25; DCHECK_LE(len, kMaxDecodeBufferLength); } - explicit DecodeBuffer(quiche::QuicheStringPiece s) + explicit DecodeBuffer(absl::string_view s) : DecodeBuffer(s.data(), s.size()) {} // Constructor for character arrays, typically in tests. For example: // const char input[] = { 0x11 };
diff --git a/http2/decoder/decode_http2_structures_test.cc b/http2/decoder/decode_http2_structures_test.cc index e305e56..58736dc 100644 --- a/http2/decoder/decode_http2_structures_test.cc +++ b/http2/decoder/decode_http2_structures_test.cc
@@ -11,6 +11,7 @@ #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/http2_constants.h" @@ -19,7 +20,6 @@ #include "net/third_party/quiche/src/http2/platform/api/http2_test_helpers.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.h" #include "net/third_party/quiche/src/http2/tools/http2_frame_builder.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::AssertionResult; @@ -29,9 +29,8 @@ namespace { template <typename T, size_t N> -quiche::QuicheStringPiece ToStringPiece(T (&data)[N]) { - return quiche::QuicheStringPiece(reinterpret_cast<const char*>(data), - N * sizeof(T)); +absl::string_view ToStringPiece(T (&data)[N]) { + return absl::string_view(reinterpret_cast<const char*>(data), N * sizeof(T)); } template <class S> @@ -54,8 +53,7 @@ // Fully decodes the Structure at the start of data, and confirms it matches // *expected (if provided). - void DecodeLeadingStructure(const S* expected, - quiche::QuicheStringPiece data) { + void DecodeLeadingStructure(const S* expected, absl::string_view data) { ASSERT_LE(S::EncodedSize(), data.size()); DecodeBuffer db(data); Randomize(&structure_); @@ -68,7 +66,7 @@ template <size_t N> void DecodeLeadingStructure(const char (&data)[N]) { - DecodeLeadingStructure(nullptr, quiche::QuicheStringPiece(data, N)); + DecodeLeadingStructure(nullptr, absl::string_view(data, N)); } // Encode the structure |in_s| into bytes, then decode the bytes @@ -294,7 +292,7 @@ }; DecodeLeadingStructure(kData); if (!HasFailure()) { - EXPECT_EQ(quiche::QuicheStringPiece(kData, 8), + EXPECT_EQ(absl::string_view(kData, 8), ToStringPiece(structure_.opaque_bytes)); } } @@ -305,7 +303,7 @@ }; DecodeLeadingStructure(kData); if (!HasFailure()) { - EXPECT_EQ(quiche::QuicheStringPiece(kData, 8), + EXPECT_EQ(absl::string_view(kData, 8), ToStringPiece(structure_.opaque_bytes)); } } @@ -315,7 +313,7 @@ }; DecodeLeadingStructure(kData); if (!HasFailure()) { - EXPECT_EQ(quiche::QuicheStringPiece(kData, 8), + EXPECT_EQ(absl::string_view(kData, 8), ToStringPiece(structure_.opaque_bytes)); } }
diff --git a/http2/decoder/http2_frame_decoder_test.cc b/http2/decoder/http2_frame_decoder_test.cc index 9ed3138..cf0015d 100644 --- a/http2/decoder/http2_frame_decoder_test.cc +++ b/http2/decoder/http2_frame_decoder_test.cc
@@ -9,6 +9,7 @@ #include <string> #include <vector> +#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_test_helpers.h" @@ -16,7 +17,6 @@ #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector_listener.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.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" using ::testing::AssertionResult; using ::testing::AssertionSuccess; @@ -114,9 +114,8 @@ VERIFY_AND_RETURN_SUCCESS(expected.VerifyEquals(*collector_.frame(0))); } - AssertionResult DecodePayloadAndValidateSeveralWays( - quiche::QuicheStringPiece payload, - Validator validator) { + AssertionResult DecodePayloadAndValidateSeveralWays(absl::string_view payload, + Validator validator) { DecodeBuffer db(payload); bool start_decoding_requires_non_empty = false; return DecodeAndValidateSeveralWays(&db, start_decoding_requires_non_empty, @@ -128,7 +127,7 @@ // payload will be decoded several times with different partitionings // of the payload, and after each the validator will be called. AssertionResult DecodePayloadAndValidateSeveralWays( - quiche::QuicheStringPiece payload, + absl::string_view payload, const FrameParts& expected) { auto validator = [&expected, this](const DecodeBuffer& /*input*/, DecodeStatus status) -> AssertionResult { @@ -159,16 +158,16 @@ AssertionResult DecodePayloadAndValidateSeveralWays( const char (&buf)[N], const FrameParts& expected) { - return DecodePayloadAndValidateSeveralWays( - quiche::QuicheStringPiece(buf, N), expected); + return DecodePayloadAndValidateSeveralWays(absl::string_view(buf, N), + expected); } template <size_t N> AssertionResult DecodePayloadAndValidateSeveralWays( const char (&buf)[N], const Http2FrameHeader& header) { - return DecodePayloadAndValidateSeveralWays( - quiche::QuicheStringPiece(buf, N), FrameParts(header)); + return DecodePayloadAndValidateSeveralWays(absl::string_view(buf, N), + FrameParts(header)); } template <size_t N>
diff --git a/http2/decoder/http2_structure_decoder_test.cc b/http2/decoder/http2_structure_decoder_test.cc index dc7f3de..0242061 100644 --- a/http2/decoder/http2_structure_decoder_test.cc +++ b/http2/decoder/http2_structure_decoder_test.cc
@@ -23,6 +23,7 @@ #include <cstdint> #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/http2_constants.h" @@ -31,7 +32,6 @@ #include "net/third_party/quiche/src/http2/platform/api/http2_test_helpers.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" using ::testing::AssertionFailure; using ::testing::AssertionResult; @@ -93,7 +93,7 @@ // Fully decodes the Structure at the start of data, and confirms it matches // *expected (if provided). AssertionResult DecodeLeadingStructure(const S* expected, - quiche::QuicheStringPiece data) { + absl::string_view data) { VERIFY_LE(S::EncodedSize(), data.size()); DecodeBuffer original(data); @@ -145,7 +145,7 @@ template <size_t N> AssertionResult DecodeLeadingStructure(const char (&data)[N]) { VERIFY_AND_RETURN_SUCCESS( - DecodeLeadingStructure(nullptr, quiche::QuicheStringPiece(data, N))); + DecodeLeadingStructure(nullptr, absl::string_view(data, N))); } template <size_t N>
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 56b3527..12dc577 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( - quiche::QuicheStringPiece payload, + absl::string_view payload, Validator validator) { VERIFY_TRUE(frame_header_is_set_); // Cap the payload to be decoded at the declared payload length. This is @@ -86,8 +86,7 @@ // 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 = - quiche::QuicheStringPiece(payload.data(), frame_header_.payload_length); + payload = absl::string_view(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 e46ab58..c907714 100644 --- a/http2/decoder/payload_decoders/payload_decoder_base_test_util.h +++ b/http2/decoder/payload_decoders/payload_decoder_base_test_util.h
@@ -11,6 +11,7 @@ #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" @@ -22,7 +23,6 @@ #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( - quiche::QuicheStringPiece payload, + absl::string_view 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( - quiche::QuicheStringPiece payload, + absl::string_view 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( - quiche::QuicheStringPiece payload, + absl::string_view 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, - quiche::QuicheStringPiece unpadded_payload, + absl::string_view 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, - quiche::QuicheStringPiece unpadded_payload, + absl::string_view 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( - quiche::QuicheStringPiece payload, + absl::string_view payload, const Http2FrameHeader& header, size_t expected_missing_length) { set_frame_header(header);
diff --git a/http2/hpack/decoder/hpack_block_collector.cc b/http2/hpack/decoder/hpack_block_collector.cc index 325a60c..88e0a9a 100644 --- a/http2/hpack/decoder/hpack_block_collector.cc +++ b/http2/hpack/decoder/hpack_block_collector.cc
@@ -112,7 +112,7 @@ HpackEntryType expected_type, size_t expected_index, bool expected_value_huffman, - quiche::QuicheStringPiece expected_value) const { + absl::string_view expected_value) const { VERIFY_TRUE(pending_entry_.IsClear()); VERIFY_EQ(1u, entries_.size()); VERIFY_TRUE(entries_.front().ValidateLiteralValueHeader( @@ -122,9 +122,9 @@ AssertionResult HpackBlockCollector::ValidateSoleLiteralNameValueHeader( HpackEntryType expected_type, bool expected_name_huffman, - quiche::QuicheStringPiece expected_name, + absl::string_view expected_name, bool expected_value_huffman, - quiche::QuicheStringPiece expected_value) const { + absl::string_view expected_value) const { VERIFY_TRUE(pending_entry_.IsClear()); VERIFY_EQ(1u, entries_.size()); VERIFY_TRUE(entries_.front().ValidateLiteralNameValueHeader(
diff --git a/http2/hpack/decoder/hpack_block_collector.h b/http2/hpack/decoder/hpack_block_collector.h index 6030c14..55d9449 100644 --- a/http2/hpack/decoder/hpack_block_collector.h +++ b/http2/hpack/decoder/hpack_block_collector.h
@@ -18,12 +18,12 @@ #include <string> #include <vector> +#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_entry_collector.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_entry_decoder_listener.h" #include "net/third_party/quiche/src/http2/hpack/http2_hpack_constants.h" #include "net/third_party/quiche/src/http2/hpack/tools/hpack_block_builder.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { namespace test { @@ -96,16 +96,16 @@ HpackEntryType expected_type, size_t expected_index, bool expected_value_huffman, - quiche::QuicheStringPiece expected_value) const; + absl::string_view expected_value) const; // Return AssertionSuccess if there is just one entry, and it is a Header // with a literal name and literal value. ::testing::AssertionResult ValidateSoleLiteralNameValueHeader( HpackEntryType expected_type, bool expected_name_huffman, - quiche::QuicheStringPiece expected_name, + absl::string_view expected_name, bool expected_value_huffman, - quiche::QuicheStringPiece expected_value) const; + absl::string_view expected_value) const; bool IsNotPending() const { return pending_entry_.IsClear(); } bool IsClear() const { return IsNotPending() && entries_.empty(); }
diff --git a/http2/hpack/decoder/hpack_block_decoder_test.cc b/http2/hpack/decoder/hpack_block_decoder_test.cc index 9618145..e392ffa 100644 --- a/http2/hpack/decoder/hpack_block_decoder_test.cc +++ b/http2/hpack/decoder/hpack_block_decoder_test.cc
@@ -9,6 +9,7 @@ #include <cstdint> #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/hpack/decoder/hpack_block_collector.h" #include "net/third_party/quiche/src/http2/hpack/http2_hpack_constants.h" @@ -17,7 +18,6 @@ #include "net/third_party/quiche/src/http2/platform/api/http2_test_helpers.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.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" #include "net/third_party/quiche/src/common/platform/api/quiche_test.h" using ::testing::AssertionSuccess; @@ -66,7 +66,7 @@ } AssertionResult DecodeHpackExampleAndValidateSeveralWays( - quiche::QuicheStringPiece hpack_example, + absl::string_view hpack_example, Validator validator) { std::string input = HpackExampleToStringOrDie(hpack_example); DecodeBuffer db(input);
diff --git a/http2/hpack/decoder/hpack_decoder_listener.cc b/http2/hpack/decoder/hpack_decoder_listener.cc index c1f7c8e..c2c8308 100644 --- a/http2/hpack/decoder/hpack_decoder_listener.cc +++ b/http2/hpack/decoder/hpack_decoder_listener.cc
@@ -17,7 +17,7 @@ const HpackString& /*value*/) {} void HpackDecoderNoOpListener::OnHeaderListEnd() {} void HpackDecoderNoOpListener::OnHeaderErrorDetected( - quiche::QuicheStringPiece /*error_message*/) {} + absl::string_view /*error_message*/) {} // static HpackDecoderNoOpListener* HpackDecoderNoOpListener::NoOpListener() {
diff --git a/http2/hpack/decoder/hpack_decoder_listener.h b/http2/hpack/decoder/hpack_decoder_listener.h index f1b76db..9b67012 100644 --- a/http2/hpack/decoder/hpack_decoder_listener.h +++ b/http2/hpack/decoder/hpack_decoder_listener.h
@@ -8,10 +8,10 @@ #ifndef QUICHE_HTTP2_HPACK_DECODER_HPACK_DECODER_LISTENER_H_ #define QUICHE_HTTP2_HPACK_DECODER_HPACK_DECODER_LISTENER_H_ +#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/http2/hpack/hpack_string.h" #include "net/third_party/quiche/src/http2/hpack/http2_hpack_constants.h" #include "net/third_party/quiche/src/common/platform/api/quiche_export.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { @@ -37,8 +37,7 @@ // OnHeaderErrorDetected is called if an error is detected while decoding. // error_message may be used in a GOAWAY frame as the Opaque Data. - virtual void OnHeaderErrorDetected( - quiche::QuicheStringPiece error_message) = 0; + virtual void OnHeaderErrorDetected(absl::string_view error_message) = 0; }; // A no-op implementation of HpackDecoderListener, useful for ignoring @@ -52,7 +51,7 @@ void OnHeaderListStart() override; void OnHeader(const HpackString& name, const HpackString& value) override; void OnHeaderListEnd() override; - void OnHeaderErrorDetected(quiche::QuicheStringPiece error_message) override; + void OnHeaderErrorDetected(absl::string_view error_message) override; // Returns a listener that ignores all the calls. static HpackDecoderNoOpListener* NoOpListener();
diff --git a/http2/hpack/decoder/hpack_decoder_state.h b/http2/hpack/decoder/hpack_decoder_state.h index 3854a6c..6478a46 100644 --- a/http2/hpack/decoder/hpack_decoder_state.h +++ b/http2/hpack/decoder/hpack_decoder_state.h
@@ -16,6 +16,7 @@ #include <cstdint> +#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_decoder_listener.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_decoder_string_buffer.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_decoder_tables.h" @@ -23,7 +24,6 @@ #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_whole_entry_listener.h" #include "net/third_party/quiche/src/http2/hpack/http2_hpack_constants.h" #include "net/third_party/quiche/src/common/platform/api/quiche_export.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { namespace test {
diff --git a/http2/hpack/decoder/hpack_decoder_state_test.cc b/http2/hpack/decoder/hpack_decoder_state_test.cc index d0c7b52..3ceaea2 100644 --- a/http2/hpack/decoder/hpack_decoder_state_test.cc +++ b/http2/hpack/decoder/hpack_decoder_state_test.cc
@@ -9,12 +9,12 @@ #include <utility> #include <vector> +#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/http2/hpack/hpack_string.h" #include "net/third_party/quiche/src/http2/hpack/http2_hpack_constants.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_test_helpers.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::AssertionResult; @@ -40,8 +40,10 @@ MOCK_METHOD2(OnHeader, void(const HpackString& name, const HpackString& value)); MOCK_METHOD0(OnHeaderListEnd, void()); - MOCK_METHOD1(OnHeaderErrorDetected, - void(quiche::QuicheStringPiece error_message)); + MOCK_METHOD(void, + OnHeaderErrorDetected, + (absl::string_view error_message), + (override)); }; enum StringBacking { STATIC, UNBUFFERED, BUFFERED };
diff --git a/http2/hpack/decoder/hpack_decoder_string_buffer.cc b/http2/hpack/decoder/hpack_decoder_string_buffer.cc index f461c1e..2e476b0 100644 --- a/http2/hpack/decoder/hpack_decoder_string_buffer.cc +++ b/http2/hpack/decoder/hpack_decoder_string_buffer.cc
@@ -60,8 +60,7 @@ state_ = State::RESET; } -void HpackDecoderStringBuffer::Set(quiche::QuicheStringPiece value, - bool is_static) { +void HpackDecoderStringBuffer::Set(absl::string_view value, bool is_static) { HTTP2_DVLOG(2) << "HpackDecoderStringBuffer::Set"; DCHECK_EQ(state_, State::RESET); value_ = value; @@ -101,7 +100,7 @@ backing_ = Backing::RESET; // OnData is not called for empty (zero length) strings, so make sure that // value_ is cleared. - value_ = quiche::QuicheStringPiece(); + value_ = absl::string_view(); } } @@ -114,7 +113,7 @@ if (is_huffman_encoded_) { DCHECK_EQ(backing_, Backing::BUFFERED); - return decoder_.Decode(quiche::QuicheStringPiece(data, len), &buffer_); + return decoder_.Decode(absl::string_view(data, len), &buffer_); } if (backing_ == Backing::RESET) { @@ -122,7 +121,7 @@ // don't copy the string. If we later find that the HPACK entry is split // across input buffers, then we'll copy the string into buffer_. if (remaining_len_ == 0) { - value_ = quiche::QuicheStringPiece(data, len); + value_ = absl::string_view(data, len); backing_ = Backing::UNBUFFERED; return true; } @@ -188,14 +187,13 @@ return IsBuffered() ? buffer_.size() : 0; } -quiche::QuicheStringPiece HpackDecoderStringBuffer::str() const { +absl::string_view HpackDecoderStringBuffer::str() const { HTTP2_DVLOG(3) << "HpackDecoderStringBuffer::str"; DCHECK_EQ(state_, State::COMPLETE); return value_; } -quiche::QuicheStringPiece HpackDecoderStringBuffer::GetStringIfComplete() - const { +absl::string_view HpackDecoderStringBuffer::GetStringIfComplete() const { if (state_ != State::COMPLETE) { return {}; }
diff --git a/http2/hpack/decoder/hpack_decoder_string_buffer.h b/http2/hpack/decoder/hpack_decoder_string_buffer.h index 1341e79..b11d50f 100644 --- a/http2/hpack/decoder/hpack_decoder_string_buffer.h +++ b/http2/hpack/decoder/hpack_decoder_string_buffer.h
@@ -14,9 +14,9 @@ #include <ostream> #include <string> +#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/http2/hpack/huffman/hpack_huffman_decoder.h" #include "net/third_party/quiche/src/common/platform/api/quiche_export.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { @@ -32,7 +32,7 @@ HpackDecoderStringBuffer& operator=(const HpackDecoderStringBuffer&) = delete; void Reset(); - void Set(quiche::QuicheStringPiece value, bool is_static); + void Set(absl::string_view value, bool is_static); // Note that for Huffman encoded strings the length of the string after // decoding may be larger (expected), the same or even smaller; the latter @@ -47,14 +47,14 @@ // Accessors for the completely collected string (i.e. Set or OnEnd has just // been called, and no reset of the state has occurred). - // Returns a QuicheStringPiece pointing to the backing store for the string, + // Returns a string_view pointing to the backing store for the string, // either the internal buffer or the original transport buffer (e.g. for a // literal value that wasn't Huffman encoded, and that wasn't split across // transport buffers). - quiche::QuicheStringPiece str() const; + absl::string_view str() const; // Same as str() if state_ is COMPLETE. Otherwise, returns empty string piece. - quiche::QuicheStringPiece GetStringIfComplete() const; + absl::string_view GetStringIfComplete() const; // Returns the completely collected string by value, using std::move in an // effort to avoid unnecessary copies. ReleaseString() must not be called @@ -75,10 +75,10 @@ // (e.g. if Huffman encoded, buffer_ is storage for the decoded string). std::string buffer_; - // The QuicheStringPiece to be returned by HpackDecoderStringBuffer::str(). If + // The string_view to be returned by HpackDecoderStringBuffer::str(). If // a string has been collected, but not buffered, value_ points to that // string. - quiche::QuicheStringPiece value_; + absl::string_view value_; // The decoder to use if the string is Huffman encoded. HpackHuffmanDecoder decoder_;
diff --git a/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc b/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc index 69da1da..51747e7 100644 --- a/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc +++ b/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc
@@ -46,7 +46,7 @@ }; TEST_F(HpackDecoderStringBufferTest, SetStatic) { - quiche::QuicheStringPiece data("static string"); + absl::string_view data("static string"); EXPECT_EQ(state(), State::RESET); EXPECT_TRUE(VerifyLogHasSubstrs({"state=RESET"})); @@ -71,7 +71,7 @@ } TEST_F(HpackDecoderStringBufferTest, PlainWhole) { - quiche::QuicheStringPiece data("some text."); + absl::string_view data("some text."); HTTP2_LOG(INFO) << buf_; EXPECT_EQ(state(), State::RESET); @@ -93,7 +93,7 @@ {"state=COMPLETE", "backing=UNBUFFERED", "value: some text."})); // We expect that the string buffer points to the passed in - // QuicheStringPiece's backing store. + // string_view's backing store. EXPECT_EQ(data.data(), buf_.str().data()); // Now force it to buffer the string, after which it will still have the same @@ -109,9 +109,9 @@ } TEST_F(HpackDecoderStringBufferTest, PlainSplit) { - quiche::QuicheStringPiece data("some text."); - quiche::QuicheStringPiece part1 = data.substr(0, 1); - quiche::QuicheStringPiece part2 = data.substr(1); + absl::string_view data("some text."); + absl::string_view part1 = data.substr(0, 1); + absl::string_view part2 = data.substr(1); EXPECT_EQ(state(), State::RESET); buf_.OnStart(/*huffman_encoded*/ false, data.size()); @@ -137,7 +137,7 @@ EXPECT_EQ(buf_.BufferedLength(), data.size()); HTTP2_LOG(INFO) << buf_; - quiche::QuicheStringPiece buffered = buf_.str(); + absl::string_view buffered = buf_.str(); EXPECT_EQ(data, buffered); EXPECT_NE(data.data(), buffered.data()); @@ -152,7 +152,7 @@ TEST_F(HpackDecoderStringBufferTest, HuffmanWhole) { std::string encoded = Http2HexDecode("f1e3c2e5f23a6ba0ab90f4ff"); - quiche::QuicheStringPiece decoded("www.example.com"); + absl::string_view decoded("www.example.com"); EXPECT_EQ(state(), State::RESET); buf_.OnStart(/*huffman_encoded*/ true, encoded.size()); @@ -179,7 +179,7 @@ std::string encoded = Http2HexDecode("f1e3c2e5f23a6ba0ab90f4ff"); std::string part1 = encoded.substr(0, 5); std::string part2 = encoded.substr(5); - quiche::QuicheStringPiece decoded("www.example.com"); + absl::string_view decoded("www.example.com"); EXPECT_EQ(state(), State::RESET); buf_.OnStart(/*huffman_encoded*/ true, encoded.size());
diff --git a/http2/hpack/decoder/hpack_decoder_test.cc b/http2/hpack/decoder/hpack_decoder_test.cc index b110f03..eb14276 100644 --- a/http2/hpack/decoder/hpack_decoder_test.cc +++ b/http2/hpack/decoder/hpack_decoder_test.cc
@@ -67,8 +67,10 @@ MOCK_METHOD2(OnHeader, void(const HpackString& name, const HpackString& value)); MOCK_METHOD0(OnHeaderListEnd, void()); - MOCK_METHOD1(OnHeaderErrorDetected, - void(quiche::QuicheStringPiece error_message)); + MOCK_METHOD(void, + OnHeaderErrorDetected, + (absl::string_view error_message), + (override)); }; class HpackDecoderTest : public QuicheTestWithParam<bool>, @@ -113,7 +115,7 @@ // OnHeaderErrorDetected is called if an error is detected while decoding. // error_message may be used in a GOAWAY frame as the Opaque Data. - void OnHeaderErrorDetected(quiche::QuicheStringPiece error_message) override { + void OnHeaderErrorDetected(absl::string_view error_message) override { ASSERT_TRUE(saw_start_); error_messages_.push_back(std::string(error_message)); // No further callbacks should be made at this point, so replace 'this' as @@ -123,7 +125,7 @@ HpackDecoderPeer::GetDecoderState(&decoder_), &mock_listener_); } - AssertionResult DecodeBlock(quiche::QuicheStringPiece block) { + AssertionResult DecodeBlock(absl::string_view block) { HTTP2_VLOG(1) << "HpackDecoderTest::DecodeBlock"; VERIFY_FALSE(decoder_.DetectError());
diff --git a/http2/hpack/decoder/hpack_decoding_error.cc b/http2/hpack/decoder/hpack_decoding_error.cc index 3e231b5..4b106a9 100644 --- a/http2/hpack/decoder/hpack_decoding_error.cc +++ b/http2/hpack/decoder/hpack_decoding_error.cc
@@ -7,7 +7,7 @@ namespace http2 { // static -quiche::QuicheStringPiece HpackDecodingErrorToString(HpackDecodingError error) { +absl::string_view HpackDecodingErrorToString(HpackDecodingError error) { switch (error) { case HpackDecodingError::kOk: return "No error detected";
diff --git a/http2/hpack/decoder/hpack_decoding_error.h b/http2/hpack/decoder/hpack_decoding_error.h index e346549..3536b97 100644 --- a/http2/hpack/decoder/hpack_decoding_error.h +++ b/http2/hpack/decoder/hpack_decoding_error.h
@@ -5,8 +5,8 @@ #ifndef QUICHE_HTTP2_HPACK_DECODER_HPACK_DECODING_ERROR_H_ #define QUICHE_HTTP2_HPACK_DECODER_HPACK_DECODING_ERROR_H_ +#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/common/platform/api/quiche_export.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { @@ -43,7 +43,7 @@ kCompressedHeaderSizeExceedsLimit, }; -QUICHE_EXPORT_PRIVATE quiche::QuicheStringPiece HpackDecodingErrorToString( +QUICHE_EXPORT_PRIVATE absl::string_view HpackDecodingErrorToString( HpackDecodingError error); } // namespace http2
diff --git a/http2/hpack/decoder/hpack_entry_collector.cc b/http2/hpack/decoder/hpack_entry_collector.cc index 109303d..b393828 100644 --- a/http2/hpack/decoder/hpack_entry_collector.cc +++ b/http2/hpack/decoder/hpack_entry_collector.cc
@@ -166,7 +166,7 @@ HpackEntryType expected_type, size_t expected_index, bool expected_value_huffman, - quiche::QuicheStringPiece expected_value) const { + absl::string_view expected_value) const { VERIFY_TRUE(started_); VERIFY_TRUE(ended_); VERIFY_EQ(expected_type, header_type_); @@ -179,9 +179,9 @@ AssertionResult HpackEntryCollector::ValidateLiteralNameValueHeader( HpackEntryType expected_type, bool expected_name_huffman, - quiche::QuicheStringPiece expected_name, + absl::string_view expected_name, bool expected_value_huffman, - quiche::QuicheStringPiece expected_value) const { + absl::string_view expected_value) const { VERIFY_TRUE(started_); VERIFY_TRUE(ended_); VERIFY_EQ(expected_type, header_type_);
diff --git a/http2/hpack/decoder/hpack_entry_collector.h b/http2/hpack/decoder/hpack_entry_collector.h index 1c8d709..e333789 100644 --- a/http2/hpack/decoder/hpack_entry_collector.h +++ b/http2/hpack/decoder/hpack_entry_collector.h
@@ -15,11 +15,11 @@ #include <iosfwd> #include <string> +#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_entry_decoder_listener.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_string_collector.h" #include "net/third_party/quiche/src/http2/hpack/http2_hpack_constants.h" #include "net/third_party/quiche/src/http2/hpack/tools/hpack_block_builder.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 { @@ -85,16 +85,16 @@ HpackEntryType expected_type, size_t expected_index, bool expected_value_huffman, - quiche::QuicheStringPiece expected_value) const; + absl::string_view expected_value) const; // Returns success if collected a Header with an literal name and literal // value. ::testing::AssertionResult ValidateLiteralNameValueHeader( HpackEntryType expected_type, bool expected_name_huffman, - quiche::QuicheStringPiece expected_name, + absl::string_view expected_name, bool expected_value_huffman, - quiche::QuicheStringPiece expected_value) const; + absl::string_view expected_value) const; // Returns success if collected a Dynamic Table Size Update, // with the specified size.
diff --git a/http2/hpack/decoder/hpack_string_collector.cc b/http2/hpack/decoder/hpack_string_collector.cc index b9feb48..8300d57 100644 --- a/http2/hpack/decoder/hpack_string_collector.cc +++ b/http2/hpack/decoder/hpack_string_collector.cc
@@ -66,7 +66,7 @@ } void HpackStringCollector::OnStringData(const char* data, size_t length) { - quiche::QuicheStringPiece sp(data, length); + absl::string_view sp(data, length); EXPECT_TRUE(IsInProgress()) << ToString(); EXPECT_LE(sp.size(), len) << ToString(); Http2StrAppend(&s, sp); @@ -80,7 +80,7 @@ } ::testing::AssertionResult HpackStringCollector::Collected( - quiche::QuicheStringPiece str, + absl::string_view str, bool is_huffman_encoded) const { VERIFY_TRUE(HasEnded()); VERIFY_EQ(str.size(), len);
diff --git a/http2/hpack/decoder/hpack_string_collector.h b/http2/hpack/decoder/hpack_string_collector.h index 2ebc7ae..9ba65c4 100644 --- a/http2/hpack/decoder/hpack_string_collector.h +++ b/http2/hpack/decoder/hpack_string_collector.h
@@ -12,8 +12,8 @@ #include <iosfwd> #include <string> +#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_string_decoder_listener.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 { @@ -40,7 +40,7 @@ void OnStringData(const char* data, size_t length) override; void OnStringEnd() override; - ::testing::AssertionResult Collected(quiche::QuicheStringPiece str, + ::testing::AssertionResult Collected(absl::string_view str, bool is_huffman_encoded) const; std::string ToString() const;
diff --git a/http2/hpack/decoder/hpack_string_decoder_test.cc b/http2/hpack/decoder/hpack_string_decoder_test.cc index 26213b8..bc6137c 100644 --- a/http2/hpack/decoder/hpack_string_decoder_test.cc +++ b/http2/hpack/decoder/hpack_string_decoder_test.cc
@@ -6,13 +6,13 @@ // Tests of HpackStringDecoder. +#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_string_collector.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_string_decoder_listener.h" #include "net/third_party/quiche/src/http2/hpack/tools/hpack_block_builder.h" #include "net/third_party/quiche/src/http2/platform/api/http2_test_helpers.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.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" #include "net/third_party/quiche/src/common/platform/api/quiche_test.h" using ::testing::AssertionResult; @@ -43,13 +43,13 @@ return decoder_.Resume(b, &listener_); } - AssertionResult Collected(quiche::QuicheStringPiece s, bool huffman_encoded) { + AssertionResult Collected(absl::string_view s, bool huffman_encoded) { HTTP2_VLOG(1) << collector_; return collector_.Collected(s, huffman_encoded); } // expected_str is a std::string rather than a const std::string& or - // QuicheStringPiece so that the lambda makes a copy of the string, and thus + // absl::string_view so that the lambda makes a copy of the string, and thus // the string to be passed to Collected outlives the call to MakeValidator. Validator MakeValidator(const std::string& expected_str, bool expected_huffman) { @@ -112,7 +112,7 @@ { Validator validator = ValidateDoneAndOffset(11, MakeValidator("start end.", kUncompressed)); - quiche::QuicheStringPiece data("\x0astart end."); + absl::string_view data("\x0astart end."); DecodeBuffer b(data); EXPECT_TRUE( DecodeAndValidateSeveralWays(&b, kMayReturnZeroOnFirst, validator));
diff --git a/http2/hpack/decoder/hpack_whole_entry_buffer.cc b/http2/hpack/decoder/hpack_whole_entry_buffer.cc index f8d5e9d..ecdcdc9 100644 --- a/http2/hpack/decoder/hpack_whole_entry_buffer.cc +++ b/http2/hpack/decoder/hpack_whole_entry_buffer.cc
@@ -70,7 +70,7 @@ void HpackWholeEntryBuffer::OnNameData(const char* data, size_t len) { HTTP2_DVLOG(2) << "HpackWholeEntryBuffer::OnNameData: len=" << len << " data:\n" - << Http2HexDump(quiche::QuicheStringPiece(data, len)); + << Http2HexDump(absl::string_view(data, len)); DCHECK_EQ(maybe_name_index_, 0u); if (!error_detected_ && !name_.OnData(data, len)) { ReportError(HpackDecodingError::kNameHuffmanError, ""); @@ -107,7 +107,7 @@ void HpackWholeEntryBuffer::OnValueData(const char* data, size_t len) { HTTP2_DVLOG(2) << "HpackWholeEntryBuffer::OnValueData: len=" << len << " data:\n" - << Http2HexDump(quiche::QuicheStringPiece(data, len)); + << Http2HexDump(absl::string_view(data, len)); if (!error_detected_ && !value_.OnData(data, len)) { ReportError(HpackDecodingError::kValueHuffmanError, ""); HTTP2_CODE_COUNT_N(decompress_failure_3, 22, 23);
diff --git a/http2/hpack/decoder/hpack_whole_entry_buffer.h b/http2/hpack/decoder/hpack_whole_entry_buffer.h index afca3b8..f7b81c5 100644 --- a/http2/hpack/decoder/hpack_whole_entry_buffer.h +++ b/http2/hpack/decoder/hpack_whole_entry_buffer.h
@@ -12,13 +12,13 @@ #include <stddef.h> +#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_decoder_string_buffer.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_decoding_error.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_entry_decoder_listener.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_whole_entry_listener.h" #include "net/third_party/quiche/src/http2/hpack/http2_hpack_constants.h" #include "net/third_party/quiche/src/common/platform/api/quiche_export.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 {
diff --git a/http2/hpack/decoder/hpack_whole_entry_listener.h b/http2/hpack/decoder/hpack_whole_entry_listener.h index ec2ae52..92135f9 100644 --- a/http2/hpack/decoder/hpack_whole_entry_listener.h +++ b/http2/hpack/decoder/hpack_whole_entry_listener.h
@@ -11,11 +11,11 @@ #include <stddef.h> +#include "absl/strings/string_view.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_decoder_string_buffer.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_decoding_error.h" #include "net/third_party/quiche/src/http2/hpack/http2_hpack_constants.h" #include "net/third_party/quiche/src/common/platform/api/quiche_export.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 {
diff --git a/http2/hpack/varint/hpack_varint_decoder_test.cc b/http2/hpack/varint/hpack_varint_decoder_test.cc index 06554e9..5b22f8b 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(quiche::QuicheStringPiece data, + void DecodeExpectSuccess(absl::string_view data, uint32_t prefix_length, uint64_t expected_value) { Validator validator = [expected_value, this]( @@ -52,8 +52,7 @@ EXPECT_EQ(expected_value, decoder_.value()); } - void DecodeExpectError(quiche::QuicheStringPiece data, - uint32_t prefix_length) { + void DecodeExpectError(absl::string_view data, uint32_t prefix_length) { Validator validator = [](const DecodeBuffer& /*db*/, DecodeStatus status) -> AssertionResult { VERIFY_EQ(DecodeStatus::kDecodeError, status); @@ -64,7 +63,7 @@ } private: - AssertionResult Decode(quiche::QuicheStringPiece data, + AssertionResult Decode(absl::string_view 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 e8a0964..957683f 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(quiche::QuicheStringPiece("\x1f\x9a\x0a")); + DecodeBuffer b(absl::string_view("\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 daed778..08351c4 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,8 +47,7 @@ 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](quiche::QuicheStringPiece v, - uint8_t bit) { + auto append_and_clear = [&s, &flags](absl::string_view 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 f14d93a..ec421b7 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(quiche::QuicheStringPiece data) { +inline std::string Http2HexDecode(absl::string_view data) { return Http2HexDecodeImpl(data); } -inline std::string Http2HexDump(quiche::QuicheStringPiece data) { +inline std::string Http2HexDump(absl::string_view data) { return Http2HexDumpImpl(data); } -inline std::string Http2HexEscape(quiche::QuicheStringPiece data) { +inline std::string Http2HexEscape(absl::string_view 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 e3d499c..5cb019d 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 quiche::QuicheStringPiece stringpiece_foo(string_foo); + const absl::string_view 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 quiche::QuicheStringPiece stringpiece_bar(kBar); + const absl::string_view stringpiece_bar(kBar); const std::string string_bar(kBar); Http2StrAppend(&output, kFoo, kBar); EXPECT_EQ("foobar", output);
diff --git a/quic/core/quic_framer_test.cc b/quic/core/quic_framer_test.cc index 77e03eb..da4319d 100644 --- a/quic/core/quic_framer_test.cc +++ b/quic/core/quic_framer_test.cc
@@ -200,8 +200,8 @@ const size_t packet_size = crypter.GetCiphertextSize(packet_data.size()); char* buffer = new char[packet_size]; size_t buf_len = 0; - if (!crypter.EncryptPacket(0, quiche::QuicheStringPiece(), packet_data, - buffer, &buf_len, packet_size)) { + if (!crypter.EncryptPacket(0, absl::string_view(), packet_data, buffer, + &buf_len, packet_size)) { delete[] buffer; return nullptr; }
diff --git a/quic/test_tools/quic_test_utils.cc b/quic/test_tools/quic_test_utils.cc index 12befe4..605fe80 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; - quiche::QuicheStringPiece retry_token; + absl::string_view retry_token; std::string detailed_error; QuicErrorCode error = QuicFramer::ParsePublicHeaderDispatcher( encrypted_packet,
diff --git a/spdy/core/hpack/hpack_header_table.cc b/spdy/core/hpack/hpack_header_table.cc index 1ecfd79..11f005b 100644 --- a/spdy/core/hpack/hpack_header_table.cc +++ b/spdy/core/hpack/hpack_header_table.cc
@@ -6,6 +6,7 @@ #include <algorithm> +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" #include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h" #include "net/third_party/quiche/src/spdy/core/hpack/hpack_static_table.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_containers.h"
diff --git a/spdy/core/hpack/hpack_header_table.h b/spdy/core/hpack/hpack_header_table.h index 7f558bd..f835ae7 100644 --- a/spdy/core/hpack/hpack_header_table.h +++ b/spdy/core/hpack/hpack_header_table.h
@@ -10,9 +10,9 @@ #include <deque> #include <memory> +#include "absl/hash/hash.h" #include "absl/strings/string_view.h" #include "net/third_party/quiche/src/common/platform/api/quiche_export.h" -#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" #include "net/third_party/quiche/src/spdy/core/hpack/hpack_entry.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_containers.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_macros.h" @@ -70,7 +70,7 @@ using UnorderedEntrySet = SpdyHashSet<HpackEntry*, EntryHasher, EntriesEq>; using NameToEntryMap = SpdyHashMap<absl::string_view, const HpackEntry*, - quiche::QuicheStringPieceHash>; + absl::Hash<absl::string_view>>; HpackHeaderTable(); HpackHeaderTable(const HpackHeaderTable&) = delete;
diff --git a/spdy/platform/api/spdy_string_utils.h b/spdy/platform/api/spdy_string_utils.h index b023f73..e7ee6a9 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 "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" +#include "absl/strings/string_view.h" #include "net/spdy/platform/impl/spdy_string_utils_impl.h" namespace spdy { @@ -28,12 +28,11 @@ return SpdyHexDigitToIntImpl(c); } -inline std::string SpdyHexDecode(quiche::QuicheStringPiece data) { +inline std::string SpdyHexDecode(absl::string_view data) { return SpdyHexDecodeImpl(data); } -inline bool SpdyHexDecodeToUInt32(quiche::QuicheStringPiece data, - uint32_t* out) { +inline bool SpdyHexDecodeToUInt32(absl::string_view data, uint32_t* out) { return SpdyHexDecodeToUInt32Impl(data, out); } @@ -45,7 +44,7 @@ return SpdyHexEncodeUInt32AndTrimImpl(data); } -inline std::string SpdyHexDump(quiche::QuicheStringPiece data) { +inline std::string SpdyHexDump(absl::string_view 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 4848bf0..2f8c022 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 "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" +#include "absl/strings/string_view.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 quiche::QuicheStringPiece stringpiece_foo(string_foo); + const absl::string_view 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 quiche::QuicheStringPiece stringpiece_bar(kBar); + const absl::string_view stringpiece_bar(kBar); const std::string string_bar(kBar); SpdyStrAppend(&output, kFoo, kBar); EXPECT_EQ("foobar", output);