Remove Http2StringPiece; use QuicheStringPiece instead. gfe-relnote: n/a, no functional change. PiperOrigin-RevId: 285412823 Change-Id: I907a65813e890ce153b93fe5f07721efb3ecc195
diff --git a/http2/hpack/decoder/hpack_block_collector.cc b/http2/hpack/decoder/hpack_block_collector.cc index 3490ca7..325a60c 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, - Http2StringPiece expected_value) const { + quiche::QuicheStringPiece 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, - Http2StringPiece expected_name, + quiche::QuicheStringPiece expected_name, bool expected_value_huffman, - Http2StringPiece expected_value) const { + quiche::QuicheStringPiece 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 0d8f811..8246de4 100644 --- a/http2/hpack/decoder/hpack_block_collector.h +++ b/http2/hpack/decoder/hpack_block_collector.h
@@ -23,8 +23,8 @@ #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/platform/api/http2_string_piece.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 { @@ -97,16 +97,16 @@ HpackEntryType expected_type, size_t expected_index, bool expected_value_huffman, - Http2StringPiece expected_value) const; + quiche::QuicheStringPiece 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, - Http2StringPiece expected_name, + quiche::QuicheStringPiece expected_name, bool expected_value_huffman, - Http2StringPiece expected_value) const; + quiche::QuicheStringPiece 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 4988b5c..aeb6c48 100644 --- a/http2/hpack/decoder/hpack_block_decoder_test.cc +++ b/http2/hpack/decoder/hpack_block_decoder_test.cc
@@ -15,10 +15,10 @@ #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/hpack/tools/hpack_example.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.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" using ::testing::AssertionSuccess; @@ -66,7 +66,7 @@ } AssertionResult DecodeHpackExampleAndValidateSeveralWays( - Http2StringPiece hpack_example, + quiche::QuicheStringPiece hpack_example, Validator validator) { std::string input = HpackExampleToStringOrDie(hpack_example); DecodeBuffer db(input);
diff --git a/http2/hpack/decoder/hpack_decoder.cc b/http2/hpack/decoder/hpack_decoder.cc index f2f8584..1421c7c 100644 --- a/http2/hpack/decoder/hpack_decoder.cc +++ b/http2/hpack/decoder/hpack_decoder.cc
@@ -109,7 +109,7 @@ return Http2EstimateMemoryUsage(entry_buffer_); } -void HpackDecoder::ReportError(Http2StringPiece error_message) { +void HpackDecoder::ReportError(quiche::QuicheStringPiece error_message) { HTTP2_DVLOG(3) << "HpackDecoder::ReportError is new=" << (!error_detected_ ? "true" : "false") << ", error_message: " << error_message;
diff --git a/http2/hpack/decoder/hpack_decoder.h b/http2/hpack/decoder/hpack_decoder.h index e173bc6..663fef6 100644 --- a/http2/hpack/decoder/hpack_decoder.h +++ b/http2/hpack/decoder/hpack_decoder.h
@@ -30,7 +30,7 @@ #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_decoder_tables.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_whole_entry_buffer.h" #include "net/third_party/quiche/src/http2/platform/api/http2_export.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { namespace test { @@ -102,7 +102,7 @@ friend class test::HpackDecoderPeer; // Reports an error to the listener IF this is the first error detected. - void ReportError(Http2StringPiece error_message); + void ReportError(quiche::QuicheStringPiece error_message); // The decompressor state, as defined by HPACK (i.e. the static and dynamic // tables).
diff --git a/http2/hpack/decoder/hpack_decoder_listener.cc b/http2/hpack/decoder/hpack_decoder_listener.cc index 8afa8aa..60341a0 100644 --- a/http2/hpack/decoder/hpack_decoder_listener.cc +++ b/http2/hpack/decoder/hpack_decoder_listener.cc
@@ -18,7 +18,7 @@ const HpackString& value) {} void HpackDecoderNoOpListener::OnHeaderListEnd() {} void HpackDecoderNoOpListener::OnHeaderErrorDetected( - Http2StringPiece error_message) {} + quiche::QuicheStringPiece 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 fa68591..2db8157 100644 --- a/http2/hpack/decoder/hpack_decoder_listener.h +++ b/http2/hpack/decoder/hpack_decoder_listener.h
@@ -11,7 +11,7 @@ #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/platform/api/http2_export.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { @@ -39,7 +39,8 @@ // 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(Http2StringPiece error_message) = 0; + virtual void OnHeaderErrorDetected( + quiche::QuicheStringPiece error_message) = 0; }; // A no-op implementation of HpackDecoderListener, useful for ignoring @@ -55,7 +56,7 @@ const HpackString& name, const HpackString& value) override; void OnHeaderListEnd() override; - void OnHeaderErrorDetected(Http2StringPiece error_message) override; + void OnHeaderErrorDetected(quiche::QuicheStringPiece error_message) override; // Returns a listener that ignores all the calls. static HpackDecoderNoOpListener* NoOpListener();
diff --git a/http2/hpack/decoder/hpack_decoder_state.cc b/http2/hpack/decoder/hpack_decoder_state.cc index 921d48c..c01ae74 100644 --- a/http2/hpack/decoder/hpack_decoder_state.cc +++ b/http2/hpack/decoder/hpack_decoder_state.cc
@@ -185,7 +185,8 @@ lowest_header_table_size_ = final_header_table_size_; } -void HpackDecoderState::OnHpackDecodeError(Http2StringPiece error_message) { +void HpackDecoderState::OnHpackDecodeError( + quiche::QuicheStringPiece error_message) { HTTP2_DVLOG(2) << "HpackDecoderState::OnHpackDecodeError " << error_message; if (!error_detected_) { ReportError(error_message); @@ -206,7 +207,7 @@ } } -void HpackDecoderState::ReportError(Http2StringPiece error_message) { +void HpackDecoderState::ReportError(quiche::QuicheStringPiece error_message) { HTTP2_DVLOG(2) << "HpackDecoderState::ReportError is new=" << (!error_detected_ ? "true" : "false") << ", error_message: " << error_message;
diff --git a/http2/hpack/decoder/hpack_decoder_state.h b/http2/hpack/decoder/hpack_decoder_state.h index fd34179..0139b31 100644 --- a/http2/hpack/decoder/hpack_decoder_state.h +++ b/http2/hpack/decoder/hpack_decoder_state.h
@@ -22,7 +22,7 @@ #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/http2/platform/api/http2_export.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { namespace test { @@ -76,7 +76,7 @@ HpackDecoderStringBuffer* name_buffer, HpackDecoderStringBuffer* value_buffer) override; void OnDynamicTableSizeUpdate(size_t size) override; - void OnHpackDecodeError(Http2StringPiece error_message) override; + void OnHpackDecodeError(quiche::QuicheStringPiece error_message) override; // OnHeaderBlockEnd notifies this object that an entire HPACK block has been // decoded, which might have extended into CONTINUATION blocks. @@ -94,7 +94,7 @@ friend class test::HpackDecoderStatePeer; // Reports an error to the listener IF this is the first error detected. - void ReportError(Http2StringPiece error_message); + void ReportError(quiche::QuicheStringPiece error_message); // The static and dynamic HPACK tables. HpackDecoderTables decoder_tables_;
diff --git a/http2/hpack/decoder/hpack_decoder_state_test.cc b/http2/hpack/decoder/hpack_decoder_state_test.cc index cbc4224..743d0d9 100644 --- a/http2/hpack/decoder/hpack_decoder_state_test.cc +++ b/http2/hpack/decoder/hpack_decoder_state_test.cc
@@ -15,8 +15,8 @@ #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_string_piece.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" using ::testing::AssertionResult; using ::testing::AssertionSuccess; @@ -44,7 +44,8 @@ const HpackString& name, const HpackString& value)); MOCK_METHOD0(OnHeaderListEnd, void()); - MOCK_METHOD1(OnHeaderErrorDetected, void(Http2StringPiece error_message)); + MOCK_METHOD1(OnHeaderErrorDetected, + void(quiche::QuicheStringPiece error_message)); }; enum StringBacking { STATIC, UNBUFFERED, BUFFERED }; @@ -517,8 +518,8 @@ TEST_F(HpackDecoderStateTest, ErrorsSuppressCallbacks) { SendStartAndVerifyCallback(); - EXPECT_CALL(listener_, - OnHeaderErrorDetected(Http2StringPiece("Huffman decode error."))); + EXPECT_CALL(listener_, OnHeaderErrorDetected(quiche::QuicheStringPiece( + "Huffman decode error."))); decoder_state_.OnHpackDecodeError("Huffman decode error."); // Further decoded entries are ignored.
diff --git a/http2/hpack/decoder/hpack_decoder_string_buffer.cc b/http2/hpack/decoder/hpack_decoder_string_buffer.cc index 6a20008..d38ea9f 100644 --- a/http2/hpack/decoder/hpack_decoder_string_buffer.cc +++ b/http2/hpack/decoder/hpack_decoder_string_buffer.cc
@@ -60,7 +60,8 @@ state_ = State::RESET; } -void HpackDecoderStringBuffer::Set(Http2StringPiece value, bool is_static) { +void HpackDecoderStringBuffer::Set(quiche::QuicheStringPiece value, + bool is_static) { HTTP2_DVLOG(2) << "HpackDecoderStringBuffer::Set"; DCHECK_EQ(state_, State::RESET); value_ = value; @@ -100,7 +101,7 @@ backing_ = Backing::RESET; // OnData is not called for empty (zero length) strings, so make sure that // value_ is cleared. - value_ = Http2StringPiece(); + value_ = quiche::QuicheStringPiece(); } } @@ -113,7 +114,7 @@ if (is_huffman_encoded_) { DCHECK_EQ(backing_, Backing::BUFFERED); - return decoder_.Decode(Http2StringPiece(data, len), &buffer_); + return decoder_.Decode(quiche::QuicheStringPiece(data, len), &buffer_); } if (backing_ == Backing::RESET) { @@ -121,7 +122,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_ = Http2StringPiece(data, len); + value_ = quiche::QuicheStringPiece(data, len); backing_ = Backing::UNBUFFERED; return true; } @@ -187,7 +188,7 @@ return IsBuffered() ? buffer_.size() : 0; } -Http2StringPiece HpackDecoderStringBuffer::str() const { +quiche::QuicheStringPiece HpackDecoderStringBuffer::str() const { HTTP2_DVLOG(3) << "HpackDecoderStringBuffer::str"; DCHECK_EQ(state_, State::COMPLETE); return value_;
diff --git a/http2/hpack/decoder/hpack_decoder_string_buffer.h b/http2/hpack/decoder/hpack_decoder_string_buffer.h index d8dce6c..94c46d5 100644 --- a/http2/hpack/decoder/hpack_decoder_string_buffer.h +++ b/http2/hpack/decoder/hpack_decoder_string_buffer.h
@@ -16,7 +16,7 @@ #include "net/third_party/quiche/src/http2/hpack/huffman/hpack_huffman_decoder.h" #include "net/third_party/quiche/src/http2/platform/api/http2_export.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.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(Http2StringPiece value, bool is_static); + void Set(quiche::QuicheStringPiece 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,11 +47,11 @@ // 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 Http2StringPiece pointing to the backing store for the string, + // Returns a QuicheStringPiece 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). - Http2StringPiece str() const; + quiche::QuicheStringPiece str() const; // Returns the completely collected string by value, using std::move in an // effort to avoid unnecessary copies. ReleaseString() must not be called @@ -72,10 +72,10 @@ // (e.g. if Huffman encoded, buffer_ is storage for the decoded string). std::string buffer_; - // The Http2StringPiece to be returned by HpackDecoderStringBuffer::str(). If + // The QuicheStringPiece to be returned by HpackDecoderStringBuffer::str(). If // a string has been collected, but not buffered, value_ points to that // string. - Http2StringPiece value_; + quiche::QuicheStringPiece 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 ec807c8..9c30db7 100644 --- a/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc +++ b/http2/hpack/decoder/hpack_decoder_string_buffer_test.cc
@@ -47,7 +47,7 @@ }; TEST_F(HpackDecoderStringBufferTest, SetStatic) { - Http2StringPiece data("static string"); + quiche::QuicheStringPiece data("static string"); EXPECT_EQ(state(), State::RESET); EXPECT_TRUE(VerifyLogHasSubstrs({"state=RESET"})); @@ -72,7 +72,7 @@ } TEST_F(HpackDecoderStringBufferTest, PlainWhole) { - Http2StringPiece data("some text."); + quiche::QuicheStringPiece data("some text."); HTTP2_LOG(INFO) << buf_; EXPECT_EQ(state(), State::RESET); @@ -93,8 +93,8 @@ EXPECT_TRUE(VerifyLogHasSubstrs( {"state=COMPLETE", "backing=UNBUFFERED", "value: some text."})); - // We expect that the string buffer points to the passed in Http2StringPiece's - // backing store. + // We expect that the string buffer points to the passed in + // QuicheStringPiece'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 @@ -110,9 +110,9 @@ } TEST_F(HpackDecoderStringBufferTest, PlainSplit) { - Http2StringPiece data("some text."); - Http2StringPiece part1 = data.substr(0, 1); - Http2StringPiece part2 = data.substr(1); + quiche::QuicheStringPiece data("some text."); + quiche::QuicheStringPiece part1 = data.substr(0, 1); + quiche::QuicheStringPiece part2 = data.substr(1); EXPECT_EQ(state(), State::RESET); buf_.OnStart(/*huffman_encoded*/ false, data.size()); @@ -138,7 +138,7 @@ EXPECT_EQ(buf_.BufferedLength(), data.size()); HTTP2_LOG(INFO) << buf_; - Http2StringPiece buffered = buf_.str(); + quiche::QuicheStringPiece buffered = buf_.str(); EXPECT_EQ(data, buffered); EXPECT_NE(data.data(), buffered.data()); @@ -153,7 +153,7 @@ TEST_F(HpackDecoderStringBufferTest, HuffmanWhole) { std::string encoded = Http2HexDecode("f1e3c2e5f23a6ba0ab90f4ff"); - Http2StringPiece decoded("www.example.com"); + quiche::QuicheStringPiece decoded("www.example.com"); EXPECT_EQ(state(), State::RESET); buf_.OnStart(/*huffman_encoded*/ true, encoded.size()); @@ -180,7 +180,7 @@ std::string encoded = Http2HexDecode("f1e3c2e5f23a6ba0ab90f4ff"); std::string part1 = encoded.substr(0, 5); std::string part2 = encoded.substr(5); - Http2StringPiece decoded("www.example.com"); + quiche::QuicheStringPiece 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 9734bdd..f2ff8c2 100644 --- a/http2/hpack/decoder/hpack_decoder_test.cc +++ b/http2/hpack/decoder/hpack_decoder_test.cc
@@ -70,7 +70,8 @@ const HpackString& name, const HpackString& value)); MOCK_METHOD0(OnHeaderListEnd, void()); - MOCK_METHOD1(OnHeaderErrorDetected, void(Http2StringPiece error_message)); + MOCK_METHOD1(OnHeaderErrorDetected, + void(quiche::QuicheStringPiece error_message)); }; class HpackDecoderTest : public ::testing::TestWithParam<bool>, @@ -119,7 +120,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(Http2StringPiece error_message) override { + void OnHeaderErrorDetected(quiche::QuicheStringPiece 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 @@ -129,7 +130,7 @@ HpackDecoderPeer::GetDecoderState(&decoder_), &mock_listener_); } - AssertionResult DecodeBlock(Http2StringPiece block) { + AssertionResult DecodeBlock(quiche::QuicheStringPiece block) { HTTP2_VLOG(1) << "HpackDecoderTest::DecodeBlock"; VERIFY_FALSE(decoder_.error_detected());
diff --git a/http2/hpack/decoder/hpack_entry_collector.cc b/http2/hpack/decoder/hpack_entry_collector.cc index 7706bd6..80d4f92 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, - Http2StringPiece expected_value) const { + quiche::QuicheStringPiece 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, - Http2StringPiece expected_name, + quiche::QuicheStringPiece expected_name, bool expected_value_huffman, - Http2StringPiece expected_value) const { + quiche::QuicheStringPiece 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 6b27b7b..abf9d97 100644 --- a/http2/hpack/decoder/hpack_entry_collector.h +++ b/http2/hpack/decoder/hpack_entry_collector.h
@@ -20,7 +20,7 @@ #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/http2/platform/api/http2_string_piece.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { namespace test { @@ -85,16 +85,16 @@ HpackEntryType expected_type, size_t expected_index, bool expected_value_huffman, - Http2StringPiece expected_value) const; + quiche::QuicheStringPiece 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, - Http2StringPiece expected_name, + quiche::QuicheStringPiece expected_name, bool expected_value_huffman, - Http2StringPiece expected_value) const; + quiche::QuicheStringPiece 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 e903755..0b18178 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) { - Http2StringPiece sp(data, length); + quiche::QuicheStringPiece sp(data, length); EXPECT_TRUE(IsInProgress()) << ToString(); EXPECT_LE(sp.size(), len) << ToString(); Http2StrAppend(&s, sp); @@ -80,7 +80,7 @@ } ::testing::AssertionResult HpackStringCollector::Collected( - Http2StringPiece str, + quiche::QuicheStringPiece 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 d56abee..8326a57 100644 --- a/http2/hpack/decoder/hpack_string_collector.h +++ b/http2/hpack/decoder/hpack_string_collector.h
@@ -14,7 +14,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_string_decoder_listener.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { namespace test { @@ -40,7 +40,7 @@ void OnStringData(const char* data, size_t length) override; void OnStringEnd() override; - ::testing::AssertionResult Collected(Http2StringPiece str, + ::testing::AssertionResult Collected(quiche::QuicheStringPiece 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 ceeebca..6c81b57 100644 --- a/http2/hpack/decoder/hpack_string_decoder_test.cc +++ b/http2/hpack/decoder/hpack_string_decoder_test.cc
@@ -10,10 +10,10 @@ #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_string_piece.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" using ::testing::AssertionResult; @@ -43,13 +43,13 @@ return decoder_.Resume(b, &listener_); } - AssertionResult Collected(Http2StringPiece s, bool huffman_encoded) { + AssertionResult Collected(quiche::QuicheStringPiece 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 - // Http2StringPiece so that the lambda makes a copy of the string, and thus + // QuicheStringPiece 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) { @@ -111,7 +111,7 @@ { Validator validator = ValidateDoneAndOffset(11, MakeValidator("start end.", kUncompressed)); - Http2StringPiece data("\x0astart end."); + quiche::QuicheStringPiece 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 dea6698..1f1f4f0 100644 --- a/http2/hpack/decoder/hpack_whole_entry_buffer.cc +++ b/http2/hpack/decoder/hpack_whole_entry_buffer.cc
@@ -67,7 +67,7 @@ void HpackWholeEntryBuffer::OnNameData(const char* data, size_t len) { HTTP2_DVLOG(2) << "HpackWholeEntryBuffer::OnNameData: len=" << len << " data:\n" - << Http2HexDump(Http2StringPiece(data, len)); + << Http2HexDump(quiche::QuicheStringPiece(data, len)); DCHECK_EQ(maybe_name_index_, 0u); if (!error_detected_ && !name_.OnData(data, len)) { ReportError("Error decoding HPACK entry name."); @@ -100,7 +100,7 @@ void HpackWholeEntryBuffer::OnValueData(const char* data, size_t len) { HTTP2_DVLOG(2) << "HpackWholeEntryBuffer::OnValueData: len=" << len << " data:\n" - << Http2HexDump(Http2StringPiece(data, len)); + << Http2HexDump(quiche::QuicheStringPiece(data, len)); if (!error_detected_ && !value_.OnData(data, len)) { ReportError("Error decoding HPACK entry value."); } @@ -131,7 +131,8 @@ listener_->OnDynamicTableSizeUpdate(size); } -void HpackWholeEntryBuffer::ReportError(Http2StringPiece error_message) { +void HpackWholeEntryBuffer::ReportError( + quiche::QuicheStringPiece error_message) { if (!error_detected_) { HTTP2_DVLOG(1) << "HpackWholeEntryBuffer::ReportError: " << error_message; error_detected_ = true;
diff --git a/http2/hpack/decoder/hpack_whole_entry_buffer.h b/http2/hpack/decoder/hpack_whole_entry_buffer.h index 61bf583..814c1b4 100644 --- a/http2/hpack/decoder/hpack_whole_entry_buffer.h +++ b/http2/hpack/decoder/hpack_whole_entry_buffer.h
@@ -17,7 +17,7 @@ #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/http2/platform/api/http2_export.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { @@ -79,7 +79,7 @@ void OnDynamicTableSizeUpdate(size_t size) override; private: - void ReportError(Http2StringPiece error_message); + void ReportError(quiche::QuicheStringPiece error_message); HpackWholeEntryListener* listener_; HpackDecoderStringBuffer name_, value_;
diff --git a/http2/hpack/decoder/hpack_whole_entry_buffer_test.cc b/http2/hpack/decoder/hpack_whole_entry_buffer_test.cc index 0265e9c..4ac82ea 100644 --- a/http2/hpack/decoder/hpack_whole_entry_buffer_test.cc +++ b/http2/hpack/decoder/hpack_whole_entry_buffer_test.cc
@@ -37,7 +37,8 @@ HpackDecoderStringBuffer* name_buffer, HpackDecoderStringBuffer* value_buffer)); MOCK_METHOD1(OnDynamicTableSizeUpdate, void(size_t size)); - MOCK_METHOD1(OnHpackDecodeError, void(Http2StringPiece error_message)); + MOCK_METHOD1(OnHpackDecodeError, + void(quiche::QuicheStringPiece error_message)); }; class HpackWholeEntryBufferTest : public ::testing::Test {
diff --git a/http2/hpack/decoder/hpack_whole_entry_listener.cc b/http2/hpack/decoder/hpack_whole_entry_listener.cc index b92e64a..69cf122 100644 --- a/http2/hpack/decoder/hpack_whole_entry_listener.cc +++ b/http2/hpack/decoder/hpack_whole_entry_listener.cc
@@ -21,7 +21,7 @@ HpackDecoderStringBuffer* value_buffer) {} void HpackWholeEntryNoOpListener::OnDynamicTableSizeUpdate(size_t size) {} void HpackWholeEntryNoOpListener::OnHpackDecodeError( - Http2StringPiece error_message) {} + quiche::QuicheStringPiece error_message) {} // static HpackWholeEntryNoOpListener* HpackWholeEntryNoOpListener::NoOpListener() {
diff --git a/http2/hpack/decoder/hpack_whole_entry_listener.h b/http2/hpack/decoder/hpack_whole_entry_listener.h index 2e559ce..eabe34a 100644 --- a/http2/hpack/decoder/hpack_whole_entry_listener.h +++ b/http2/hpack/decoder/hpack_whole_entry_listener.h
@@ -14,7 +14,7 @@ #include "net/third_party/quiche/src/http2/hpack/decoder/hpack_decoder_string_buffer.h" #include "net/third_party/quiche/src/http2/hpack/http2_hpack_constants.h" #include "net/third_party/quiche/src/http2/platform/api/http2_export.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { @@ -51,7 +51,7 @@ // OnHpackDecodeError is called if an error is detected while decoding. // error_message may be used in a GOAWAY frame as the Opaque Data. - virtual void OnHpackDecodeError(Http2StringPiece error_message) = 0; + virtual void OnHpackDecodeError(quiche::QuicheStringPiece error_message) = 0; }; // A no-op implementation of HpackWholeEntryDecoderListener, useful for ignoring @@ -69,7 +69,7 @@ HpackDecoderStringBuffer* name_buffer, HpackDecoderStringBuffer* value_buffer) override; void OnDynamicTableSizeUpdate(size_t size) override; - void OnHpackDecodeError(Http2StringPiece error_message) override; + void OnHpackDecodeError(quiche::QuicheStringPiece error_message) override; // Returns a listener that ignores all the calls. static HpackWholeEntryNoOpListener* NoOpListener();
diff --git a/http2/hpack/hpack_string.cc b/http2/hpack/hpack_string.cc index 85ba812..77ae5a3 100644 --- a/http2/hpack/hpack_string.cc +++ b/http2/hpack/hpack_string.cc
@@ -12,32 +12,33 @@ namespace http2 { HpackString::HpackString(const char* data) : str_(data) {} -HpackString::HpackString(Http2StringPiece str) : str_(std::string(str)) {} +HpackString::HpackString(quiche::QuicheStringPiece str) + : str_(std::string(str)) {} HpackString::HpackString(std::string str) : str_(std::move(str)) {} HpackString::HpackString(const HpackString& other) = default; HpackString::~HpackString() = default; -Http2StringPiece HpackString::ToStringPiece() const { +quiche::QuicheStringPiece HpackString::ToStringPiece() const { return str_; } bool HpackString::operator==(const HpackString& other) const { return str_ == other.str_; } -bool HpackString::operator==(Http2StringPiece str) const { +bool HpackString::operator==(quiche::QuicheStringPiece str) const { return str == str_; } -bool operator==(Http2StringPiece a, const HpackString& b) { +bool operator==(quiche::QuicheStringPiece a, const HpackString& b) { return b == a; } -bool operator!=(Http2StringPiece a, const HpackString& b) { +bool operator!=(quiche::QuicheStringPiece a, const HpackString& b) { return !(b == a); } bool operator!=(const HpackString& a, const HpackString& b) { return !(a == b); } -bool operator!=(const HpackString& a, Http2StringPiece b) { +bool operator!=(const HpackString& a, quiche::QuicheStringPiece b) { return !(a == b); } std::ostream& operator<<(std::ostream& out, const HpackString& v) { @@ -50,7 +51,8 @@ HTTP2_DVLOG(3) << DebugString() << " ctor"; } -HpackStringPair::HpackStringPair(Http2StringPiece name, Http2StringPiece value) +HpackStringPair::HpackStringPair(quiche::QuicheStringPiece name, + quiche::QuicheStringPiece value) : name(name), value(value) { HTTP2_DVLOG(3) << DebugString() << " ctor"; }
diff --git a/http2/hpack/hpack_string.h b/http2/hpack/hpack_string.h index e1535f7..9aac58e 100644 --- a/http2/hpack/hpack_string.h +++ b/http2/hpack/hpack_string.h
@@ -16,14 +16,14 @@ #include <string> #include "net/third_party/quiche/src/http2/platform/api/http2_export.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { class HTTP2_EXPORT_PRIVATE HpackString { public: explicit HpackString(const char* data); - explicit HpackString(Http2StringPiece str); + explicit HpackString(quiche::QuicheStringPiece str); explicit HpackString(std::string str); HpackString(const HpackString& other); @@ -34,27 +34,31 @@ size_t size() const { return str_.size(); } const std::string& ToString() const { return str_; } - Http2StringPiece ToStringPiece() const; + quiche::QuicheStringPiece ToStringPiece() const; bool operator==(const HpackString& other) const; - bool operator==(Http2StringPiece str) const; + bool operator==(quiche::QuicheStringPiece str) const; private: std::string str_; }; -HTTP2_EXPORT_PRIVATE bool operator==(Http2StringPiece a, const HpackString& b); -HTTP2_EXPORT_PRIVATE bool operator!=(Http2StringPiece a, const HpackString& b); +HTTP2_EXPORT_PRIVATE bool operator==(quiche::QuicheStringPiece a, + const HpackString& b); +HTTP2_EXPORT_PRIVATE bool operator!=(quiche::QuicheStringPiece a, + const HpackString& b); HTTP2_EXPORT_PRIVATE bool operator!=(const HpackString& a, const HpackString& b); -HTTP2_EXPORT_PRIVATE bool operator!=(const HpackString& a, Http2StringPiece b); +HTTP2_EXPORT_PRIVATE bool operator!=(const HpackString& a, + quiche::QuicheStringPiece b); HTTP2_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& out, const HpackString& v); struct HTTP2_EXPORT_PRIVATE HpackStringPair { HpackStringPair(const HpackString& name, const HpackString& value); - HpackStringPair(Http2StringPiece name, Http2StringPiece value); + HpackStringPair(quiche::QuicheStringPiece name, + quiche::QuicheStringPiece value); ~HpackStringPair(); // Returns the size of a header entry with this name and value, per the RFC:
diff --git a/http2/hpack/hpack_string_test.cc b/http2/hpack/hpack_string_test.cc index 9230ecc..0673f5e 100644 --- a/http2/hpack/hpack_string_test.cc +++ b/http2/hpack/hpack_string_test.cc
@@ -28,7 +28,7 @@ AssertionResult VerifyNotEqual(HpackString* actual, const std::string& not_expected_str) { const char* not_expected_ptr = not_expected_str.c_str(); - Http2StringPiece not_expected_sp(not_expected_str); + quiche::QuicheStringPiece not_expected_sp(not_expected_str); VERIFY_NE(*actual, not_expected_ptr); VERIFY_NE(*actual, not_expected_sp); @@ -56,7 +56,7 @@ VERIFY_EQ(actual->size(), expected_str.size()); const char* expected_ptr = expected_str.c_str(); - const Http2StringPiece expected_sp(expected_str); + const quiche::QuicheStringPiece expected_sp(expected_str); VERIFY_EQ(*actual, expected_ptr); VERIFY_EQ(*actual, expected_sp); @@ -91,12 +91,12 @@ } TEST_F(HpackStringTest, StringPieceConstructor) { - Http2StringPiece sp0(kStr0); + quiche::QuicheStringPiece sp0(kStr0); HpackString hs0(sp0); EXPECT_TRUE(VerifyEqual(&hs0, kStr0)); EXPECT_TRUE(VerifyNotEqual(&hs0, kStr1)); - Http2StringPiece sp1(kStr1); + quiche::QuicheStringPiece sp1(kStr1); HpackString hs1(sp1); EXPECT_TRUE(VerifyEqual(&hs1, kStr1)); EXPECT_TRUE(VerifyNotEqual(&hs1, kStr0)); @@ -115,7 +115,7 @@ } TEST_F(HpackStringTest, CopyConstructor) { - Http2StringPiece sp0(kStr0); + quiche::QuicheStringPiece sp0(kStr0); HpackString hs0(sp0); HpackString hs1(hs0); EXPECT_EQ(hs0, hs1); @@ -128,7 +128,7 @@ } TEST_F(HpackStringTest, MoveConstructor) { - Http2StringPiece sp0(kStr0); + quiche::QuicheStringPiece sp0(kStr0); HpackString hs0(sp0); EXPECT_TRUE(VerifyEqual(&hs0, kStr0)); EXPECT_TRUE(VerifyNotEqual(&hs0, ""));
diff --git a/http2/hpack/huffman/hpack_huffman_decoder.cc b/http2/hpack/huffman/hpack_huffman_decoder.cc index 71ce855..18bff72 100644 --- a/http2/hpack/huffman/hpack_huffman_decoder.cc +++ b/http2/hpack/huffman/hpack_huffman_decoder.cc
@@ -356,7 +356,7 @@ count_ = 0; } -size_t HuffmanBitBuffer::AppendBytes(Http2StringPiece input) { +size_t HuffmanBitBuffer::AppendBytes(quiche::QuicheStringPiece input) { HuffmanAccumulatorBitCount free_cnt = free_count(); size_t bytes_available = input.size(); if (free_cnt < 8 || bytes_available == 0) { @@ -414,7 +414,8 @@ HpackHuffmanDecoder::~HpackHuffmanDecoder() = default; -bool HpackHuffmanDecoder::Decode(Http2StringPiece input, std::string* output) { +bool HpackHuffmanDecoder::Decode(quiche::QuicheStringPiece input, + std::string* output) { HTTP2_DVLOG(1) << "HpackHuffmanDecoder::Decode"; // Fill bit_buffer_ from input.
diff --git a/http2/hpack/huffman/hpack_huffman_decoder.h b/http2/hpack/huffman/hpack_huffman_decoder.h index 065fe85..73c0162 100644 --- a/http2/hpack/huffman/hpack_huffman_decoder.h +++ b/http2/hpack/huffman/hpack_huffman_decoder.h
@@ -19,7 +19,7 @@ #include <string> #include "net/third_party/quiche/src/http2/platform/api/http2_export.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { @@ -47,7 +47,7 @@ // Add as many whole bytes to the accumulator (accumulator_) as possible, // returning the number of bytes added. - size_t AppendBytes(Http2StringPiece input); + size_t AppendBytes(quiche::QuicheStringPiece input); // Get the bits of the accumulator. HuffmanAccumulator value() const { return accumulator_; } @@ -109,7 +109,7 @@ // will contain the leading bits of the code for that symbol, but not the // final bits of that code. // Note that output should be empty, but that it is not cleared by Decode(). - bool Decode(Http2StringPiece input, std::string* output); + bool Decode(quiche::QuicheStringPiece input, std::string* output); // Is what remains in the bit_buffer_ valid at the end of an encoded string? // Call after passing the the final portion of a Huffman string to Decode,
diff --git a/http2/hpack/huffman/hpack_huffman_decoder_test.cc b/http2/hpack/huffman/hpack_huffman_decoder_test.cc index f1bed3c..e5a6e28 100644 --- a/http2/hpack/huffman/hpack_huffman_decoder_test.cc +++ b/http2/hpack/huffman/hpack_huffman_decoder_test.cc
@@ -36,7 +36,7 @@ s.push_back('\x11'); s.push_back('\x22'); s.push_back('\x33'); - Http2StringPiece sp(s); + quiche::QuicheStringPiece sp(s); HuffmanBitBuffer bb; sp.remove_prefix(bb.AppendBytes(sp)); @@ -85,7 +85,7 @@ s.push_back('\x11'); s.push_back('\x22'); s.push_back('\x33'); - Http2StringPiece sp(s); + quiche::QuicheStringPiece sp(s); HuffmanBitBuffer bb; sp.remove_prefix(bb.AppendBytes(sp)); @@ -117,7 +117,7 @@ s.push_back('\xbb'); s.push_back('\xcc'); s.push_back('\xdd'); - Http2StringPiece sp(s); + quiche::QuicheStringPiece sp(s); HuffmanBitBuffer bb; sp.remove_prefix(bb.AppendBytes(sp)); @@ -161,10 +161,10 @@ DecodeStatus ResumeDecoding(DecodeBuffer* b) override { input_bytes_seen_ += b->Remaining(); - Http2StringPiece sp(b->cursor(), b->Remaining()); + quiche::QuicheStringPiece sp(b->cursor(), b->Remaining()); if (decoder_.Decode(sp, &output_buffer_)) { b->AdvanceCursor(b->Remaining()); - // Successfully decoded (or buffered) the bytes in Http2StringPiece. + // Successfully decoded (or buffered) the bytes in QuicheStringPiece. EXPECT_LE(input_bytes_seen_, input_bytes_expected_); // Have we reached the end of the encoded string? if (input_bytes_expected_ == input_bytes_seen_) {
diff --git a/http2/hpack/huffman/hpack_huffman_encoder.cc b/http2/hpack/huffman/hpack_huffman_encoder.cc index 8a5dee9..8b3f29f 100644 --- a/http2/hpack/huffman/hpack_huffman_encoder.cc +++ b/http2/hpack/huffman/hpack_huffman_encoder.cc
@@ -11,7 +11,7 @@ namespace http2 { -size_t ExactHuffmanSize(Http2StringPiece plain) { +size_t ExactHuffmanSize(quiche::QuicheStringPiece plain) { size_t bits = 0; for (const uint8_t c : plain) { bits += HuffmanSpecTables::kCodeLengths[c]; @@ -19,7 +19,7 @@ return (bits + 7) / 8; } -size_t BoundedHuffmanSize(Http2StringPiece plain) { +size_t BoundedHuffmanSize(quiche::QuicheStringPiece plain) { // TODO(jamessynge): Determine whether we should set the min size for Huffman // encoding much higher (i.e. if less than N, then the savings isn't worth // the cost of encoding and decoding). Of course, we need to decide on a @@ -61,7 +61,7 @@ return (bits + 7) / 8; } -void HuffmanEncode(Http2StringPiece plain, std::string* huffman) { +void HuffmanEncode(quiche::QuicheStringPiece plain, std::string* huffman) { DCHECK(huffman != nullptr); huffman->clear(); // Note that this doesn't release memory. uint64_t bit_buffer = 0; // High-bit is next bit to output. Not clear if that
diff --git a/http2/hpack/huffman/hpack_huffman_encoder.h b/http2/hpack/huffman/hpack_huffman_encoder.h index 247aaff..f7a8e94 100644 --- a/http2/hpack/huffman/hpack_huffman_encoder.h +++ b/http2/hpack/huffman/hpack_huffman_encoder.h
@@ -12,13 +12,13 @@ #include <string> #include "net/third_party/quiche/src/http2/platform/api/http2_export.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { // Returns the size of the Huffman encoding of |plain|, which may be greater // than plain.size(). Mostly present for testing. -HTTP2_EXPORT_PRIVATE size_t ExactHuffmanSize(Http2StringPiece plain); +HTTP2_EXPORT_PRIVATE size_t ExactHuffmanSize(quiche::QuicheStringPiece plain); // Returns the size of the Huffman encoding of |plain|, unless it is greater // than or equal to plain.size(), in which case a value greater than or equal to @@ -26,13 +26,13 @@ // it doesn't read as much of the input string in the event that the string is // not compressible by HuffmanEncode (i.e. when the encoding is longer than the // original string, it stops reading the input string as soon as it knows that). -HTTP2_EXPORT_PRIVATE size_t BoundedHuffmanSize(Http2StringPiece plain); +HTTP2_EXPORT_PRIVATE size_t BoundedHuffmanSize(quiche::QuicheStringPiece plain); // Encode the plain text string |plain| with the Huffman encoding defined in // the HPACK RFC, 7541. |*huffman| does not have to be empty, it is cleared at // the beginning of this function. This allows reusing the same string object // across multiple invocations. -HTTP2_EXPORT_PRIVATE void HuffmanEncode(Http2StringPiece plain, +HTTP2_EXPORT_PRIVATE void HuffmanEncode(quiche::QuicheStringPiece plain, std::string* huffman); } // namespace http2
diff --git a/http2/hpack/huffman/hpack_huffman_transcoder_test.cc b/http2/hpack/huffman/hpack_huffman_transcoder_test.cc index 9781094..b7407a3 100644 --- a/http2/hpack/huffman/hpack_huffman_transcoder_test.cc +++ b/http2/hpack/huffman/hpack_huffman_transcoder_test.cc
@@ -11,9 +11,9 @@ #include "net/third_party/quiche/src/http2/decoder/decode_status.h" #include "net/third_party/quiche/src/http2/hpack/huffman/hpack_huffman_decoder.h" #include "net/third_party/quiche/src/http2/hpack/huffman/hpack_huffman_encoder.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.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_string_piece.h" using ::testing::AssertionResult; using ::testing::AssertionSuccess; @@ -52,10 +52,10 @@ DecodeStatus ResumeDecoding(DecodeBuffer* b) override { input_bytes_seen_ += b->Remaining(); - Http2StringPiece sp(b->cursor(), b->Remaining()); + quiche::QuicheStringPiece sp(b->cursor(), b->Remaining()); if (decoder_.Decode(sp, &output_buffer_)) { b->AdvanceCursor(b->Remaining()); - // Successfully decoded (or buffered) the bytes in Http2StringPiece. + // Successfully decoded (or buffered) the bytes in QuicheStringPiece. EXPECT_LE(input_bytes_seen_, input_bytes_expected_); // Have we reached the end of the encoded string? if (input_bytes_expected_ == input_bytes_seen_) { @@ -71,8 +71,8 @@ } AssertionResult TranscodeAndValidateSeveralWays( - Http2StringPiece plain, - Http2StringPiece expected_huffman) { + quiche::QuicheStringPiece plain, + quiche::QuicheStringPiece expected_huffman) { std::string encoded; HuffmanEncode(plain, &encoded); if (expected_huffman.size() > 0 || plain.empty()) { @@ -90,7 +90,8 @@ ValidateDoneAndEmpty(validator)); } - AssertionResult TranscodeAndValidateSeveralWays(Http2StringPiece plain) { + AssertionResult TranscodeAndValidateSeveralWays( + quiche::QuicheStringPiece plain) { return TranscodeAndValidateSeveralWays(plain, ""); }
diff --git a/http2/hpack/tools/hpack_block_builder.cc b/http2/hpack/tools/hpack_block_builder.cc index 5b2ab75..3175c1d 100644 --- a/http2/hpack/tools/hpack_block_builder.cc +++ b/http2/hpack/tools/hpack_block_builder.cc
@@ -55,7 +55,7 @@ } void HpackBlockBuilder::AppendString(bool is_huffman_encoded, - Http2StringPiece str) { + quiche::QuicheStringPiece str) { uint8_t high_bits = is_huffman_encoded ? 0x80 : 0; uint8_t prefix_length = 7; AppendHighBitsAndVarint(high_bits, prefix_length, str.size());
diff --git a/http2/hpack/tools/hpack_block_builder.h b/http2/hpack/tools/hpack_block_builder.h index 59c3805..b96d262 100644 --- a/http2/hpack/tools/hpack_block_builder.h +++ b/http2/hpack/tools/hpack_block_builder.h
@@ -22,14 +22,14 @@ #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/hpack/http2_hpack_constants.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" namespace http2 { namespace test { class HpackBlockBuilder { public: - explicit HpackBlockBuilder(Http2StringPiece initial_contents) + explicit HpackBlockBuilder(quiche::QuicheStringPiece initial_contents) : buffer_(initial_contents.data(), initial_contents.size()) {} HpackBlockBuilder() {} ~HpackBlockBuilder() {} @@ -51,7 +51,7 @@ void AppendNameIndexAndLiteralValue(HpackEntryType entry_type, uint64_t name_index, bool value_is_huffman_encoded, - Http2StringPiece value) { + quiche::QuicheStringPiece value) { // name_index==0 would indicate that the entry includes a literal name. // Call AppendLiteralNameAndValue in that case. EXPECT_NE(0u, name_index); @@ -61,9 +61,9 @@ void AppendLiteralNameAndValue(HpackEntryType entry_type, bool name_is_huffman_encoded, - Http2StringPiece name, + quiche::QuicheStringPiece name, bool value_is_huffman_encoded, - Http2StringPiece value) { + quiche::QuicheStringPiece value) { AppendEntryTypeAndVarint(entry_type, 0); AppendString(name_is_huffman_encoded, name); AppendString(value_is_huffman_encoded, value); @@ -84,7 +84,7 @@ // Append a header string (i.e. a header name or value) in HPACK format. // Does NOT perform Huffman encoding. - void AppendString(bool is_huffman_encoded, Http2StringPiece str); + void AppendString(bool is_huffman_encoded, quiche::QuicheStringPiece str); private: std::string buffer_;
diff --git a/http2/hpack/tools/hpack_block_builder_test.cc b/http2/hpack/tools/hpack_block_builder_test.cc index bba363f..21f161e 100644 --- a/http2/hpack/tools/hpack_block_builder_test.cc +++ b/http2/hpack/tools/hpack_block_builder_test.cc
@@ -120,7 +120,8 @@ '\xab', '\x90', '\xf4', '\xff'}; b.AppendNameIndexAndLiteralValue( HpackEntryType::kIndexedLiteralHeader, 1, kCompressed, - Http2StringPiece(kHuffmanWwwExampleCom, sizeof kHuffmanWwwExampleCom)); + quiche::QuicheStringPiece(kHuffmanWwwExampleCom, + sizeof kHuffmanWwwExampleCom)); EXPECT_EQ(17u, b.size()); // Hex dump of encoded data (copied from RFC): @@ -140,7 +141,7 @@ EXPECT_EQ(1u, b.size()); const char kData[] = {'\x20'}; - Http2StringPiece expected(kData, sizeof kData); + quiche::QuicheStringPiece expected(kData, sizeof kData); EXPECT_EQ(expected, b.buffer()); } { @@ -149,7 +150,7 @@ EXPECT_EQ(3u, b.size()); const char kData[] = {'\x3f', '\xe1', '\x1f'}; - Http2StringPiece expected(kData, sizeof kData); + quiche::QuicheStringPiece expected(kData, sizeof kData); EXPECT_EQ(expected, b.buffer()); } { @@ -159,7 +160,7 @@ const char kData[] = {'\x3f', '\xe1', '\x9f', '\x94', '\xa5', '\x8d', '\x1d'}; - Http2StringPiece expected(kData, sizeof kData); + quiche::QuicheStringPiece expected(kData, sizeof kData); EXPECT_EQ(expected, b.buffer()); } }
diff --git a/http2/hpack/tools/hpack_example.cc b/http2/hpack/tools/hpack_example.cc index 52d84f9..5e0e40c 100644 --- a/http2/hpack/tools/hpack_example.cc +++ b/http2/hpack/tools/hpack_example.cc
@@ -14,7 +14,8 @@ namespace test { namespace { -void HpackExampleToStringOrDie(Http2StringPiece example, std::string* output) { +void HpackExampleToStringOrDie(quiche::QuicheStringPiece example, + std::string* output) { while (!example.empty()) { const char c0 = example[0]; if (isxdigit(c0)) { @@ -32,7 +33,7 @@ if (!example.empty() && example[0] == '|') { // Start of a comment. Skip to end of line or of input. auto pos = example.find('\n'); - if (pos == Http2StringPiece::npos) { + if (pos == quiche::QuicheStringPiece::npos) { // End of input. break; } @@ -48,7 +49,7 @@ } // namespace -std::string HpackExampleToStringOrDie(Http2StringPiece example) { +std::string HpackExampleToStringOrDie(quiche::QuicheStringPiece example) { std::string output; HpackExampleToStringOrDie(example, &output); return output;
diff --git a/http2/hpack/tools/hpack_example.h b/http2/hpack/tools/hpack_example.h index 0371e17..e86c116 100644 --- a/http2/hpack/tools/hpack_example.h +++ b/http2/hpack/tools/hpack_example.h
@@ -7,7 +7,7 @@ #include <string> -#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h" // Parses HPACK examples in the format seen in the HPACK specification, // RFC 7541. For example: @@ -24,7 +24,7 @@ namespace http2 { namespace test { -std::string HpackExampleToStringOrDie(Http2StringPiece example); +std::string HpackExampleToStringOrDie(quiche::QuicheStringPiece example); } // namespace test } // namespace http2
diff --git a/http2/hpack/varint/hpack_varint_decoder_test.cc b/http2/hpack/varint/hpack_varint_decoder_test.cc index 07cb51b..336349c 100644 --- a/http2/hpack/varint/hpack_varint_decoder_test.cc +++ b/http2/hpack/varint/hpack_varint_decoder_test.cc
@@ -11,9 +11,9 @@ #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/platform/api/http2_arraysize.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" -#include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.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_string_piece.h" using ::testing::AssertionFailure; using ::testing::AssertionSuccess; @@ -31,7 +31,7 @@ suffix_(Http2HexDecode(::testing::get<1>(GetParam()))), prefix_length_(0) {} - void DecodeExpectSuccess(Http2StringPiece 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(Http2StringPiece 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(Http2StringPiece 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 a5318fb..58fc2c3 100644 --- a/http2/hpack/varint/hpack_varint_round_trip_test.cc +++ b/http2/hpack/varint/hpack_varint_round_trip_test.cc
@@ -16,9 +16,9 @@ #include "testing/gtest/include/gtest/gtest.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_piece.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_string_piece.h" using ::testing::AssertionFailure; using ::testing::AssertionSuccess; @@ -291,7 +291,7 @@ } TEST_F(HpackVarintRoundTripTest, FromSpec1337) { - DecodeBuffer b(Http2StringPiece("\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());