Replace QuicheStringPiece with absl::string_view
PiperOrigin-RevId: 336141637
Change-Id: I00b8a60d5298747936a8503a3cfcc5942680f817
diff --git a/quic/core/qpack/qpack_decoded_headers_accumulator.cc b/quic/core/qpack/qpack_decoded_headers_accumulator.cc
index 6469dd2..1e66346 100644
--- a/quic/core/qpack/qpack_decoded_headers_accumulator.cc
+++ b/quic/core/qpack/qpack_decoded_headers_accumulator.cc
@@ -4,9 +4,9 @@
#include "net/third_party/quiche/src/quic/core/qpack/qpack_decoded_headers_accumulator.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_decoder.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_header_table.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -27,9 +27,8 @@
quic_header_list_.OnHeaderBlockStart();
}
-void QpackDecodedHeadersAccumulator::OnHeaderDecoded(
- quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+void QpackDecodedHeadersAccumulator::OnHeaderDecoded(absl::string_view name,
+ absl::string_view value) {
DCHECK(!error_detected_);
uncompressed_header_bytes_without_overhead_ += name.size() + value.size();
@@ -64,7 +63,7 @@
}
void QpackDecodedHeadersAccumulator::OnDecodingErrorDetected(
- quiche::QuicheStringPiece error_message) {
+ absl::string_view error_message) {
DCHECK(!error_detected_);
DCHECK(!headers_decoded_);
@@ -73,7 +72,7 @@
visitor_->OnHeaderDecodingError(error_message);
}
-void QpackDecodedHeadersAccumulator::Decode(quiche::QuicheStringPiece data) {
+void QpackDecodedHeadersAccumulator::Decode(absl::string_view data) {
DCHECK(!error_detected_);
compressed_header_bytes_ += data.size();
diff --git a/quic/core/qpack/qpack_decoded_headers_accumulator.h b/quic/core/qpack/qpack_decoded_headers_accumulator.h
index 334fcbd..e194a98 100644
--- a/quic/core/qpack/qpack_decoded_headers_accumulator.h
+++ b/quic/core/qpack/qpack_decoded_headers_accumulator.h
@@ -8,11 +8,11 @@
#include <cstddef>
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/http/quic_header_list.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_progressive_decoder.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -45,8 +45,7 @@
bool header_list_size_limit_exceeded) = 0;
// Called when an error has occurred.
- virtual void OnHeaderDecodingError(
- quiche::QuicheStringPiece error_message) = 0;
+ virtual void OnHeaderDecodingError(absl::string_view error_message) = 0;
};
QpackDecodedHeadersAccumulator(QuicStreamId id,
@@ -57,16 +56,15 @@
// QpackProgressiveDecoder::HeadersHandlerInterface implementation.
// These methods should only be called by |decoder_|.
- void OnHeaderDecoded(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) override;
+ void OnHeaderDecoded(absl::string_view name,
+ absl::string_view value) override;
void OnDecodingCompleted() override;
- void OnDecodingErrorDetected(
- quiche::QuicheStringPiece error_message) override;
+ void OnDecodingErrorDetected(absl::string_view error_message) override;
// Decode payload data.
// Must not be called if an error has been detected.
// Must not be called after EndHeaderBlock().
- void Decode(quiche::QuicheStringPiece data);
+ void Decode(absl::string_view data);
// Signal end of HEADERS frame.
// Must not be called if an error has been detected.
diff --git a/quic/core/qpack/qpack_decoded_headers_accumulator_test.cc b/quic/core/qpack/qpack_decoded_headers_accumulator_test.cc
index 93e2561..eeb34eb 100644
--- a/quic/core/qpack/qpack_decoded_headers_accumulator_test.cc
+++ b/quic/core/qpack/qpack_decoded_headers_accumulator_test.cc
@@ -6,11 +6,11 @@
#include <cstring>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_decoder.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quic/test_tools/qpack/qpack_decoder_test_utils.h"
#include "net/third_party/quiche/src/quic/test_tools/qpack/qpack_test_utils.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
using ::testing::_;
@@ -48,7 +48,7 @@
(override));
MOCK_METHOD(void,
OnHeaderDecodingError,
- (quiche::QuicheStringPiece error_message),
+ (absl::string_view error_message),
(override));
};
diff --git a/quic/core/qpack/qpack_decoder.cc b/quic/core/qpack/qpack_decoder.cc
index 17790de..9268c9f 100644
--- a/quic/core/qpack/qpack_decoder.cc
+++ b/quic/core/qpack/qpack_decoder.cc
@@ -6,9 +6,9 @@
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_index_conversions.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -70,7 +70,7 @@
void QpackDecoder::OnInsertWithNameReference(bool is_static,
uint64_t name_index,
- quiche::QuicheStringPiece value) {
+ absl::string_view value) {
if (is_static) {
auto entry = header_table_.LookupEntry(/* is_static = */ true, name_index);
if (!entry) {
@@ -109,9 +109,8 @@
}
}
-void QpackDecoder::OnInsertWithoutNameReference(
- quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+void QpackDecoder::OnInsertWithoutNameReference(absl::string_view name,
+ absl::string_view value) {
const QpackEntry* entry = header_table_.InsertEntry(name, value);
if (!entry) {
encoder_stream_error_delegate_->OnEncoderStreamError(
@@ -149,7 +148,7 @@
}
}
-void QpackDecoder::OnErrorDetected(quiche::QuicheStringPiece error_message) {
+void QpackDecoder::OnErrorDetected(absl::string_view error_message) {
encoder_stream_error_delegate_->OnEncoderStreamError(error_message);
}
diff --git a/quic/core/qpack/qpack_decoder.h b/quic/core/qpack/qpack_decoder.h
index e09b14b..c950e87 100644
--- a/quic/core/qpack/qpack_decoder.h
+++ b/quic/core/qpack/qpack_decoder.h
@@ -9,13 +9,13 @@
#include <memory>
#include <set>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_decoder_stream_sender.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_encoder_stream_receiver.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_header_table.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_progressive_decoder.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -34,8 +34,7 @@
public:
virtual ~EncoderStreamErrorDelegate() {}
- virtual void OnEncoderStreamError(
- quiche::QuicheStringPiece error_message) = 0;
+ virtual void OnEncoderStreamError(absl::string_view error_message) = 0;
};
QpackDecoder(uint64_t maximum_dynamic_table_capacity,
@@ -80,12 +79,12 @@
// QpackEncoderStreamReceiver::Delegate implementation
void OnInsertWithNameReference(bool is_static,
uint64_t name_index,
- quiche::QuicheStringPiece value) override;
- void OnInsertWithoutNameReference(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) override;
+ absl::string_view value) override;
+ void OnInsertWithoutNameReference(absl::string_view name,
+ absl::string_view value) override;
void OnDuplicate(uint64_t index) override;
void OnSetDynamicTableCapacity(uint64_t capacity) override;
- void OnErrorDetected(quiche::QuicheStringPiece error_message) override;
+ void OnErrorDetected(absl::string_view error_message) override;
// delegate must be set if dynamic table capacity is not zero.
void set_qpack_stream_sender_delegate(QpackStreamSenderDelegate* delegate) {
diff --git a/quic/core/qpack/qpack_decoder_stream_receiver.cc b/quic/core/qpack/qpack_decoder_stream_receiver.cc
index 5d6cf83..a0dcb62 100644
--- a/quic/core/qpack/qpack_decoder_stream_receiver.cc
+++ b/quic/core/qpack/qpack_decoder_stream_receiver.cc
@@ -4,10 +4,10 @@
#include "net/third_party/quiche/src/quic/core/qpack/qpack_decoder_stream_receiver.h"
+#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/quic/core/qpack/qpack_instructions.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -18,7 +18,7 @@
DCHECK(delegate_);
}
-void QpackDecoderStreamReceiver::Decode(quiche::QuicheStringPiece data) {
+void QpackDecoderStreamReceiver::Decode(absl::string_view data) {
if (data.empty() || error_detected_) {
return;
}
@@ -43,8 +43,7 @@
return true;
}
-void QpackDecoderStreamReceiver::OnError(
- quiche::QuicheStringPiece error_message) {
+void QpackDecoderStreamReceiver::OnError(absl::string_view error_message) {
DCHECK(!error_detected_);
error_detected_ = true;
diff --git a/quic/core/qpack/qpack_decoder_stream_receiver.h b/quic/core/qpack/qpack_decoder_stream_receiver.h
index 19f51f0..51e0d3c 100644
--- a/quic/core/qpack/qpack_decoder_stream_receiver.h
+++ b/quic/core/qpack/qpack_decoder_stream_receiver.h
@@ -7,11 +7,11 @@
#include <cstdint>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_instruction_decoder.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_stream_receiver.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -34,7 +34,7 @@
// 5.3.3 Stream Cancellation
virtual void OnStreamCancellation(QuicStreamId stream_id) = 0;
// Decoding error
- virtual void OnErrorDetected(quiche::QuicheStringPiece error_message) = 0;
+ virtual void OnErrorDetected(absl::string_view error_message) = 0;
};
explicit QpackDecoderStreamReceiver(Delegate* delegate);
@@ -47,11 +47,11 @@
// Decode data and call appropriate Delegate method after each decoded
// instruction. Once an error occurs, Delegate::OnErrorDetected() is called,
// and all further data is ignored.
- void Decode(quiche::QuicheStringPiece data) override;
+ void Decode(absl::string_view data) override;
// QpackInstructionDecoder::Delegate implementation.
bool OnInstructionDecoded(const QpackInstruction* instruction) override;
- void OnError(quiche::QuicheStringPiece error_message) override;
+ void OnError(absl::string_view error_message) override;
private:
QpackInstructionDecoder instruction_decoder_;
diff --git a/quic/core/qpack/qpack_decoder_stream_receiver_test.cc b/quic/core/qpack/qpack_decoder_stream_receiver_test.cc
index 70d2450..f800e33 100644
--- a/quic/core/qpack/qpack_decoder_stream_receiver_test.cc
+++ b/quic/core/qpack/qpack_decoder_stream_receiver_test.cc
@@ -4,8 +4,8 @@
#include "net/third_party/quiche/src/quic/core/qpack/qpack_decoder_stream_receiver.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_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_text_utils.h"
using testing::Eq;
@@ -27,7 +27,7 @@
MOCK_METHOD(void, OnStreamCancellation, (QuicStreamId stream_id), (override));
MOCK_METHOD(void,
OnErrorDetected,
- (quiche::QuicheStringPiece error_message),
+ (absl::string_view error_message),
(override));
};
diff --git a/quic/core/qpack/qpack_decoder_stream_sender.cc b/quic/core/qpack/qpack_decoder_stream_sender.cc
index 34f4de8..bfb19e1 100644
--- a/quic/core/qpack/qpack_decoder_stream_sender.cc
+++ b/quic/core/qpack/qpack_decoder_stream_sender.cc
@@ -8,9 +8,9 @@
#include <limits>
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_instructions.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
diff --git a/quic/core/qpack/qpack_decoder_test.cc b/quic/core/qpack/qpack_decoder_test.cc
index 8b546b0..17c134f 100644
--- a/quic/core/qpack/qpack_decoder_test.cc
+++ b/quic/core/qpack/qpack_decoder_test.cc
@@ -6,11 +6,11 @@
#include <algorithm>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quic/test_tools/qpack/qpack_decoder_test_utils.h"
#include "net/third_party/quiche/src/quic/test_tools/qpack/qpack_test_utils.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
#include "net/third_party/quiche/src/spdy/core/spdy_header_block.h"
@@ -49,13 +49,12 @@
// Destroy QpackProgressiveDecoder on error to test that it does not crash.
// See https://crbug.com/1025209.
ON_CALL(handler_, OnDecodingErrorDetected(_))
- .WillByDefault(
- Invoke([this](quiche::QuicheStringPiece /* error_message */) {
- progressive_decoder_.reset();
- }));
+ .WillByDefault(Invoke([this](absl::string_view /* error_message */) {
+ progressive_decoder_.reset();
+ }));
}
- void DecodeEncoderStreamData(quiche::QuicheStringPiece data) {
+ void DecodeEncoderStreamData(absl::string_view data) {
qpack_decoder_.encoder_stream_receiver()->Decode(data);
}
@@ -71,7 +70,7 @@
// Pass header block data to QpackProgressiveDecoder::Decode()
// in fragments dictated by |fragment_mode_|.
- void DecodeData(quiche::QuicheStringPiece data) {
+ void DecodeData(absl::string_view data) {
auto fragment_size_generator =
FragmentModeToFragmentSizeGenerator(fragment_mode_);
while (progressive_decoder_ && !data.empty()) {
@@ -91,7 +90,7 @@
}
// Decode an entire header block.
- void DecodeHeaderBlock(quiche::QuicheStringPiece data) {
+ void DecodeHeaderBlock(absl::string_view data) {
StartDecoding();
DecodeData(data);
EndDecoding();
@@ -170,8 +169,7 @@
TEST_P(QpackDecoderTest, MultipleLiteralEntries) {
EXPECT_CALL(handler_, OnHeaderDecoded(Eq("foo"), Eq("bar")));
std::string str(127, 'a');
- EXPECT_CALL(handler_,
- OnHeaderDecoded(Eq("foobaar"), quiche::QuicheStringPiece(str)));
+ EXPECT_CALL(handler_, OnHeaderDecoded(Eq("foobaar"), absl::string_view(str)));
EXPECT_CALL(handler_, OnDecodingCompleted());
DecodeHeaderBlock(quiche::QuicheTextUtils::HexDecode(
@@ -254,7 +252,7 @@
}
TEST_P(QpackDecoderTest, HuffmanNameDoesNotHaveEOSPrefix) {
- EXPECT_CALL(handler_, OnDecodingErrorDetected(quiche::QuicheStringPiece(
+ EXPECT_CALL(handler_, OnDecodingErrorDetected(absl::string_view(
"Error in Huffman-encoded string.")));
// 'y' ends in 0b0 on the most significant bit of the last byte.
@@ -264,7 +262,7 @@
}
TEST_P(QpackDecoderTest, HuffmanValueDoesNotHaveEOSPrefix) {
- EXPECT_CALL(handler_, OnDecodingErrorDetected(quiche::QuicheStringPiece(
+ EXPECT_CALL(handler_, OnDecodingErrorDetected(absl::string_view(
"Error in Huffman-encoded string.")));
// 'e' ends in 0b101, taking up the 3 most significant bits of the last byte.
@@ -274,7 +272,7 @@
}
TEST_P(QpackDecoderTest, HuffmanNameEOSPrefixTooLong) {
- EXPECT_CALL(handler_, OnDecodingErrorDetected(quiche::QuicheStringPiece(
+ EXPECT_CALL(handler_, OnDecodingErrorDetected(absl::string_view(
"Error in Huffman-encoded string.")));
// The trailing EOS prefix must be at most 7 bits long. Appending one octet
@@ -285,7 +283,7 @@
}
TEST_P(QpackDecoderTest, HuffmanValueEOSPrefixTooLong) {
- EXPECT_CALL(handler_, OnDecodingErrorDetected(quiche::QuicheStringPiece(
+ EXPECT_CALL(handler_, OnDecodingErrorDetected(absl::string_view(
"Error in Huffman-encoded string.")));
// The trailing EOS prefix must be at most 7 bits long. Appending one octet
diff --git a/quic/core/qpack/qpack_encoder.cc b/quic/core/qpack/qpack_encoder.cc
index 67adf12..30df1df 100644
--- a/quic/core/qpack/qpack_encoder.cc
+++ b/quic/core/qpack/qpack_encoder.cc
@@ -7,13 +7,13 @@
#include <algorithm>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_index_conversions.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_instruction_encoder.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_required_insert_count.h"
#include "net/third_party/quiche/src/quic/core/qpack/value_splitting_header_list.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.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 quic {
@@ -58,7 +58,7 @@
QpackEncoder::EncodeLiteralHeaderFieldWithNameReference(
bool is_static,
uint64_t index,
- quiche::QuicheStringPiece value,
+ absl::string_view value,
QpackBlockingManager::IndexSet* referred_indices) {
// Add |index| to |*referred_indices| only if entry is in the dynamic table.
if (!is_static) {
@@ -70,8 +70,8 @@
// static
QpackInstructionWithValues QpackEncoder::EncodeLiteralHeaderField(
- quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+ absl::string_view name,
+ absl::string_view value) {
return QpackInstructionWithValues::LiteralHeaderField(name, value);
}
@@ -110,8 +110,8 @@
for (const auto& header : ValueSplittingHeaderList(&header_list)) {
// These strings are owned by |header_list|.
- quiche::QuicheStringPiece name = header.first;
- quiche::QuicheStringPiece value = header.second;
+ absl::string_view name = header.first;
+ absl::string_view value = header.second;
bool is_static;
uint64_t index;
@@ -435,7 +435,7 @@
blocking_manager_.OnStreamCancellation(stream_id);
}
-void QpackEncoder::OnErrorDetected(quiche::QuicheStringPiece error_message) {
+void QpackEncoder::OnErrorDetected(absl::string_view error_message) {
decoder_stream_error_delegate_->OnDecoderStreamError(error_message);
}
diff --git a/quic/core/qpack/qpack_encoder.h b/quic/core/qpack/qpack_encoder.h
index 202fc6d..1f0e258 100644
--- a/quic/core/qpack/qpack_encoder.h
+++ b/quic/core/qpack/qpack_encoder.h
@@ -10,6 +10,7 @@
#include <string>
#include <vector>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_blocking_manager.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_decoder_stream_receiver.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_encoder_stream_sender.h"
@@ -18,7 +19,6 @@
#include "net/third_party/quiche/src/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_exported_stats.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace spdy {
@@ -45,8 +45,7 @@
public:
virtual ~DecoderStreamErrorDelegate() {}
- virtual void OnDecoderStreamError(
- quiche::QuicheStringPiece error_message) = 0;
+ virtual void OnDecoderStreamError(absl::string_view error_message) = 0;
};
QpackEncoder(DecoderStreamErrorDelegate* decoder_stream_error_delegate);
@@ -83,7 +82,7 @@
void OnInsertCountIncrement(uint64_t increment) override;
void OnHeaderAcknowledgement(QuicStreamId stream_id) override;
void OnStreamCancellation(QuicStreamId stream_id) override;
- void OnErrorDetected(quiche::QuicheStringPiece error_message) override;
+ void OnErrorDetected(absl::string_view error_message) override;
// delegate must be set if dynamic table capacity is not zero.
void set_qpack_stream_sender_delegate(QpackStreamSenderDelegate* delegate) {
@@ -122,13 +121,13 @@
static QpackInstructionWithValues EncodeLiteralHeaderFieldWithNameReference(
bool is_static,
uint64_t index,
- quiche::QuicheStringPiece value,
+ absl::string_view value,
QpackBlockingManager::IndexSet* referred_indices);
// Generate literal header field instruction.
static QpackInstructionWithValues EncodeLiteralHeaderField(
- quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value);
+ absl::string_view name,
+ absl::string_view value);
// Performs first pass of two-pass encoding: represent each header field in
// |*header_list| as a reference to an existing entry, the name of an existing
@@ -140,7 +139,7 @@
// encoder stream to insert dynamic table entries. Returns list of header
// field representations, with all dynamic table entries referred to with
// absolute indices. Returned Instructions object may have
- // quiche::QuicheStringPieces pointing to strings owned by |*header_list|.
+ // absl::string_views pointing to strings owned by |*header_list|.
Instructions FirstPassEncode(QuicStreamId stream_id,
const spdy::SpdyHeaderBlock& header_list,
QpackBlockingManager::IndexSet* referred_indices,
diff --git a/quic/core/qpack/qpack_encoder_stream_receiver.cc b/quic/core/qpack/qpack_encoder_stream_receiver.cc
index 56ee232..dedccc0 100644
--- a/quic/core/qpack/qpack_encoder_stream_receiver.cc
+++ b/quic/core/qpack/qpack_encoder_stream_receiver.cc
@@ -4,10 +4,10 @@
#include "net/third_party/quiche/src/quic/core/qpack/qpack_encoder_stream_receiver.h"
+#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/quic/core/qpack/qpack_instructions.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -18,7 +18,7 @@
DCHECK(delegate_);
}
-void QpackEncoderStreamReceiver::Decode(quiche::QuicheStringPiece data) {
+void QpackEncoderStreamReceiver::Decode(absl::string_view data) {
if (data.empty() || error_detected_) {
return;
}
@@ -51,8 +51,7 @@
return true;
}
-void QpackEncoderStreamReceiver::OnError(
- quiche::QuicheStringPiece error_message) {
+void QpackEncoderStreamReceiver::OnError(absl::string_view error_message) {
DCHECK(!error_detected_);
error_detected_ = true;
diff --git a/quic/core/qpack/qpack_encoder_stream_receiver.h b/quic/core/qpack/qpack_encoder_stream_receiver.h
index 80622e5..5618b08 100644
--- a/quic/core/qpack/qpack_encoder_stream_receiver.h
+++ b/quic/core/qpack/qpack_encoder_stream_receiver.h
@@ -8,10 +8,10 @@
#include <cstdint>
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_instruction_decoder.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_stream_receiver.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -29,17 +29,16 @@
// 5.2.1. Insert With Name Reference
virtual void OnInsertWithNameReference(bool is_static,
uint64_t name_index,
- quiche::QuicheStringPiece value) = 0;
+ absl::string_view value) = 0;
// 5.2.2. Insert Without Name Reference
- virtual void OnInsertWithoutNameReference(
- quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) = 0;
+ virtual void OnInsertWithoutNameReference(absl::string_view name,
+ absl::string_view value) = 0;
// 5.2.3. Duplicate
virtual void OnDuplicate(uint64_t index) = 0;
// 5.2.4. Set Dynamic Table Capacity
virtual void OnSetDynamicTableCapacity(uint64_t capacity) = 0;
// Decoding error
- virtual void OnErrorDetected(quiche::QuicheStringPiece error_message) = 0;
+ virtual void OnErrorDetected(absl::string_view error_message) = 0;
};
explicit QpackEncoderStreamReceiver(Delegate* delegate);
@@ -53,11 +52,11 @@
// Decode data and call appropriate Delegate method after each decoded
// instruction. Once an error occurs, Delegate::OnErrorDetected() is called,
// and all further data is ignored.
- void Decode(quiche::QuicheStringPiece data) override;
+ void Decode(absl::string_view data) override;
// QpackInstructionDecoder::Delegate implementation.
bool OnInstructionDecoded(const QpackInstruction* instruction) override;
- void OnError(quiche::QuicheStringPiece error_message) override;
+ void OnError(absl::string_view error_message) override;
private:
QpackInstructionDecoder instruction_decoder_;
diff --git a/quic/core/qpack/qpack_encoder_stream_receiver_test.cc b/quic/core/qpack/qpack_encoder_stream_receiver_test.cc
index 71b6d34..cb8e143 100644
--- a/quic/core/qpack/qpack_encoder_stream_receiver_test.cc
+++ b/quic/core/qpack/qpack_encoder_stream_receiver_test.cc
@@ -4,8 +4,8 @@
#include "net/third_party/quiche/src/quic/core/qpack/qpack_encoder_stream_receiver.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_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_text_utils.h"
using testing::Eq;
@@ -21,19 +21,17 @@
MOCK_METHOD(void,
OnInsertWithNameReference,
- (bool is_static,
- uint64_t name_index,
- quiche::QuicheStringPiece value),
+ (bool is_static, uint64_t name_index, absl::string_view value),
(override));
MOCK_METHOD(void,
OnInsertWithoutNameReference,
- (quiche::QuicheStringPiece name, quiche::QuicheStringPiece value),
+ (absl::string_view name, absl::string_view value),
(override));
MOCK_METHOD(void, OnDuplicate, (uint64_t index), (override));
MOCK_METHOD(void, OnSetDynamicTableCapacity, (uint64_t capacity), (override));
MOCK_METHOD(void,
OnErrorDetected,
- (quiche::QuicheStringPiece error_message),
+ (absl::string_view error_message),
(override));
};
@@ -42,7 +40,7 @@
QpackEncoderStreamReceiverTest() : stream_(&delegate_) {}
~QpackEncoderStreamReceiverTest() override = default;
- void Decode(quiche::QuicheStringPiece data) { stream_.Decode(data); }
+ void Decode(absl::string_view data) { stream_.Decode(data); }
StrictMock<MockDelegate>* delegate() { return &delegate_; }
private:
diff --git a/quic/core/qpack/qpack_encoder_stream_sender.cc b/quic/core/qpack/qpack_encoder_stream_sender.cc
index 0ae1aae..88214ab 100644
--- a/quic/core/qpack/qpack_encoder_stream_sender.cc
+++ b/quic/core/qpack/qpack_encoder_stream_sender.cc
@@ -8,9 +8,9 @@
#include <limits>
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_instructions.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -19,7 +19,7 @@
void QpackEncoderStreamSender::SendInsertWithNameReference(
bool is_static,
uint64_t name_index,
- quiche::QuicheStringPiece value) {
+ absl::string_view value) {
instruction_encoder_.Encode(
QpackInstructionWithValues::InsertWithNameReference(is_static, name_index,
value),
@@ -27,8 +27,8 @@
}
void QpackEncoderStreamSender::SendInsertWithoutNameReference(
- quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+ absl::string_view name,
+ absl::string_view value) {
instruction_encoder_.Encode(
QpackInstructionWithValues::InsertWithoutNameReference(name, value),
&buffer_);
diff --git a/quic/core/qpack/qpack_encoder_stream_sender.h b/quic/core/qpack/qpack_encoder_stream_sender.h
index dee23c5..dbef027 100644
--- a/quic/core/qpack/qpack_encoder_stream_sender.h
+++ b/quic/core/qpack/qpack_encoder_stream_sender.h
@@ -7,11 +7,11 @@
#include <cstdint>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_instruction_encoder.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_stream_sender_delegate.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -29,10 +29,10 @@
// 5.2.1. Insert With Name Reference
void SendInsertWithNameReference(bool is_static,
uint64_t name_index,
- quiche::QuicheStringPiece value);
+ absl::string_view value);
// 5.2.2. Insert Without Name Reference
- void SendInsertWithoutNameReference(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value);
+ void SendInsertWithoutNameReference(absl::string_view name,
+ absl::string_view value);
// 5.2.3. Duplicate
void SendDuplicate(uint64_t index);
// 5.2.4. Set Dynamic Table Capacity
diff --git a/quic/core/qpack/qpack_encoder_test.cc b/quic/core/qpack/qpack_encoder_test.cc
index e0d21c5..5cfa112 100644
--- a/quic/core/qpack/qpack_encoder_test.cc
+++ b/quic/core/qpack/qpack_encoder_test.cc
@@ -7,13 +7,13 @@
#include <limits>
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quic/test_tools/qpack/qpack_encoder_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/qpack/qpack_encoder_test_utils.h"
#include "net/third_party/quiche/src/quic/test_tools/qpack/qpack_header_table_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/qpack/qpack_test_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"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
using ::testing::_;
@@ -151,7 +151,7 @@
TEST_F(QpackEncoderTest, SplitAlongNullCharacter) {
spdy::SpdyHeaderBlock header_list;
- header_list["foo"] = quiche::QuicheStringPiece("bar\0bar\0baz", 11);
+ header_list["foo"] = absl::string_view("bar\0bar\0baz", 11);
std::string output = Encode(header_list);
EXPECT_EQ(quiche::QuicheTextUtils::HexDecode("0000" // prefix
diff --git a/quic/core/qpack/qpack_header_table.cc b/quic/core/qpack/qpack_header_table.cc
index 29e7148..1440ca5 100644
--- a/quic/core/qpack/qpack_header_table.cc
+++ b/quic/core/qpack/qpack_header_table.cc
@@ -4,9 +4,9 @@
#include "net/third_party/quiche/src/quic/core/qpack/qpack_header_table.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_static_table.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -51,8 +51,8 @@
}
QpackHeaderTable::MatchType QpackHeaderTable::FindHeaderField(
- quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value,
+ absl::string_view name,
+ absl::string_view value,
bool* is_static,
uint64_t* index) const {
QpackEntry query(name, value);
@@ -96,9 +96,8 @@
return MatchType::kNoMatch;
}
-const QpackEntry* QpackHeaderTable::InsertEntry(
- quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+const QpackEntry* QpackHeaderTable::InsertEntry(absl::string_view name,
+ absl::string_view value) {
const uint64_t entry_size = QpackEntry::Size(name, value);
if (entry_size > dynamic_table_capacity_) {
return nullptr;
diff --git a/quic/core/qpack/qpack_header_table.h b/quic/core/qpack/qpack_header_table.h
index bed1cc8..c9aa767 100644
--- a/quic/core/qpack/qpack_header_table.h
+++ b/quic/core/qpack/qpack_header_table.h
@@ -10,8 +10,8 @@
#include <queue>
#include <vector>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_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/core/hpack/hpack_header_table.h"
@@ -70,16 +70,16 @@
// Returns the absolute index of an entry with matching name and value if such
// exists, otherwise one with matching name is such exists. |index| is zero
// based for both the static and the dynamic table.
- MatchType FindHeaderField(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value,
+ MatchType FindHeaderField(absl::string_view name,
+ absl::string_view value,
bool* is_static,
uint64_t* index) const;
// Insert (name, value) into the dynamic table. May evict entries. Returns a
// pointer to the inserted owned entry on success. Returns nullptr if entry
// is larger than the capacity of the dynamic table.
- const QpackEntry* InsertEntry(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value);
+ const QpackEntry* InsertEntry(absl::string_view name,
+ absl::string_view value);
// Returns the size of the largest entry that could be inserted into the
// dynamic table without evicting entry |index|. |index| might be larger than
diff --git a/quic/core/qpack/qpack_header_table_test.cc b/quic/core/qpack/qpack_header_table_test.cc
index a96159b..c096855 100644
--- a/quic/core/qpack/qpack_header_table_test.cc
+++ b/quic/core/qpack/qpack_header_table_test.cc
@@ -6,10 +6,10 @@
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_static_table.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_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/spdy/core/hpack/hpack_entry.h"
using ::testing::Mock;
@@ -40,8 +40,8 @@
void ExpectEntryAtIndex(bool is_static,
uint64_t index,
- quiche::QuicheStringPiece expected_name,
- quiche::QuicheStringPiece expected_value) const {
+ absl::string_view expected_name,
+ absl::string_view expected_value) const {
const auto* entry = table_.LookupEntry(is_static, index);
ASSERT_TRUE(entry);
EXPECT_EQ(expected_name, entry->name());
@@ -52,8 +52,8 @@
EXPECT_FALSE(table_.LookupEntry(is_static, index));
}
- void ExpectMatch(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value,
+ void ExpectMatch(absl::string_view name,
+ absl::string_view value,
QpackHeaderTable::MatchType expected_match_type,
bool expected_is_static,
uint64_t expected_index) const {
@@ -70,8 +70,7 @@
EXPECT_EQ(expected_index, index) << name << ": " << value;
}
- void ExpectNoMatch(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) const {
+ void ExpectNoMatch(absl::string_view name, absl::string_view value) const {
bool is_static = false;
uint64_t index = 0;
@@ -82,13 +81,12 @@
<< name << ": " << value;
}
- void InsertEntry(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+ void InsertEntry(absl::string_view name, absl::string_view value) {
EXPECT_TRUE(table_.InsertEntry(name, value));
}
- void ExpectToFailInsertingEntry(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+ void ExpectToFailInsertingEntry(absl::string_view name,
+ absl::string_view value) {
EXPECT_FALSE(table_.InsertEntry(name, value));
}
diff --git a/quic/core/qpack/qpack_instruction_decoder.cc b/quic/core/qpack/qpack_instruction_decoder.cc
index 1f85d7f..47b939d 100644
--- a/quic/core/qpack/qpack_instruction_decoder.cc
+++ b/quic/core/qpack/qpack_instruction_decoder.cc
@@ -7,9 +7,9 @@
#include <algorithm>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -33,7 +33,7 @@
error_detected_(false),
state_(State::kStartInstruction) {}
-bool QpackInstructionDecoder::Decode(quiche::QuicheStringPiece data) {
+bool QpackInstructionDecoder::Decode(absl::string_view data) {
DCHECK(!data.empty());
DCHECK(!error_detected_);
@@ -77,8 +77,8 @@
DCHECK_LE(bytes_consumed, data.size());
- data = quiche::QuicheStringPiece(data.data() + bytes_consumed,
- data.size() - bytes_consumed);
+ data = absl::string_view(data.data() + bytes_consumed,
+ data.size() - bytes_consumed);
// Stop processing if no more data but next state would require it.
if (data.empty() && (state_ != State::kStartField) &&
@@ -94,8 +94,7 @@
return state_ == State::kStartInstruction;
}
-bool QpackInstructionDecoder::DoStartInstruction(
- quiche::QuicheStringPiece data) {
+bool QpackInstructionDecoder::DoStartInstruction(absl::string_view data) {
DCHECK(!data.empty());
instruction_ = LookupOpcode(data[0]);
@@ -133,7 +132,7 @@
}
}
-bool QpackInstructionDecoder::DoReadBit(quiche::QuicheStringPiece data) {
+bool QpackInstructionDecoder::DoReadBit(absl::string_view data) {
DCHECK(!data.empty());
switch (field_->type) {
@@ -163,7 +162,7 @@
}
}
-bool QpackInstructionDecoder::DoVarintStart(quiche::QuicheStringPiece data,
+bool QpackInstructionDecoder::DoVarintStart(absl::string_view data,
size_t* bytes_consumed) {
DCHECK(!data.empty());
DCHECK(field_->type == QpackInstructionFieldType::kVarint ||
@@ -192,7 +191,7 @@
}
}
-bool QpackInstructionDecoder::DoVarintResume(quiche::QuicheStringPiece data,
+bool QpackInstructionDecoder::DoVarintResume(absl::string_view data,
size_t* bytes_consumed) {
DCHECK(!data.empty());
DCHECK(field_->type == QpackInstructionFieldType::kVarint ||
@@ -265,7 +264,7 @@
return true;
}
-bool QpackInstructionDecoder::DoReadString(quiche::QuicheStringPiece data,
+bool QpackInstructionDecoder::DoReadString(absl::string_view data,
size_t* bytes_consumed) {
DCHECK(!data.empty());
DCHECK(field_->type == QpackInstructionFieldType::kName ||
@@ -323,7 +322,7 @@
return nullptr;
}
-void QpackInstructionDecoder::OnError(quiche::QuicheStringPiece error_message) {
+void QpackInstructionDecoder::OnError(absl::string_view error_message) {
DCHECK(!error_detected_);
error_detected_ = true;
diff --git a/quic/core/qpack/qpack_instruction_decoder.h b/quic/core/qpack/qpack_instruction_decoder.h
index 08eb665..c6df1f3 100644
--- a/quic/core/qpack/qpack_instruction_decoder.h
+++ b/quic/core/qpack/qpack_instruction_decoder.h
@@ -9,11 +9,11 @@
#include <cstdint>
#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/http2/hpack/varint/hpack_varint_decoder.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_instructions.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -42,7 +42,7 @@
// No more data is processed afterwards.
// Implementations are allowed to destroy the QpackInstructionDecoder
// instance synchronously.
- virtual void OnError(quiche::QuicheStringPiece error_message) = 0;
+ virtual void OnError(absl::string_view error_message) = 0;
};
// Both |*language| and |*delegate| must outlive this object.
@@ -54,7 +54,7 @@
// Provide a data fragment to decode. Must not be called after an error has
// occurred. Must not be called with empty |data|. Return true on success,
// false on error (in which case Delegate::OnError() is called synchronously).
- bool Decode(quiche::QuicheStringPiece data);
+ bool Decode(absl::string_view data);
// Returns true if no decoding has taken place yet or if the last instruction
// has been entirely parsed.
@@ -94,13 +94,13 @@
// data and set |*bytes_consumed| to the number of octets processed. Some
// take input data but do not consume any bytes. Some do not take any
// arguments because they only change internal state.
- bool DoStartInstruction(quiche::QuicheStringPiece data);
+ bool DoStartInstruction(absl::string_view data);
bool DoStartField();
- bool DoReadBit(quiche::QuicheStringPiece data);
- bool DoVarintStart(quiche::QuicheStringPiece data, size_t* bytes_consumed);
- bool DoVarintResume(quiche::QuicheStringPiece data, size_t* bytes_consumed);
+ bool DoReadBit(absl::string_view data);
+ bool DoVarintStart(absl::string_view data, size_t* bytes_consumed);
+ bool DoVarintResume(absl::string_view data, size_t* bytes_consumed);
bool DoVarintDone();
- bool DoReadString(quiche::QuicheStringPiece data, size_t* bytes_consumed);
+ bool DoReadString(absl::string_view data, size_t* bytes_consumed);
bool DoReadStringDone();
// Identify instruction based on opcode encoded in |byte|.
@@ -108,7 +108,7 @@
const QpackInstruction* LookupOpcode(uint8_t byte) const;
// Stops decoding and calls Delegate::OnError().
- void OnError(quiche::QuicheStringPiece error_message);
+ void OnError(absl::string_view error_message);
// Describes the language used for decoding.
const QpackLanguage* const language_;
diff --git a/quic/core/qpack/qpack_instruction_decoder_test.cc b/quic/core/qpack/qpack_instruction_decoder_test.cc
index a4bbc91..2674f92 100644
--- a/quic/core/qpack/qpack_instruction_decoder_test.cc
+++ b/quic/core/qpack/qpack_instruction_decoder_test.cc
@@ -6,11 +6,11 @@
#include <algorithm>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_instructions.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quic/test_tools/qpack/qpack_test_utils.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
using ::testing::_;
@@ -65,10 +65,7 @@
OnInstructionDecoded,
(const QpackInstruction*),
(override));
- MOCK_METHOD(void,
- OnError,
- (quiche::QuicheStringPiece error_message),
- (override));
+ MOCK_METHOD(void, OnError, (absl::string_view error_message), (override));
};
class QpackInstructionDecoderTest : public QuicTestWithParam<FragmentMode> {
@@ -83,10 +80,9 @@
// Destroy QpackInstructionDecoder on error to test that it does not crash.
// See https://crbug.com/1025209.
ON_CALL(delegate_, OnError(_))
- .WillByDefault(
- Invoke([this](quiche::QuicheStringPiece /* error_message */) {
- decoder_.reset();
- }));
+ .WillByDefault(Invoke([this](absl::string_view /* error_message */) {
+ decoder_.reset();
+ }));
}
// Decode one full instruction with fragment sizes dictated by
@@ -95,7 +91,7 @@
// verifies that AtInstructionBoundary() returns true before and after the
// instruction, and returns false while decoding is in progress.
// Assumes that delegate methods destroy |decoder_| if they return false.
- void DecodeInstruction(quiche::QuicheStringPiece data) {
+ void DecodeInstruction(absl::string_view data) {
EXPECT_TRUE(decoder_->AtInstructionBoundary());
FragmentSizeGenerator fragment_size_generator =
diff --git a/quic/core/qpack/qpack_instruction_encoder.cc b/quic/core/qpack/qpack_instruction_encoder.cc
index 055edd7..a845ab5 100644
--- a/quic/core/qpack/qpack_instruction_encoder.cc
+++ b/quic/core/qpack/qpack_instruction_encoder.cc
@@ -6,12 +6,12 @@
#include <limits>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/http2/hpack/huffman/hpack_huffman_encoder.h"
#include "net/third_party/quiche/src/http2/hpack/varint/hpack_varint_encoder.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_string_utils.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -140,8 +140,8 @@
state_ = State::kWriteString;
}
-void QpackInstructionEncoder::DoStartString(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+void QpackInstructionEncoder::DoStartString(absl::string_view name,
+ absl::string_view value) {
DCHECK(field_->type == QpackInstructionFieldType::kName ||
field_->type == QpackInstructionFieldType::kValue);
diff --git a/quic/core/qpack/qpack_instruction_encoder.h b/quic/core/qpack/qpack_instruction_encoder.h
index e3ae6c7..4f6fac7 100644
--- a/quic/core/qpack/qpack_instruction_encoder.h
+++ b/quic/core/qpack/qpack_instruction_encoder.h
@@ -8,9 +8,9 @@
#include <cstdint>
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_instructions.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -53,10 +53,9 @@
void DoStartField();
void DoSBit(bool s_bit);
void DoVarintEncode(uint64_t varint, uint64_t varint2, std::string* output);
- void DoStartString(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value);
- void DoWriteString(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value,
+ void DoStartString(absl::string_view name, absl::string_view value);
+ void DoWriteString(absl::string_view name,
+ absl::string_view value,
std::string* output);
// True if name or value should be Huffman encoded.
diff --git a/quic/core/qpack/qpack_instruction_encoder_test.cc b/quic/core/qpack/qpack_instruction_encoder_test.cc
index 6f3337c..66a6c42 100644
--- a/quic/core/qpack/qpack_instruction_encoder_test.cc
+++ b/quic/core/qpack/qpack_instruction_encoder_test.cc
@@ -4,9 +4,9 @@
#include "net/third_party/quiche/src/quic/core/qpack/qpack_instruction_encoder.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_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_text_utils.h"
namespace quic {
@@ -37,12 +37,12 @@
}
static void set_name(QpackInstructionWithValues* instruction_with_values,
- quiche::QuicheStringPiece name) {
+ absl::string_view name) {
instruction_with_values->name_ = name;
}
static void set_value(QpackInstructionWithValues* instruction_with_values,
- quiche::QuicheStringPiece value) {
+ absl::string_view value) {
instruction_with_values->value_ = value;
}
};
@@ -62,10 +62,9 @@
// Compare substring appended to |output_| since last EncodedSegmentMatches()
// call against hex-encoded argument.
- bool EncodedSegmentMatches(
- quiche::QuicheStringPiece hex_encoded_expected_substring) {
+ bool EncodedSegmentMatches(absl::string_view hex_encoded_expected_substring) {
auto recently_encoded =
- quiche::QuicheStringPiece(output_).substr(verified_position_);
+ absl::string_view(output_).substr(verified_position_);
auto expected =
quiche::QuicheTextUtils::HexDecode(hex_encoded_expected_substring);
verified_position_ = output_.size();
diff --git a/quic/core/qpack/qpack_instructions.cc b/quic/core/qpack/qpack_instructions.cc
index 1e5d112..12db363 100644
--- a/quic/core/qpack/qpack_instructions.cc
+++ b/quic/core/qpack/qpack_instructions.cc
@@ -6,8 +6,8 @@
#include <limits>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -204,7 +204,7 @@
QpackInstructionWithValues QpackInstructionWithValues::InsertWithNameReference(
bool is_static,
uint64_t name_index,
- quiche::QuicheStringPiece value) {
+ absl::string_view value) {
QpackInstructionWithValues instruction_with_values;
instruction_with_values.instruction_ = InsertWithNameReferenceInstruction();
instruction_with_values.s_bit_ = is_static;
@@ -217,8 +217,8 @@
// static
QpackInstructionWithValues
QpackInstructionWithValues::InsertWithoutNameReference(
- quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+ absl::string_view name,
+ absl::string_view value) {
QpackInstructionWithValues instruction_with_values;
instruction_with_values.instruction_ =
InsertWithoutNameReferenceInstruction();
@@ -307,7 +307,7 @@
QpackInstructionWithValues::LiteralHeaderFieldNameReference(
bool is_static,
uint64_t index,
- quiche::QuicheStringPiece value) {
+ absl::string_view value) {
QpackInstructionWithValues instruction_with_values;
instruction_with_values.instruction_ =
QpackLiteralHeaderFieldNameReferenceInstruction();
@@ -320,8 +320,8 @@
// static
QpackInstructionWithValues QpackInstructionWithValues::LiteralHeaderField(
- quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+ absl::string_view name,
+ absl::string_view value) {
QpackInstructionWithValues instruction_with_values;
instruction_with_values.instruction_ = QpackLiteralHeaderFieldInstruction();
instruction_with_values.name_ = name;
diff --git a/quic/core/qpack/qpack_instructions.h b/quic/core/qpack/qpack_instructions.h
index d63a1e2..006c9a7 100644
--- a/quic/core/qpack/qpack_instructions.h
+++ b/quic/core/qpack/qpack_instructions.h
@@ -10,8 +10,8 @@
#include <tuple>
#include <vector>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -151,10 +151,10 @@
static QpackInstructionWithValues InsertWithNameReference(
bool is_static,
uint64_t name_index,
- quiche::QuicheStringPiece value);
+ absl::string_view value);
static QpackInstructionWithValues InsertWithoutNameReference(
- quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value);
+ absl::string_view name,
+ absl::string_view value);
static QpackInstructionWithValues Duplicate(uint64_t index);
static QpackInstructionWithValues SetDynamicTableCapacity(uint64_t capacity);
@@ -172,17 +172,16 @@
static QpackInstructionWithValues LiteralHeaderFieldNameReference(
bool is_static,
uint64_t index,
- quiche::QuicheStringPiece value);
- static QpackInstructionWithValues LiteralHeaderField(
- quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value);
+ absl::string_view value);
+ static QpackInstructionWithValues LiteralHeaderField(absl::string_view name,
+ absl::string_view value);
const QpackInstruction* instruction() const { return instruction_; }
bool s_bit() const { return s_bit_; }
uint64_t varint() const { return varint_; }
uint64_t varint2() const { return varint2_; }
- quiche::QuicheStringPiece name() const { return name_; }
- quiche::QuicheStringPiece value() const { return value_; }
+ absl::string_view name() const { return name_; }
+ absl::string_view value() const { return value_; }
// Used by QpackEncoder, because in the first pass it stores absolute indices,
// which are converted into relative indices in the second pass after base is
@@ -199,8 +198,8 @@
bool s_bit_;
uint64_t varint_;
uint64_t varint2_;
- quiche::QuicheStringPiece name_;
- quiche::QuicheStringPiece value_;
+ absl::string_view name_;
+ absl::string_view value_;
};
} // namespace quic
diff --git a/quic/core/qpack/qpack_offline_decoder_bin.cc b/quic/core/qpack/qpack_offline_decoder_bin.cc
index c1c002f..851efe7 100644
--- a/quic/core/qpack/qpack_offline_decoder_bin.cc
+++ b/quic/core/qpack/qpack_offline_decoder_bin.cc
@@ -5,10 +5,10 @@
#include <cstddef>
#include <iostream>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/quic/test_tools/qpack/qpack_offline_decoder.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
int main(int argc, char* argv[]) {
const char* usage =
@@ -25,8 +25,8 @@
size_t i;
size_t success_count = 0;
for (i = 0; 2 * i < args.size(); ++i) {
- const quiche::QuicheStringPiece input_filename(args[2 * i]);
- const quiche::QuicheStringPiece expected_headers_filename(args[2 * i + 1]);
+ const absl::string_view input_filename(args[2 * i]);
+ const absl::string_view expected_headers_filename(args[2 * i + 1]);
// Every file represents a different connection,
// therefore every file needs a fresh decoding context.
diff --git a/quic/core/qpack/qpack_progressive_decoder.cc b/quic/core/qpack/qpack_progressive_decoder.cc
index cf20bde..d681eb6 100644
--- a/quic/core/qpack/qpack_progressive_decoder.cc
+++ b/quic/core/qpack/qpack_progressive_decoder.cc
@@ -8,11 +8,11 @@
#include <limits>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_index_conversions.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_instructions.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_required_insert_count.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -46,7 +46,7 @@
}
}
-void QpackProgressiveDecoder::Decode(quiche::QuicheStringPiece data) {
+void QpackProgressiveDecoder::Decode(absl::string_view data) {
DCHECK(decoding_);
if (data.empty() || error_detected_) {
@@ -114,7 +114,7 @@
return DoLiteralHeaderFieldInstruction();
}
-void QpackProgressiveDecoder::OnError(quiche::QuicheStringPiece error_message) {
+void QpackProgressiveDecoder::OnError(absl::string_view error_message) {
DCHECK(!error_detected_);
error_detected_ = true;
diff --git a/quic/core/qpack/qpack_progressive_decoder.h b/quic/core/qpack/qpack_progressive_decoder.h
index f9c0224..723aa7f 100644
--- a/quic/core/qpack/qpack_progressive_decoder.h
+++ b/quic/core/qpack/qpack_progressive_decoder.h
@@ -9,12 +9,12 @@
#include <memory>
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_encoder_stream_receiver.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_header_table.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_instruction_decoder.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -32,8 +32,8 @@
// Called when a new header name-value pair is decoded. Multiple values for
// a given name will be emitted as multiple calls to OnHeader.
- virtual void OnHeaderDecoded(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) = 0;
+ virtual void OnHeaderDecoded(absl::string_view name,
+ absl::string_view value) = 0;
// Called when the header block is completely decoded.
// Indicates the total number of bytes in this block.
@@ -46,8 +46,7 @@
// Called when a decoding error has occurred. No other methods will be
// called afterwards. Implementations are allowed to destroy
// the QpackProgressiveDecoder instance synchronously.
- virtual void OnDecodingErrorDetected(
- quiche::QuicheStringPiece error_message) = 0;
+ virtual void OnDecodingErrorDetected(absl::string_view error_message) = 0;
};
// Interface for keeping track of blocked streams for the purpose of enforcing
@@ -90,7 +89,7 @@
~QpackProgressiveDecoder() override;
// Provide a data fragment to decode.
- void Decode(quiche::QuicheStringPiece data);
+ void Decode(absl::string_view data);
// Signal that the entire header block has been received and passed in
// through Decode(). No methods must be called afterwards.
@@ -98,7 +97,7 @@
// QpackInstructionDecoder::Delegate implementation.
bool OnInstructionDecoded(const QpackInstruction* instruction) override;
- void OnError(quiche::QuicheStringPiece error_message) override;
+ void OnError(absl::string_view error_message) override;
// QpackHeaderTable::Observer implementation.
void OnInsertCountReachedThreshold() override;
diff --git a/quic/core/qpack/qpack_receive_stream.cc b/quic/core/qpack/qpack_receive_stream.cc
index b2f15c4..c7291f7 100644
--- a/quic/core/qpack/qpack_receive_stream.cc
+++ b/quic/core/qpack/qpack_receive_stream.cc
@@ -4,8 +4,8 @@
#include "net/third_party/quiche/src/quic/core/qpack/qpack_receive_stream.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_session.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
QpackReceiveStream::QpackReceiveStream(PendingStream* pending,
@@ -25,7 +25,7 @@
while (!reading_stopped() && sequencer()->GetReadableRegion(&iov)) {
DCHECK(!sequencer()->IsClosed());
- receiver_->Decode(quiche::QuicheStringPiece(
+ receiver_->Decode(absl::string_view(
reinterpret_cast<const char*>(iov.iov_base), iov.iov_len));
sequencer()->MarkConsumed(iov.iov_len);
}
diff --git a/quic/core/qpack/qpack_receive_stream_test.cc b/quic/core/qpack/qpack_receive_stream_test.cc
index 8a8064e..88cb589 100644
--- a/quic/core/qpack/qpack_receive_stream_test.cc
+++ b/quic/core/qpack/qpack_receive_stream_test.cc
@@ -4,11 +4,11 @@
#include "net/third_party/quiche/src/quic/core/qpack/qpack_receive_stream.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_utils.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_spdy_session_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
namespace test {
@@ -64,7 +64,7 @@
: GetNthServerInitiatedUnidirectionalStreamId(
session_.transport_version(), 3);
char type[] = {0x03};
- QuicStreamFrame data1(id, false, 0, quiche::QuicheStringPiece(type, 1));
+ QuicStreamFrame data1(id, false, 0, absl::string_view(type, 1));
session_.OnStreamFrame(data1);
qpack_receive_stream_ =
QuicSpdySessionPeer::GetQpackDecoderReceiveStream(&session_);
diff --git a/quic/core/qpack/qpack_round_trip_test.cc b/quic/core/qpack/qpack_round_trip_test.cc
index 8625baa..0cf21fc 100644
--- a/quic/core/qpack/qpack_round_trip_test.cc
+++ b/quic/core/qpack/qpack_round_trip_test.cc
@@ -5,11 +5,11 @@
#include <string>
#include <tuple>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quic/test_tools/qpack/qpack_decoder_test_utils.h"
#include "net/third_party/quiche/src/quic/test_tools/qpack/qpack_encoder_test_utils.h"
#include "net/third_party/quiche/src/quic/test_tools/qpack/qpack_test_utils.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/spdy_header_block.h"
using ::testing::Values;
@@ -126,7 +126,7 @@
TEST_P(QpackRoundTripTest, ValueHasNullCharacter) {
spdy::SpdyHeaderBlock header_list;
- header_list["foo"] = quiche::QuicheStringPiece("bar\0bar\0baz", 11);
+ header_list["foo"] = absl::string_view("bar\0bar\0baz", 11);
spdy::SpdyHeaderBlock output = EncodeThenDecode(header_list);
EXPECT_EQ(header_list, output);
diff --git a/quic/core/qpack/qpack_send_stream.cc b/quic/core/qpack/qpack_send_stream.cc
index 176c431..e70fbe5 100644
--- a/quic/core/qpack/qpack_send_stream.cc
+++ b/quic/core/qpack/qpack_send_stream.cc
@@ -4,9 +4,9 @@
#include "net/third_party/quiche/src/quic/core/qpack/qpack_send_stream.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_session.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"
namespace quic {
QpackSendStream::QpackSendStream(QuicStreamId id,
@@ -27,7 +27,7 @@
return false;
}
-void QpackSendStream::WriteStreamData(quiche::QuicheStringPiece data) {
+void QpackSendStream::WriteStreamData(absl::string_view data) {
QuicConnection::ScopedPacketFlusher flusher(session()->connection());
MaybeSendStreamType();
WriteOrBufferData(data, false, nullptr);
@@ -38,8 +38,8 @@
char type[sizeof(http3_stream_type_)];
QuicDataWriter writer(QUICHE_ARRAYSIZE(type), type);
writer.WriteVarInt62(http3_stream_type_);
- WriteOrBufferData(quiche::QuicheStringPiece(writer.data(), writer.length()),
- false, nullptr);
+ WriteOrBufferData(absl::string_view(writer.data(), writer.length()), false,
+ nullptr);
stream_type_sent_ = true;
}
}
diff --git a/quic/core/qpack/qpack_send_stream.h b/quic/core/qpack/qpack_send_stream.h
index e8a4ea7..d7f68ee 100644
--- a/quic/core/qpack/qpack_send_stream.h
+++ b/quic/core/qpack/qpack_send_stream.h
@@ -7,10 +7,10 @@
#include <cstdint>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/qpack/qpack_stream_sender_delegate.h"
#include "net/third_party/quiche/src/quic/core/quic_stream.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -41,7 +41,7 @@
// Writes the instructions to peer. The stream type will be sent
// before the first instruction so that the peer can open an qpack stream.
- void WriteStreamData(quiche::QuicheStringPiece data) override;
+ void WriteStreamData(absl::string_view data) override;
// TODO(b/112770235): Remove this method once QuicStreamIdManager supports
// creating HTTP/3 unidirectional streams dynamically.
diff --git a/quic/core/qpack/qpack_send_stream_test.cc b/quic/core/qpack/qpack_send_stream_test.cc
index 2ac3289..f99b168 100644
--- a/quic/core/qpack/qpack_send_stream_test.cc
+++ b/quic/core/qpack/qpack_send_stream_test.cc
@@ -4,6 +4,7 @@
#include "net/third_party/quiche/src/quic/core/qpack/qpack_send_stream.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/http/http_constants.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_config_peer.h"
@@ -11,7 +12,6 @@
#include "net/third_party/quiche/src/quic/test_tools/quic_spdy_session_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
namespace test {
@@ -104,10 +104,10 @@
std::string data = "data";
EXPECT_CALL(session_, WritevData(_, 1, _, _, _, _));
EXPECT_CALL(session_, WritevData(_, data.length(), _, _, _, _));
- qpack_send_stream_->WriteStreamData(quiche::QuicheStringPiece(data));
+ qpack_send_stream_->WriteStreamData(absl::string_view(data));
EXPECT_CALL(session_, WritevData(_, data.length(), _, _, _, _));
- qpack_send_stream_->WriteStreamData(quiche::QuicheStringPiece(data));
+ qpack_send_stream_->WriteStreamData(absl::string_view(data));
EXPECT_CALL(session_, WritevData(_, _, _, _, _, _)).Times(0);
qpack_send_stream_->MaybeSendStreamType();
}
diff --git a/quic/core/qpack/qpack_static_table_test.cc b/quic/core/qpack/qpack_static_table_test.cc
index 1376d2c..ce5bc99 100644
--- a/quic/core/qpack/qpack_static_table_test.cc
+++ b/quic/core/qpack/qpack_static_table_test.cc
@@ -6,9 +6,9 @@
#include <set>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_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"
namespace quic {
@@ -32,7 +32,7 @@
EXPECT_EQ(QpackStaticTableVector().size(), static_index.size());
auto static_name_index = table.GetStaticNameIndex();
- std::set<quiche::QuicheStringPiece> names;
+ std::set<absl::string_view> names;
for (auto entry : static_index) {
names.insert(entry->name());
}
diff --git a/quic/core/qpack/qpack_stream_receiver.h b/quic/core/qpack/qpack_stream_receiver.h
index 01c2d5f..d7c4b55 100644
--- a/quic/core/qpack/qpack_stream_receiver.h
+++ b/quic/core/qpack/qpack_stream_receiver.h
@@ -5,8 +5,8 @@
#ifndef QUICHE_QUIC_CORE_QPACK_QPACK_STREAM_RECEIVER_H_
#define QUICHE_QUIC_CORE_QPACK_QPACK_STREAM_RECEIVER_H_
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -16,7 +16,7 @@
virtual ~QpackStreamReceiver() = default;
// Decode data.
- virtual void Decode(quiche::QuicheStringPiece data) = 0;
+ virtual void Decode(absl::string_view data) = 0;
};
} // namespace quic
diff --git a/quic/core/qpack/qpack_stream_sender_delegate.h b/quic/core/qpack/qpack_stream_sender_delegate.h
index 524b756..9f3faf8 100644
--- a/quic/core/qpack/qpack_stream_sender_delegate.h
+++ b/quic/core/qpack/qpack_stream_sender_delegate.h
@@ -5,8 +5,8 @@
#ifndef QUICHE_QUIC_CORE_QPACK_QPACK_STREAM_SENDER_DELEGATE_H_
#define QUICHE_QUIC_CORE_QPACK_QPACK_STREAM_SENDER_DELEGATE_H_
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -16,7 +16,7 @@
virtual ~QpackStreamSenderDelegate() = default;
// Write data on the unidirectional stream.
- virtual void WriteStreamData(quiche::QuicheStringPiece data) = 0;
+ virtual void WriteStreamData(absl::string_view data) = 0;
};
} // namespace quic
diff --git a/quic/core/qpack/value_splitting_header_list.cc b/quic/core/qpack/value_splitting_header_list.cc
index 65d1b99..3bbae10 100644
--- a/quic/core/qpack/value_splitting_header_list.cc
+++ b/quic/core/qpack/value_splitting_header_list.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "net/third_party/quiche/src/quic/core/qpack/value_splitting_header_list.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "absl/strings/string_view.h"
namespace quic {
namespace {
@@ -37,7 +37,7 @@
const ValueSplittingHeaderList::const_iterator&
ValueSplittingHeaderList::const_iterator::operator++() {
- if (value_end_ == quiche::QuicheStringPiece::npos) {
+ if (value_end_ == absl::string_view::npos) {
// This was the last frament within |*header_list_iterator_|,
// move on to the next header element of |header_list_|.
++header_list_iterator_;
@@ -61,15 +61,14 @@
}
void ValueSplittingHeaderList::const_iterator::UpdateHeaderField() {
- DCHECK(value_start_ != quiche::QuicheStringPiece::npos);
+ DCHECK(value_start_ != absl::string_view::npos);
if (header_list_iterator_ == header_list_->end()) {
return;
}
- const quiche::QuicheStringPiece name = header_list_iterator_->first;
- const quiche::QuicheStringPiece original_value =
- header_list_iterator_->second;
+ const absl::string_view name = header_list_iterator_->first;
+ const absl::string_view original_value = header_list_iterator_->second;
if (name == kCookieKey) {
value_end_ = original_value.find(kCookieSeparator, value_start_);
@@ -77,12 +76,12 @@
value_end_ = original_value.find(kNonCookieSeparator, value_start_);
}
- const quiche::QuicheStringPiece value =
+ const absl::string_view value =
original_value.substr(value_start_, value_end_ - value_start_);
header_field_ = std::make_pair(name, value);
// Skip character after ';' separator if it is a space.
- if (name == kCookieKey && value_end_ != quiche::QuicheStringPiece::npos &&
+ if (name == kCookieKey && value_end_ != absl::string_view::npos &&
value_end_ + 1 < original_value.size() &&
original_value[value_end_ + 1] == kOptionalSpaceAfterCookieSeparator) {
++value_end_;
diff --git a/quic/core/qpack/value_splitting_header_list.h b/quic/core/qpack/value_splitting_header_list.h
index 446548a..3220997 100644
--- a/quic/core/qpack/value_splitting_header_list.h
+++ b/quic/core/qpack/value_splitting_header_list.h
@@ -5,8 +5,8 @@
#ifndef QUICHE_QUIC_CORE_QPACK_VALUE_SPLITTING_HEADER_LIST_H_
#define QUICHE_QUIC_CORE_QPACK_VALUE_SPLITTING_HEADER_LIST_H_
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/spdy_header_block.h"
namespace quic {
@@ -40,8 +40,8 @@
const spdy::SpdyHeaderBlock* const header_list_;
spdy::SpdyHeaderBlock::const_iterator header_list_iterator_;
- quiche::QuicheStringPiece::size_type value_start_;
- quiche::QuicheStringPiece::size_type value_end_;
+ absl::string_view::size_type value_start_;
+ absl::string_view::size_type value_end_;
value_type header_field_;
};
diff --git a/quic/core/qpack/value_splitting_header_list_test.cc b/quic/core/qpack/value_splitting_header_list_test.cc
index c1da85c..ac754e1 100644
--- a/quic/core/qpack/value_splitting_header_list_test.cc
+++ b/quic/core/qpack/value_splitting_header_list_test.cc
@@ -4,9 +4,9 @@
#include "net/third_party/quiche/src/quic/core/qpack/value_splitting_header_list.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_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"
namespace quic {
namespace test {
@@ -17,7 +17,7 @@
TEST(ValueSplittingHeaderListTest, Comparison) {
spdy::SpdyHeaderBlock block;
- block["foo"] = quiche::QuicheStringPiece("bar\0baz", 7);
+ block["foo"] = absl::string_view("bar\0baz", 7);
block["baz"] = "qux";
block["cookie"] = "foo; bar";
@@ -85,7 +85,7 @@
TEST(ValueSplittingHeaderListTest, Split) {
struct {
const char* name;
- quiche::QuicheStringPiece value;
+ absl::string_view value;
std::vector<const char*> expected_values;
} kTestData[]{
// Empty value.
@@ -131,9 +131,9 @@
TEST(ValueSplittingHeaderListTest, MultipleFields) {
spdy::SpdyHeaderBlock block;
- block["foo"] = quiche::QuicheStringPiece("bar\0baz\0", 8);
+ block["foo"] = absl::string_view("bar\0baz\0", 8);
block["cookie"] = "foo; bar";
- block["bar"] = quiche::QuicheStringPiece("qux\0foo", 7);
+ block["bar"] = absl::string_view("qux\0foo", 7);
ValueSplittingHeaderList headers(&block);
EXPECT_THAT(headers, ElementsAre(Pair("foo", "bar"), Pair("foo", "baz"),