Replace QuicheStringPiece with absl::string_view
PiperOrigin-RevId: 336003023
Change-Id: I317fcb072dad195e937af96e12b175e11ab44170
diff --git a/quic/core/chlo_extractor.cc b/quic/core/chlo_extractor.cc
index 1605b26..53c3246 100644
--- a/quic/core/chlo_extractor.cc
+++ b/quic/core/chlo_extractor.cc
@@ -4,6 +4,7 @@
#include "net/third_party/quiche/src/quic/core/chlo_extractor.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_framer.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_handshake.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_handshake_message.h"
@@ -14,7 +15,6 @@
#include "net/third_party/quiche/src/quic/core/frames/quic_ack_frequency_frame.h"
#include "net/third_party/quiche/src/quic/core/quic_framer.h"
#include "net/third_party/quiche/src/quic/core/quic_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"
namespace quic {
@@ -39,10 +39,9 @@
const QuicVersionNegotiationPacket& /*packet*/) override {}
void OnRetryPacket(QuicConnectionId /*original_connection_id*/,
QuicConnectionId /*new_connection_id*/,
- quiche::QuicheStringPiece /*retry_token*/,
- quiche::QuicheStringPiece /*retry_integrity_tag*/,
- quiche::QuicheStringPiece /*retry_without_tag*/) override {
- }
+ absl::string_view /*retry_token*/,
+ absl::string_view /*retry_integrity_tag*/,
+ absl::string_view /*retry_without_tag*/) override {}
bool OnUnauthenticatedPublicHeader(const QuicPacketHeader& header) override;
bool OnUnauthenticatedHeader(const QuicPacketHeader& header) override;
void OnDecryptedPacket(EncryptionLevel /*level*/) override {}
@@ -89,7 +88,7 @@
void OnHandshakeMessage(const CryptoHandshakeMessage& message) override;
// Shared implementation between OnStreamFrame and OnCryptoFrame.
- bool OnHandshakeData(quiche::QuicheStringPiece data);
+ bool OnHandshakeData(absl::string_view data);
bool found_chlo() { return found_chlo_; }
bool chlo_contains_tags() { return chlo_contains_tags_; }
@@ -153,7 +152,7 @@
// CHLO will be sent in CRYPTO frames in v47 and above.
return false;
}
- quiche::QuicheStringPiece data(frame.data_buffer, frame.data_length);
+ absl::string_view data(frame.data_buffer, frame.data_length);
if (QuicUtils::IsCryptoStreamId(framer_->transport_version(),
frame.stream_id) &&
frame.offset == 0 && quiche::QuicheTextUtils::StartsWith(data, "CHLO")) {
@@ -167,14 +166,14 @@
// CHLO will be in stream frames before v47.
return false;
}
- quiche::QuicheStringPiece data(frame.data_buffer, frame.data_length);
+ absl::string_view data(frame.data_buffer, frame.data_length);
if (frame.offset == 0 && quiche::QuicheTextUtils::StartsWith(data, "CHLO")) {
return OnHandshakeData(data);
}
return true;
}
-bool ChloFramerVisitor::OnHandshakeData(quiche::QuicheStringPiece data) {
+bool ChloFramerVisitor::OnHandshakeData(absl::string_view data) {
CryptoFramer crypto_framer;
crypto_framer.set_visitor(this);
if (!crypto_framer.ProcessInput(data)) {
diff --git a/quic/core/chlo_extractor_test.cc b/quic/core/chlo_extractor_test.cc
index 1b6a616..3c968be 100644
--- a/quic/core/chlo_extractor_test.cc
+++ b/quic/core/chlo_extractor_test.cc
@@ -8,6 +8,7 @@
#include <string>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_framer.h"
#include "net/third_party/quiche/src/quic/core/quic_utils.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
@@ -15,7 +16,6 @@
#include "net/third_party/quiche/src/quic/test_tools/first_flight.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
namespace test {
@@ -33,7 +33,7 @@
version_ = version;
connection_id_ = connection_id;
chlo_ = chlo.DebugString();
- quiche::QuicheStringPiece alpn_value;
+ absl::string_view alpn_value;
if (chlo.GetStringPiece(kALPN, &alpn_value)) {
alpn_ = std::string(alpn_value);
}
@@ -55,7 +55,7 @@
public:
ChloExtractorTest() : version_(GetParam()) {}
- void MakePacket(quiche::QuicheStringPiece data,
+ void MakePacket(absl::string_view data,
bool munge_offset,
bool munge_stream_id) {
QuicPacketHeader header;
diff --git a/quic/core/quic_bandwidth.cc b/quic/core/quic_bandwidth.cc
index ad2c032..144a176 100644
--- a/quic/core/quic_bandwidth.cc
+++ b/quic/core/quic_bandwidth.cc
@@ -7,8 +7,8 @@
#include <cinttypes>
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
diff --git a/quic/core/quic_config.cc b/quic/core/quic_config.cc
index 0d1cd27..5ea6b24 100644
--- a/quic/core/quic_config.cc
+++ b/quic/core/quic_config.cc
@@ -10,6 +10,7 @@
#include <string>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_handshake_message.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_protocol.h"
#include "net/third_party/quiche/src/quic/core/quic_connection_id.h"
@@ -23,7 +24,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_macros.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_uint128.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -411,7 +411,7 @@
const CryptoHandshakeMessage& peer_hello,
HelloType /*hello_type*/,
std::string* error_details) {
- quiche::QuicheStringPiece address;
+ absl::string_view address;
if (!peer_hello.GetStringPiece(tag_, &address)) {
if (presence_ == PRESENCE_REQUIRED) {
*error_details = "Missing " + QuicTagToString(tag_);
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index a2f32b6..00bfa6b 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -15,6 +15,7 @@
#include <string>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_protocol.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_utils.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_decrypter.h"
@@ -41,7 +42,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_string_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
namespace quic {
@@ -887,12 +887,11 @@
}
// Handles retry for client connection.
-void QuicConnection::OnRetryPacket(
- QuicConnectionId original_connection_id,
- QuicConnectionId new_connection_id,
- quiche::QuicheStringPiece retry_token,
- quiche::QuicheStringPiece retry_integrity_tag,
- quiche::QuicheStringPiece retry_without_tag) {
+void QuicConnection::OnRetryPacket(QuicConnectionId original_connection_id,
+ QuicConnectionId new_connection_id,
+ absl::string_view retry_token,
+ absl::string_view retry_integrity_tag,
+ absl::string_view retry_without_tag) {
DCHECK_EQ(Perspective::IS_CLIENT, perspective_);
if (version().HasRetryIntegrityTag()) {
if (!CryptoUtils::ValidateRetryIntegrityTag(
@@ -1691,7 +1690,7 @@
}
MaybeUpdateAckTimeout();
visitor_->OnMessageReceived(
- quiche::QuicheStringPiece(frame.data, frame.message_length));
+ absl::string_view(frame.data, frame.message_length));
return connected_;
}
@@ -2197,8 +2196,8 @@
}
QUIC_DVLOG(2) << ENDPOINT << "Received encrypted " << packet.length()
<< " bytes:" << std::endl
- << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
- packet.data(), packet.length()));
+ << quiche::QuicheTextUtils::HexDump(
+ absl::string_view(packet.data(), packet.length()));
QUIC_BUG_IF(current_packet_data_ != nullptr)
<< "ProcessUdpPacket must not be called while processing a packet.";
if (debug_visitor_ != nullptr) {
@@ -2718,7 +2717,7 @@
QUIC_DVLOG(2) << ENDPOINT << packet->encryption_level << " packet number "
<< packet_number << " of length " << encrypted_length << ": "
<< std::endl
- << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
+ << quiche::QuicheTextUtils::HexDump(absl::string_view(
packet->encrypted_buffer, encrypted_length));
// Measure the RTT from before the write begins to avoid underestimating the
@@ -2817,8 +2816,8 @@
QuicPacketLength encapsulated_length =
QuicLegacyVersionEncapsulator::Encapsulate(
legacy_version_encapsulation_sni_,
- quiche::QuicheStringPiece(packet->encrypted_buffer,
- packet->encrypted_length),
+ absl::string_view(packet->encrypted_buffer,
+ packet->encrypted_length),
server_connection_id_, framer_.creation_time(),
GetLimitedMaxPacketSize(long_term_mtu_),
const_cast<char*>(packet->encrypted_buffer));
@@ -2831,7 +2830,7 @@
<< "Successfully performed Legacy Version Encapsulation on "
<< packet->encryption_level << " packet number " << packet_number
<< " of length " << encrypted_length << ": " << std::endl
- << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
+ << quiche::QuicheTextUtils::HexDump(absl::string_view(
packet->encrypted_buffer, encrypted_length));
} else {
QUIC_BUG << ENDPOINT
@@ -4134,9 +4133,9 @@
QUIC_DVLOG(2) << ENDPOINT
<< "Sending path probe packet for server connection ID "
<< server_connection_id_ << std::endl
- << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
- probing_packet->encrypted_buffer,
- probing_packet->encrypted_length));
+ << quiche::QuicheTextUtils::HexDump(
+ absl::string_view(probing_packet->encrypted_buffer,
+ probing_packet->encrypted_length));
WriteResult result = probing_writer->WritePacket(
probing_packet->encrypted_buffer, probing_packet->encrypted_length,
self_address().host(), peer_address, per_packet_options_);
@@ -4268,11 +4267,11 @@
return uber_received_packet_manager_.IsAckFrameUpdated();
}
-quiche::QuicheStringPiece QuicConnection::GetCurrentPacket() {
+absl::string_view QuicConnection::GetCurrentPacket() {
if (current_packet_data_ == nullptr) {
- return quiche::QuicheStringPiece();
+ return absl::string_view();
}
- return quiche::QuicheStringPiece(current_packet_data_, last_size_);
+ return absl::string_view(current_packet_data_, last_size_);
}
bool QuicConnection::MaybeConsiderAsMemoryCorruption(
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index 06488e5..3c37fa7 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -11,6 +11,7 @@
#include <string>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/congestion_control/loss_detection_interface.h"
#include "net/third_party/quiche/src/quic/core/congestion_control/send_algorithm_interface.h"
#include "net/third_party/quiche/src/quic/core/crypto/null_decrypter.h"
@@ -42,7 +43,6 @@
#include "net/third_party/quiche/src/quic/test_tools/simple_session_notifier.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.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"
using testing::_;
using testing::AnyNumber;
@@ -116,9 +116,7 @@
~StrictTaggingDecrypter() override {}
// TaggingQuicDecrypter
- uint8_t GetTag(quiche::QuicheStringPiece /*ciphertext*/) override {
- return tag_;
- }
+ uint8_t GetTag(absl::string_view /*ciphertext*/) override { return tag_; }
// Use a distinct value starting with 0xFFFFFF, which is never used by TLS.
uint32_t cipher_id() const override { return 0xFFFFFFF1; }
@@ -252,7 +250,7 @@
}
QuicConsumedData SendStreamDataWithString(QuicStreamId id,
- quiche::QuicheStringPiece data,
+ absl::string_view data,
QuicStreamOffset offset,
StreamSendingState state) {
ScopedPacketFlusher flusher(this);
@@ -273,7 +271,7 @@
QuicConsumedData SendApplicationDataAtLevel(EncryptionLevel encryption_level,
QuicStreamId id,
- quiche::QuicheStringPiece data,
+ absl::string_view data,
QuicStreamOffset offset,
StreamSendingState state) {
ScopedPacketFlusher flusher(this);
@@ -310,7 +308,7 @@
// tests for some cases for this stream.
QuicConsumedData SendCryptoStreamData() {
QuicStreamOffset offset = 0;
- quiche::QuicheStringPiece data("chlo");
+ absl::string_view data("chlo");
if (!QuicVersionUsesCryptoFrames(transport_version())) {
return SendCryptoDataWithString(data, offset);
}
@@ -326,12 +324,12 @@
return QuicConsumedData(bytes_written, /*fin_consumed*/ false);
}
- QuicConsumedData SendCryptoDataWithString(quiche::QuicheStringPiece data,
+ QuicConsumedData SendCryptoDataWithString(absl::string_view data,
QuicStreamOffset offset) {
return SendCryptoDataWithString(data, offset, ENCRYPTION_INITIAL);
}
- QuicConsumedData SendCryptoDataWithString(quiche::QuicheStringPiece data,
+ QuicConsumedData SendCryptoDataWithString(absl::string_view data,
QuicStreamOffset offset,
EncryptionLevel encryption_level) {
if (!QuicVersionUsesCryptoFrames(transport_version())) {
@@ -604,9 +602,9 @@
version()),
creator_(QuicConnectionPeer::GetPacketCreator(&connection_)),
manager_(QuicConnectionPeer::GetSentPacketManager(&connection_)),
- frame1_(0, false, 0, quiche::QuicheStringPiece(data1)),
- frame2_(0, false, 3, quiche::QuicheStringPiece(data2)),
- crypto_frame_(ENCRYPTION_INITIAL, 0, quiche::QuicheStringPiece(data1)),
+ frame1_(0, false, 0, absl::string_view(data1)),
+ frame2_(0, false, 3, absl::string_view(data2)),
+ crypto_frame_(ENCRYPTION_INITIAL, 0, absl::string_view(data1)),
packet_number_length_(PACKET_4BYTE_PACKET_NUMBER),
connection_id_included_(CONNECTION_ID_PRESENT),
notifier_(&connection_),
@@ -750,7 +748,7 @@
}
return QuicFrame(QuicStreamFrame(
QuicUtils::GetCryptoStreamId(connection_.transport_version()), false,
- 0u, quiche::QuicheStringPiece()));
+ 0u, absl::string_view()));
}
void ProcessFramePacket(QuicFrame frame) {
@@ -1006,7 +1004,7 @@
}
QuicByteCount SendStreamDataToPeer(QuicStreamId id,
- quiche::QuicheStringPiece data,
+ absl::string_view data,
QuicStreamOffset offset,
StreamSendingState state,
QuicPacketNumber* last_packet) {
@@ -1043,7 +1041,7 @@
void SendPing() { notifier_.WriteOrBufferPing(); }
- MessageStatus SendMessage(quiche::QuicheStringPiece message) {
+ MessageStatus SendMessage(absl::string_view message) {
connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
QuicMemSliceStorage storage(nullptr, 0, nullptr, 0);
return connection_.SendMessage(
@@ -3123,7 +3121,7 @@
QuicStreamFrame* frame = writer_->stream_frames()[0].get();
EXPECT_EQ(stream_id, frame->stream_id);
EXPECT_EQ("ABCDEF",
- quiche::QuicheStringPiece(frame->data_buffer, frame->data_length));
+ absl::string_view(frame->data_buffer, frame->data_length));
}
TEST_P(QuicConnectionTest, FramePackingSendvQueued) {
@@ -8254,7 +8252,7 @@
connection_.SetFromConfig(config);
}
std::string message(connection_.GetCurrentLargestMessagePayload() * 2, 'a');
- quiche::QuicheStringPiece message_data(message);
+ absl::string_view message_data(message);
QuicMemSliceStorage storage(nullptr, 0, nullptr, 0);
{
QuicConnection::ScopedPacketFlusher flusher(&connection_);
@@ -8267,7 +8265,7 @@
connection_.SendMessage(
1,
MakeSpan(connection_.helper()->GetStreamSendBufferAllocator(),
- quiche::QuicheStringPiece(
+ absl::string_view(
message_data.data(),
connection_.GetCurrentLargestMessagePayload()),
&storage),
@@ -8288,7 +8286,7 @@
connection_.SendMessage(
3,
MakeSpan(connection_.helper()->GetStreamSendBufferAllocator(),
- quiche::QuicheStringPiece(
+ absl::string_view(
message_data.data(),
connection_.GetCurrentLargestMessagePayload() + 1),
&storage),
@@ -10305,7 +10303,7 @@
frames.push_back(QuicFrame(QuicStreamFrame(
QuicUtils::GetFirstBidirectionalStreamId(
connection_.version().transport_version, Perspective::IS_CLIENT),
- false, 0u, quiche::QuicheStringPiece())));
+ false, 0u, absl::string_view())));
QuicAckFrame ack_frame = InitAckFrame(1);
frames.push_back(QuicFrame(&ack_frame));
// Receiving stream frame causes something to send.
@@ -11044,7 +11042,7 @@
frames.push_back(QuicFrame(&ack_frame));
frames.push_back(QuicFrame(QuicStreamFrame(
GetNthClientInitiatedStreamId(0, connection_.transport_version()), true,
- 0u, quiche::QuicheStringPiece())));
+ 0u, absl::string_view())));
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _));
EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
@@ -11767,7 +11765,7 @@
frames1.push_back(QuicFrame(&crypto_frame_));
QuicFrames frames2;
QuicCryptoFrame crypto_frame(ENCRYPTION_HANDSHAKE, 0,
- quiche::QuicheStringPiece(data1));
+ absl::string_view(data1));
frames2.push_back(QuicFrame(&crypto_frame));
ProcessCoalescedPacket(
{{2, frames1, ENCRYPTION_INITIAL}, {3, frames2, ENCRYPTION_HANDSHAKE}});
@@ -11798,7 +11796,7 @@
QuicFrames frames2;
QuicCryptoFrame crypto_frame(ENCRYPTION_HANDSHAKE, 0,
- quiche::QuicheStringPiece(data1));
+ absl::string_view(data1));
frames2.push_back(QuicFrame(&crypto_frame));
EXPECT_CALL(debug_visitor, OnZeroRttPacketAcked()).Times(0);
EXPECT_CALL(visitor_, OnCryptoFrame(_)).Times(1);
diff --git a/quic/core/quic_crypto_client_handshaker_test.cc b/quic/core/quic_crypto_client_handshaker_test.cc
index 3ea08a5..cfae506 100644
--- a/quic/core/quic_crypto_client_handshaker_test.cc
+++ b/quic/core/quic_crypto_client_handshaker_test.cc
@@ -6,10 +6,10 @@
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/proto/crypto_server_config_proto.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
namespace {
@@ -34,7 +34,7 @@
const uint16_t /*port*/,
const std::string& /*server_config*/,
QuicTransportVersion /*transport_version*/,
- quiche::QuicheStringPiece /*chlo_hash*/,
+ absl::string_view /*chlo_hash*/,
const std::vector<std::string>& /*certs*/,
const std::string& /*cert_sct*/,
const std::string& /*signature*/,
@@ -74,7 +74,7 @@
const std::string& hostname,
const std::string& /*server_config*/,
QuicTransportVersion /*transport_version*/,
- quiche::QuicheStringPiece /*chlo_hash*/,
+ absl::string_view /*chlo_hash*/,
std::unique_ptr<Callback> callback) override {
QuicReferenceCountedPointer<ProofSource::Chain> chain =
GetCertChain(server_address, client_address, hostname);
@@ -99,7 +99,7 @@
const QuicSocketAddress& /*client_address*/,
const std::string& /*hostname*/,
uint16_t /*signature_algorit*/,
- quiche::QuicheStringPiece /*in*/,
+ absl::string_view /*in*/,
std::unique_ptr<SignatureCallback> callback) override {
callback->Run(true, "Dummy signature", /*details=*/nullptr);
}
diff --git a/quic/core/quic_crypto_server_stream.cc b/quic/core/quic_crypto_server_stream.cc
index 5fc6839..e8f99eb 100644
--- a/quic/core/quic_crypto_server_stream.cc
+++ b/quic/core/quic_crypto_server_stream.cc
@@ -7,10 +7,10 @@
#include <memory>
#include <string>
+#include "absl/strings/string_view.h"
#include "third_party/boringssl/src/include/openssl/sha.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
namespace quic {
@@ -286,8 +286,8 @@
<< message.DebugString();
if (!QuicVersionUsesCryptoFrames(transport_version())) {
const QuicData& data = message.GetSerialized();
- WriteOrBufferData(quiche::QuicheStringPiece(data.data(), data.length()),
- false, nullptr);
+ WriteOrBufferData(absl::string_view(data.data(), data.length()), false,
+ nullptr);
} else {
SendHandshakeMessage(message);
}
@@ -418,7 +418,7 @@
return;
}
- quiche::QuicheStringPiece user_agent_id;
+ absl::string_view user_agent_id;
message.GetStringPiece(quic::kUAID, &user_agent_id);
if (!session()->user_agent_id().has_value() && !user_agent_id.empty()) {
session()->SetUserAgentId(std::string(user_agent_id));
@@ -430,7 +430,7 @@
if (num_handshake_messages_ == 1) {
// Client attempts zero RTT handshake by sending a non-inchoate CHLO.
- quiche::QuicheStringPiece public_value;
+ absl::string_view public_value;
zero_rtt_attempted_ = message.GetStringPiece(kPUBS, &public_value);
}
diff --git a/quic/core/quic_crypto_server_stream_test.cc b/quic/core/quic_crypto_server_stream_test.cc
index 9ff7dc0..2831dc0 100644
--- a/quic/core/quic_crypto_server_stream_test.cc
+++ b/quic/core/quic_crypto_server_stream_test.cc
@@ -9,6 +9,7 @@
#include <utility>
#include <vector>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/aes_128_gcm_12_encrypter.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_framer.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_handshake.h"
@@ -32,7 +33,6 @@
#include "net/third_party/quiche/src/quic/test_tools/fake_proof_source.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_crypto_server_config_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 {
class QuicConnection;
@@ -96,7 +96,7 @@
.Times(testing::AnyNumber());
EXPECT_CALL(*server_session_, SelectAlpn(_))
.WillRepeatedly(
- [this](const std::vector<quiche::QuicheStringPiece>& alpns) {
+ [this](const std::vector<absl::string_view>& alpns) {
return std::find(
alpns.cbegin(), alpns.cend(),
AlpnForVersion(server_session_->connection()->version()));
diff --git a/quic/core/quic_crypto_stream.cc b/quic/core/quic_crypto_stream.cc
index ae2f067..6d41f0e 100644
--- a/quic/core/quic_crypto_stream.cc
+++ b/quic/core/quic_crypto_stream.cc
@@ -6,6 +6,7 @@
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_handshake.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_utils.h"
#include "net/third_party/quiche/src/quic/core/quic_connection.h"
@@ -16,7 +17,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -108,8 +108,7 @@
EncryptionLevel level) {
struct iovec iov;
while (sequencer->GetReadableRegion(&iov)) {
- quiche::QuicheStringPiece data(static_cast<char*>(iov.iov_base),
- iov.iov_len);
+ absl::string_view data(static_cast<char*>(iov.iov_base), iov.iov_len);
if (!crypto_message_parser()->ProcessInput(data, level)) {
OnUnrecoverableError(crypto_message_parser()->error(),
crypto_message_parser()->error_detail());
@@ -126,8 +125,8 @@
}
}
-bool QuicCryptoStream::ExportKeyingMaterial(quiche::QuicheStringPiece label,
- quiche::QuicheStringPiece context,
+bool QuicCryptoStream::ExportKeyingMaterial(absl::string_view label,
+ absl::string_view context,
size_t result_len,
std::string* result) const {
if (!one_rtt_keys_available()) {
@@ -141,7 +140,7 @@
}
void QuicCryptoStream::WriteCryptoData(EncryptionLevel level,
- quiche::QuicheStringPiece data) {
+ absl::string_view data) {
if (!QuicVersionUsesCryptoFrames(session()->transport_version())) {
// The QUIC crypto handshake takes care of setting the appropriate
// encryption level before writing data. Since that is the only handshake
diff --git a/quic/core/quic_crypto_stream.h b/quic/core/quic_crypto_stream.h
index d73d970..21bdde6 100644
--- a/quic/core/quic_crypto_stream.h
+++ b/quic/core/quic_crypto_stream.h
@@ -9,6 +9,7 @@
#include <cstddef>
#include <string>
+#include "absl/strings/string_view.h"
#include "third_party/boringssl/src/include/openssl/ssl.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_framer.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_utils.h"
@@ -17,7 +18,6 @@
#include "net/third_party/quiche/src/quic/core/quic_stream.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 {
@@ -64,14 +64,13 @@
// dependent on |label|, |context|, and the stream's negotiated subkey secret.
// Returns false if the handshake has not been confirmed or the parameters are
// invalid (e.g. |label| contains null bytes); returns true on success.
- bool ExportKeyingMaterial(quiche::QuicheStringPiece label,
- quiche::QuicheStringPiece context,
+ bool ExportKeyingMaterial(absl::string_view label,
+ absl::string_view context,
size_t result_len,
std::string* result) const;
// Writes |data| to the QuicStream at level |level|.
- virtual void WriteCryptoData(EncryptionLevel level,
- quiche::QuicheStringPiece data);
+ virtual void WriteCryptoData(EncryptionLevel level, absl::string_view data);
// Returns the ssl_early_data_reason_t describing why 0-RTT was accepted or
// rejected. Note that the value returned by this function may vary during the
diff --git a/quic/core/quic_data_reader.cc b/quic/core/quic_data_reader.cc
index c82e051..572845d 100644
--- a/quic/core/quic_data_reader.cc
+++ b/quic/core/quic_data_reader.cc
@@ -4,17 +4,17 @@
#include "net/third_party/quiche/src/quic/core/quic_data_reader.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_packets.h"
#include "net/third_party/quiche/src/quic/core/quic_utils.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_endian.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 {
-QuicDataReader::QuicDataReader(quiche::QuicheStringPiece data)
+QuicDataReader::QuicDataReader(absl::string_view data)
: quiche::QuicheDataReader(data) {}
QuicDataReader::QuicDataReader(const char* data, const size_t len)
@@ -165,8 +165,7 @@
return false;
}
-bool QuicDataReader::ReadStringPieceVarInt62(
- quiche::QuicheStringPiece* result) {
+bool QuicDataReader::ReadStringPieceVarInt62(absl::string_view* result) {
uint64_t result_length;
if (!ReadVarInt62(&result_length)) {
return false;
diff --git a/quic/core/quic_data_reader.h b/quic/core/quic_data_reader.h
index 13499ea..dd613b0 100644
--- a/quic/core/quic_data_reader.h
+++ b/quic/core/quic_data_reader.h
@@ -8,10 +8,10 @@
#include <cstddef>
#include <cstdint>
+#include "absl/strings/string_view.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_endian.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/quiche_data_reader.h"
namespace quic {
@@ -34,7 +34,7 @@
public:
// Constructs a reader using NETWORK_BYTE_ORDER endianness.
// Caller must provide an underlying buffer to work on.
- explicit QuicDataReader(quiche::QuicheStringPiece data);
+ explicit QuicDataReader(absl::string_view data);
// Constructs a reader using NETWORK_BYTE_ORDER endianness.
// Caller must provide an underlying buffer to work on.
QuicDataReader(const char* data, const size_t len);
@@ -85,7 +85,7 @@
//
// Forwards the internal iterator on success.
// Returns true on success, false otherwise.
- bool ReadStringPieceVarInt62(quiche::QuicheStringPiece* result);
+ bool ReadStringPieceVarInt62(absl::string_view* result);
};
} // namespace quic
diff --git a/quic/core/quic_data_writer.cc b/quic/core/quic_data_writer.cc
index 41c374c..3603984 100644
--- a/quic/core/quic_data_writer.cc
+++ b/quic/core/quic_data_writer.cc
@@ -7,13 +7,13 @@
#include <algorithm>
#include <limits>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_random.h"
#include "net/third_party/quiche/src/quic/core/quic_constants.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_endian.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 {
@@ -234,7 +234,7 @@
}
bool QuicDataWriter::WriteStringPieceVarInt62(
- const quiche::QuicheStringPiece& string_piece) {
+ const absl::string_view& string_piece) {
if (!WriteVarInt62(string_piece.size())) {
return false;
}
diff --git a/quic/core/quic_data_writer.h b/quic/core/quic_data_writer.h
index 3926c1a..4296b21 100644
--- a/quic/core/quic_data_writer.h
+++ b/quic/core/quic_data_writer.h
@@ -8,10 +8,10 @@
#include <cstddef>
#include <cstdint>
+#include "absl/strings/string_view.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_endian.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/quiche_data_writer.h"
namespace quic {
@@ -69,7 +69,7 @@
// Writes a string piece as a consecutive length/content pair. The
// length is VarInt62 encoded.
- bool WriteStringPieceVarInt62(const quiche::QuicheStringPiece& string_piece);
+ bool WriteStringPieceVarInt62(const absl::string_view& string_piece);
// Utility function to return the number of bytes needed to encode
// the given value using IETF VarInt62 encoding. Returns the number
diff --git a/quic/core/quic_data_writer_test.cc b/quic/core/quic_data_writer_test.cc
index e05af21..1aa4f3f 100644
--- a/quic/core/quic_data_writer_test.cc
+++ b/quic/core/quic_data_writer_test.cc
@@ -7,6 +7,7 @@
#include <cstdint>
#include <cstring>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_connection_id.h"
#include "net/third_party/quiche/src/quic/core/quic_data_reader.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
@@ -18,7 +19,6 @@
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_endian.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/test_tools/quiche_test_utils.h"
namespace quic {
@@ -1227,24 +1227,22 @@
quiche::test::CompareCharArraysWithHexError(
"first read", first_read_buffer, sizeof(first_read_buffer),
expected_first_read, sizeof(expected_first_read));
- quiche::QuicheStringPiece peeked_remaining_payload =
- reader.PeekRemainingPayload();
+ absl::string_view peeked_remaining_payload = reader.PeekRemainingPayload();
quiche::test::CompareCharArraysWithHexError(
"peeked_remaining_payload", peeked_remaining_payload.data(),
peeked_remaining_payload.length(), expected_remaining,
sizeof(expected_remaining));
- quiche::QuicheStringPiece full_payload = reader.FullPayload();
+ absl::string_view full_payload = reader.FullPayload();
quiche::test::CompareCharArraysWithHexError(
"full_payload", full_payload.data(), full_payload.length(), buffer,
sizeof(buffer));
- quiche::QuicheStringPiece read_remaining_payload =
- reader.ReadRemainingPayload();
+ absl::string_view read_remaining_payload = reader.ReadRemainingPayload();
quiche::test::CompareCharArraysWithHexError(
"read_remaining_payload", read_remaining_payload.data(),
read_remaining_payload.length(), expected_remaining,
sizeof(expected_remaining));
EXPECT_TRUE(reader.IsDoneReading());
- quiche::QuicheStringPiece full_payload2 = reader.FullPayload();
+ absl::string_view full_payload2 = reader.FullPayload();
quiche::test::CompareCharArraysWithHexError(
"full_payload2", full_payload2.data(), full_payload2.length(), buffer,
sizeof(buffer));
@@ -1253,14 +1251,13 @@
TEST_P(QuicDataWriterTest, StringPieceVarInt62) {
char inner_buffer[16] = {1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16};
- quiche::QuicheStringPiece inner_payload_write(inner_buffer,
- sizeof(inner_buffer));
+ absl::string_view inner_payload_write(inner_buffer, sizeof(inner_buffer));
char buffer[sizeof(inner_buffer) + sizeof(uint8_t)] = {};
QuicDataWriter writer(sizeof(buffer), buffer);
EXPECT_TRUE(writer.WriteStringPieceVarInt62(inner_payload_write));
EXPECT_EQ(0u, writer.remaining());
QuicDataReader reader(buffer, sizeof(buffer));
- quiche::QuicheStringPiece inner_payload_read;
+ absl::string_view inner_payload_read;
EXPECT_TRUE(reader.ReadStringPieceVarInt62(&inner_payload_read));
quiche::test::CompareCharArraysWithHexError(
"inner_payload", inner_payload_write.data(), inner_payload_write.length(),
diff --git a/quic/core/quic_datagram_queue_test.cc b/quic/core/quic_datagram_queue_test.cc
index 34ccccc..fb31e30 100644
--- a/quic/core/quic_datagram_queue_test.cc
+++ b/quic/core/quic_datagram_queue_test.cc
@@ -4,6 +4,7 @@
#include "net/third_party/quiche/src/quic/core/quic_datagram_queue.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_buffer_allocator.h"
#include "net/third_party/quiche/src/quic/core/quic_time.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
@@ -11,7 +12,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
namespace test {
@@ -41,7 +41,7 @@
session_.SetCryptoStream(new EstablishedCryptoStream(&session_));
}
- QuicMemSlice CreateMemSlice(quiche::QuicheStringPiece data) {
+ QuicMemSlice CreateMemSlice(absl::string_view data) {
QuicUniqueBufferPtr buffer =
MakeUniqueBuffer(helper_.GetStreamSendBufferAllocator(), data.size());
memcpy(buffer.get(), data.data(), data.size());
diff --git a/quic/core/quic_dispatcher.cc b/quic/core/quic_dispatcher.cc
index 972a9ac..ac40b0a 100644
--- a/quic/core/quic_dispatcher.cc
+++ b/quic/core/quic_dispatcher.cc
@@ -7,6 +7,7 @@
#include <string>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/chlo_extractor.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_protocol.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_random.h"
@@ -22,7 +23,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_ptr_util.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_stack_trace.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 {
@@ -190,12 +190,12 @@
void OnChlo(QuicTransportVersion version,
QuicConnectionId /*server_connection_id*/,
const CryptoHandshakeMessage& chlo) override {
- quiche::QuicheStringPiece alpn_value;
+ absl::string_view alpn_value;
if (chlo.GetStringPiece(kALPN, &alpn_value)) {
alpn_ = std::string(alpn_value);
}
if (version == LegacyVersionForEncapsulation().transport_version) {
- quiche::QuicheStringPiece qlve_value;
+ absl::string_view qlve_value;
if (chlo.GetStringPiece(kQLVE, &qlve_value)) {
legacy_version_encapsulation_inner_packet_ = std::string(qlve_value);
}
@@ -231,7 +231,7 @@
ParsedQuicVersion parsed_version = ParsedQuicVersion::Unsupported();
QuicConnectionId destination_connection_id, source_connection_id;
bool retry_token_present;
- quiche::QuicheStringPiece retry_token;
+ absl::string_view retry_token;
std::string detailed_error;
const QuicErrorCode error = QuicFramer::ParsePublicHeaderDispatcher(
QuicEncryptedPacket(legacy_version_encapsulation_inner_packet.data(),
@@ -338,12 +338,12 @@
const QuicReceivedPacket& packet) {
QUIC_DVLOG(2) << "Dispatcher received encrypted " << packet.length()
<< " bytes:" << std::endl
- << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
- packet.data(), packet.length()));
+ << quiche::QuicheTextUtils::HexDump(
+ absl::string_view(packet.data(), packet.length()));
ReceivedPacketInfo packet_info(self_address, peer_address, packet);
std::string detailed_error;
bool retry_token_present;
- quiche::QuicheStringPiece retry_token;
+ absl::string_view retry_token;
const QuicErrorCode error = QuicFramer::ParsePublicHeaderDispatcher(
packet, expected_server_connection_id_length_, &packet_info.form,
&packet_info.long_packet_type, &packet_info.version_flag,
diff --git a/quic/core/quic_dispatcher.h b/quic/core/quic_dispatcher.h
index e4c61e5..cdc4edc 100644
--- a/quic/core/quic_dispatcher.h
+++ b/quic/core/quic_dispatcher.h
@@ -12,6 +12,7 @@
#include <string>
#include <vector>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_compressed_certs_cache.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_random.h"
#include "net/third_party/quiche/src/quic/core/quic_blocked_writer_interface.h"
@@ -25,7 +26,6 @@
#include "net/third_party/quiche/src/quic/core/quic_version_manager.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_containers.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
namespace test {
@@ -140,7 +140,7 @@
QuicConnectionId server_connection_id,
const QuicSocketAddress& self_address,
const QuicSocketAddress& peer_address,
- quiche::QuicheStringPiece alpn,
+ absl::string_view alpn,
const ParsedQuicVersion& version) = 0;
// Tries to validate and dispatch packet based on available information.
diff --git a/quic/core/quic_dispatcher_test.cc b/quic/core/quic_dispatcher_test.cc
index ae0d594..db1020e 100644
--- a/quic/core/quic_dispatcher_test.cc
+++ b/quic/core/quic_dispatcher_test.cc
@@ -135,7 +135,7 @@
(QuicConnectionId connection_id,
const QuicSocketAddress& self_address,
const QuicSocketAddress& peer_address,
- quiche::QuicheStringPiece alpn,
+ absl::string_view alpn,
const quic::ParsedQuicVersion& version),
(override));
@@ -605,7 +605,7 @@
ParsedQuicVersion parsed_version = ParsedQuicVersion::Unsupported();
QuicConnectionId destination_connection_id, source_connection_id;
bool retry_token_present;
- quiche::QuicheStringPiece retry_token;
+ absl::string_view retry_token;
std::string detailed_error;
const QuicErrorCode error = QuicFramer::ParsePublicHeaderDispatcher(
QuicEncryptedPacket(packets[0]->data(), packets[0]->length()),
diff --git a/quic/core/quic_framer.cc b/quic/core/quic_framer.cc
index cbf1959..6b9f0c1 100644
--- a/quic/core/quic_framer.cc
+++ b/quic/core/quic_framer.cc
@@ -11,6 +11,7 @@
#include <string>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_framer.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_handshake.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_handshake_message.h"
@@ -45,7 +46,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_stack_trace.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.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"
namespace quic {
@@ -295,14 +295,14 @@
return NUM_ENCRYPTION_LEVELS;
}
-quiche::QuicheStringPiece TruncateErrorString(quiche::QuicheStringPiece error) {
+absl::string_view TruncateErrorString(absl::string_view error) {
if (error.length() <= kMaxErrorStringLength) {
return error;
}
- return quiche::QuicheStringPiece(error.data(), kMaxErrorStringLength);
+ return absl::string_view(error.data(), kMaxErrorStringLength);
}
-size_t TruncatedErrorStringSize(const quiche::QuicheStringPiece& error) {
+size_t TruncatedErrorStringSize(const absl::string_view& error) {
if (error.length() < kMaxErrorStringLength) {
return error.length();
}
@@ -1547,14 +1547,13 @@
const size_t retry_token_length =
bytes_remaining - kRetryIntegrityTagLength;
DCHECK_GT(retry_token_length, 0u);
- quiche::QuicheStringPiece retry_token;
+ absl::string_view retry_token;
if (!reader->ReadStringPiece(&retry_token, retry_token_length)) {
set_detailed_error("Failed to read retry token.");
return false;
}
- quiche::QuicheStringPiece retry_without_tag =
- reader->PreviouslyReadPayload();
- quiche::QuicheStringPiece integrity_tag = reader->ReadRemainingPayload();
+ absl::string_view retry_without_tag = reader->PreviouslyReadPayload();
+ absl::string_view integrity_tag = reader->ReadRemainingPayload();
DCHECK_EQ(integrity_tag.length(), kRetryIntegrityTagLength);
visitor_->OnRetryPacket(EmptyQuicConnectionId(),
header.source_connection_id, retry_token,
@@ -1591,11 +1590,11 @@
return false;
}
- quiche::QuicheStringPiece retry_token = reader->ReadRemainingPayload();
+ absl::string_view retry_token = reader->ReadRemainingPayload();
visitor_->OnRetryPacket(original_destination_connection_id,
header.source_connection_id, retry_token,
- /*retry_integrity_tag=*/quiche::QuicheStringPiece(),
- /*retry_without_tag=*/quiche::QuicheStringPiece());
+ /*retry_integrity_tag=*/absl::string_view(),
+ /*retry_without_tag=*/absl::string_view());
return true;
}
@@ -1611,8 +1610,7 @@
return;
}
- quiche::QuicheStringPiece remaining_data =
- encrypted_reader.PeekRemainingPayload();
+ absl::string_view remaining_data = encrypted_reader.PeekRemainingPayload();
DCHECK_EQ(remaining_data.length(), remaining_bytes_length);
const char* coalesced_data =
@@ -1695,8 +1693,7 @@
perspective_ == Perspective::IS_CLIENT) {
// Peek possible stateless reset token. Will only be used on decryption
// failure.
- quiche::QuicheStringPiece remaining =
- encrypted_reader->PeekRemainingPayload();
+ absl::string_view remaining = encrypted_reader->PeekRemainingPayload();
if (remaining.length() >= sizeof(header->possible_stateless_reset_token)) {
header->has_possible_stateless_reset_token = true;
memcpy(&header->possible_stateless_reset_token,
@@ -1710,7 +1707,7 @@
return false;
}
- quiche::QuicheStringPiece associated_data;
+ absl::string_view associated_data;
std::vector<char> ad_storage;
QuicPacketNumber base_packet_number;
if (header->form == IETF_QUIC_SHORT_HEADER_PACKET ||
@@ -1736,8 +1733,7 @@
&full_packet_number, &ad_storage)) {
hp_removal_failed = true;
}
- associated_data =
- quiche::QuicheStringPiece(ad_storage.data(), ad_storage.size());
+ associated_data = absl::string_view(ad_storage.data(), ad_storage.size());
} else if (!ProcessAndCalculatePacketNumber(
encrypted_reader, header->packet_number_length,
base_packet_number, &full_packet_number)) {
@@ -1801,8 +1797,7 @@
return false;
}
- quiche::QuicheStringPiece encrypted =
- encrypted_reader->ReadRemainingPayload();
+ absl::string_view encrypted = encrypted_reader->ReadRemainingPayload();
if (!version_.HasHeaderProtection()) {
associated_data = GetAssociatedDataFromEncryptedPacket(
version_.transport_version, packet,
@@ -1906,16 +1901,14 @@
return false;
}
- quiche::QuicheStringPiece encrypted =
- encrypted_reader->ReadRemainingPayload();
- quiche::QuicheStringPiece associated_data =
- GetAssociatedDataFromEncryptedPacket(
- version_.transport_version, packet,
- GetIncludedDestinationConnectionIdLength(*header),
- GetIncludedSourceConnectionIdLength(*header), header->version_flag,
- header->nonce != nullptr, header->packet_number_length,
- header->retry_token_length_length, header->retry_token.length(),
- header->length_length);
+ absl::string_view encrypted = encrypted_reader->ReadRemainingPayload();
+ absl::string_view associated_data = GetAssociatedDataFromEncryptedPacket(
+ version_.transport_version, packet,
+ GetIncludedDestinationConnectionIdLength(*header),
+ GetIncludedSourceConnectionIdLength(*header), header->version_flag,
+ header->nonce != nullptr, header->packet_number_length,
+ header->retry_token_length_length, header->retry_token.length(),
+ header->length_length);
size_t decrypted_length = 0;
EncryptionLevel decrypted_level;
@@ -1995,7 +1988,7 @@
}
// TODO(satyamshekhar): validate nonce to protect against DoS.
- quiche::QuicheStringPiece address;
+ absl::string_view address;
if (reset->GetStringPiece(kCADR, &address)) {
QuicSocketAddressCoder address_coder;
if (address_coder.Decode(address.data(), address.length())) {
@@ -2004,7 +1997,7 @@
}
}
- quiche::QuicheStringPiece endpoint_id;
+ absl::string_view endpoint_id;
if (perspective_ == Perspective::IS_CLIENT &&
reset->GetStringPiece(kEPID, &endpoint_id)) {
packet.endpoint_id = std::string(endpoint_id);
@@ -3476,8 +3469,8 @@
return false;
}
- // TODO(ianswett): Don't use quiche::QuicheStringPiece as an intermediary.
- quiche::QuicheStringPiece data;
+ // TODO(ianswett): Don't use absl::string_view as an intermediary.
+ absl::string_view data;
if (has_data_length) {
if (!reader->ReadStringPiece16(&data)) {
set_detailed_error("Unable to read frame data.");
@@ -3538,8 +3531,8 @@
frame->fin = false;
}
- // TODO(ianswett): Don't use quiche::QuicheStringPiece as an intermediary.
- quiche::QuicheStringPiece data;
+ // TODO(ianswett): Don't use absl::string_view as an intermediary.
+ absl::string_view data;
if (!reader->ReadStringPiece(&data, frame->data_length)) {
set_detailed_error("Unable to read frame data.");
return false;
@@ -3566,8 +3559,8 @@
}
frame->data_length = len;
- // TODO(ianswett): Don't use quiche::QuicheStringPiece as an intermediary.
- quiche::QuicheStringPiece data;
+ // TODO(ianswett): Don't use absl::string_view as an intermediary.
+ absl::string_view data;
if (!reader->ReadStringPiece(&data, frame->data_length)) {
set_detailed_error("Unable to read frame data.");
return false;
@@ -4069,7 +4062,7 @@
frame->wire_error_code = error_code;
frame->quic_error_code = static_cast<QuicErrorCode>(error_code);
- quiche::QuicheStringPiece error_details;
+ absl::string_view error_details;
if (!reader->ReadStringPiece16(&error_details)) {
set_detailed_error("Unable to read connection close error details.");
return false;
@@ -4101,7 +4094,7 @@
}
frame->last_good_stream_id = static_cast<QuicStreamId>(stream_id);
- quiche::QuicheStringPiece reason_phrase;
+ absl::string_view reason_phrase;
if (!reader->ReadStringPiece16(&reason_phrase)) {
set_detailed_error("Unable to read goaway reason.");
return false;
@@ -4155,7 +4148,7 @@
bool no_message_length,
QuicMessageFrame* frame) {
if (no_message_length) {
- quiche::QuicheStringPiece remaining(reader->ReadRemainingPayload());
+ absl::string_view remaining(reader->ReadRemainingPayload());
frame->data = remaining.data();
frame->message_length = remaining.length();
return true;
@@ -4167,7 +4160,7 @@
return false;
}
- quiche::QuicheStringPiece message_piece;
+ absl::string_view message_piece;
if (!reader->ReadStringPiece(&message_piece, message_length)) {
set_detailed_error("Unable to read message data");
return false;
@@ -4180,7 +4173,7 @@
}
// static
-quiche::QuicheStringPiece QuicFramer::GetAssociatedDataFromEncryptedPacket(
+absl::string_view QuicFramer::GetAssociatedDataFromEncryptedPacket(
QuicTransportVersion version,
const QuicEncryptedPacket& encrypted,
QuicConnectionIdLength destination_connection_id_length,
@@ -4192,7 +4185,7 @@
uint64_t retry_token_length,
QuicVariableLengthIntegerLength length_length) {
// TODO(ianswett): This is identical to QuicData::AssociatedData.
- return quiche::QuicheStringPiece(
+ return absl::string_view(
encrypted.data(),
GetStartOfEncryptedData(version, destination_connection_id_length,
source_connection_id_length, includes_version,
@@ -4297,10 +4290,10 @@
size_t output_length = 0;
if (!encrypter_[level]->EncryptPacket(
packet_number.ToUint64(),
- quiche::QuicheStringPiece(buffer, ad_len), // Associated data
- quiche::QuicheStringPiece(buffer + ad_len,
- total_len - ad_len), // Plaintext
- buffer + ad_len, // Destination buffer
+ absl::string_view(buffer, ad_len), // Associated data
+ absl::string_view(buffer + ad_len,
+ total_len - ad_len), // Plaintext
+ buffer + ad_len, // Destination buffer
&output_length, buffer_len - ad_len)) {
RaiseError(QUIC_ENCRYPTION_FAILURE);
return 0;
@@ -4339,7 +4332,7 @@
// Sample the ciphertext and generate the mask to use for header protection.
size_t sample_offset = pn_offset + 4;
QuicDataReader sample_reader(buffer, buffer_len);
- quiche::QuicheStringPiece sample;
+ absl::string_view sample;
if (!sample_reader.Seek(sample_offset) ||
!sample_reader.ReadStringPiece(&sample, kHPSampleLen)) {
QUIC_BUG << "Not enough bytes to sample: sample_offset " << sample_offset
@@ -4434,11 +4427,11 @@
// Read a sample from the ciphertext and compute the mask to use for header
// protection.
- quiche::QuicheStringPiece remaining_packet = reader->PeekRemainingPayload();
+ absl::string_view remaining_packet = reader->PeekRemainingPayload();
QuicDataReader sample_reader(remaining_packet);
// The sample starts 4 bytes after the start of the packet number.
- quiche::QuicheStringPiece pn;
+ absl::string_view pn;
if (!sample_reader.ReadStringPiece(&pn, 4)) {
QUIC_DVLOG(1) << "Not enough data to sample";
return false;
@@ -4506,7 +4499,7 @@
}
// Get the associated data, and apply the same unmasking operations to it.
- quiche::QuicheStringPiece ad = GetAssociatedDataFromEncryptedPacket(
+ absl::string_view ad = GetAssociatedDataFromEncryptedPacket(
version_.transport_version, packet,
GetIncludedDestinationConnectionIdLength(*header),
GetIncludedSourceConnectionIdLength(*header), header->version_flag,
@@ -4548,7 +4541,7 @@
return 0;
}
- quiche::QuicheStringPiece associated_data =
+ absl::string_view associated_data =
packet.AssociatedData(version_.transport_version);
// Copy in the header, because the encrypter only populates the encrypted
// plaintext content.
@@ -4609,8 +4602,8 @@
return min_plaintext_size;
}
-bool QuicFramer::DecryptPayload(quiche::QuicheStringPiece encrypted,
- quiche::QuicheStringPiece associated_data,
+bool QuicFramer::DecryptPayload(absl::string_view encrypted,
+ absl::string_view associated_data,
const QuicPacketHeader& header,
char* decrypted_buffer,
size_t buffer_length,
@@ -5142,8 +5135,8 @@
return false;
}
- // TODO(ianswett): Don't use quiche::QuicheStringPiece as an intermediary.
- quiche::QuicheStringPiece data;
+ // TODO(ianswett): Don't use absl::string_view as an intermediary.
+ absl::string_view data;
if (!reader->ReadStringPiece(&data, length)) {
set_detailed_error("Unable to read new token data.");
return false;
@@ -5813,7 +5806,7 @@
return false;
}
- quiche::QuicheStringPiece phrase;
+ absl::string_view phrase;
if (!reader->ReadStringPiece(&phrase, static_cast<size_t>(phrase_length))) {
set_detailed_error("Unable to read connection close error details.");
return false;
@@ -6284,7 +6277,7 @@
QuicConnectionId* destination_connection_id,
QuicConnectionId* source_connection_id,
bool* retry_token_present,
- quiche::QuicheStringPiece* retry_token,
+ absl::string_view* retry_token,
std::string* detailed_error) {
QuicDataReader reader(packet.data(), packet.length());
if (reader.IsDoneReading()) {
@@ -6454,7 +6447,7 @@
QuicConnectionId* source_connection_id,
QuicLongHeaderType* long_packet_type,
QuicVariableLengthIntegerLength* retry_token_length_length,
- quiche::QuicheStringPiece* retry_token,
+ absl::string_view* retry_token,
std::string* detailed_error) {
*version_present = false;
*has_length_prefix = false;
@@ -6463,7 +6456,7 @@
*source_connection_id = EmptyQuicConnectionId();
*long_packet_type = INVALID_PACKET_TYPE;
*retry_token_length_length = VARIABLE_LENGTH_INTEGER_LENGTH_0;
- *retry_token = quiche::QuicheStringPiece();
+ *retry_token = absl::string_view();
*detailed_error = "";
if (!reader->ReadUInt8(first_byte)) {
@@ -6738,7 +6731,7 @@
// the string is not found, or is not properly formed, it returns
// ErrorCode::QUIC_IETF_GQUIC_ERROR_MISSING
void MaybeExtractQuicErrorCode(QuicConnectionCloseFrame* frame) {
- std::vector<quiche::QuicheStringPiece> ed =
+ std::vector<absl::string_view> ed =
quiche::QuicheTextUtils::Split(frame->error_details, ':');
uint64_t extracted_error_code;
if (ed.size() < 2 || !quiche::QuicheTextUtils::IsAllDigits(ed[0]) ||
@@ -6756,7 +6749,7 @@
// including, the split character, so the length of ed[0] is just the number
// of digits in the error number. In removing the prefix, 1 is added to the
// length to account for the :
- quiche::QuicheStringPiece x = quiche::QuicheStringPiece(frame->error_details);
+ absl::string_view x = absl::string_view(frame->error_details);
x.remove_prefix(ed[0].length() + 1);
frame->error_details = std::string(x);
frame->quic_error_code = static_cast<QuicErrorCode>(extracted_error_code);
diff --git a/quic/core/quic_framer.h b/quic/core/quic_framer.h
index c9820d4..e57e252 100644
--- a/quic/core/quic_framer.h
+++ b/quic/core/quic_framer.h
@@ -10,6 +10,7 @@
#include <memory>
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_decrypter.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_encrypter.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_random.h"
@@ -17,7 +18,6 @@
#include "net/third_party/quiche/src/quic/core/quic_packets.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 {
@@ -106,9 +106,9 @@
// the entire RETRY packet except the Retry Integrity Tag field.
virtual void OnRetryPacket(QuicConnectionId original_connection_id,
QuicConnectionId new_connection_id,
- quiche::QuicheStringPiece retry_token,
- quiche::QuicheStringPiece retry_integrity_tag,
- quiche::QuicheStringPiece retry_without_tag) = 0;
+ absl::string_view retry_token,
+ absl::string_view retry_integrity_tag,
+ absl::string_view retry_without_tag) = 0;
// Called when all fields except packet number has been parsed, but has not
// been authenticated. If it returns false, framing for this packet will
@@ -385,7 +385,7 @@
// Returns the associated data from the encrypted packet |encrypted| as a
// stringpiece.
- static quiche::QuicheStringPiece GetAssociatedDataFromEncryptedPacket(
+ static absl::string_view GetAssociatedDataFromEncryptedPacket(
QuicTransportVersion version,
const QuicEncryptedPacket& encrypted,
QuicConnectionIdLength destination_connection_id_length,
@@ -414,7 +414,7 @@
QuicConnectionId* source_connection_id,
QuicLongHeaderType* long_packet_type,
QuicVariableLengthIntegerLength* retry_token_length_length,
- quiche::QuicheStringPiece* retry_token,
+ absl::string_view* retry_token,
std::string* detailed_error);
// Parses the unencrypted fields in |packet| and stores them in the other
@@ -432,7 +432,7 @@
QuicConnectionId* destination_connection_id,
QuicConnectionId* source_connection_id,
bool* retry_token_present,
- quiche::QuicheStringPiece* retry_token,
+ absl::string_view* retry_token,
std::string* detailed_error);
// Serializes a packet containing |frames| into |buffer|.
@@ -808,8 +808,8 @@
bool no_message_length,
QuicMessageFrame* frame);
- bool DecryptPayload(quiche::QuicheStringPiece encrypted,
- quiche::QuicheStringPiece associated_data,
+ bool DecryptPayload(absl::string_view encrypted,
+ absl::string_view associated_data,
const QuicPacketHeader& header,
char* decrypted_buffer,
size_t buffer_length,
diff --git a/quic/core/quic_framer_test.cc b/quic/core/quic_framer_test.cc
index 688aa02..f35613a 100644
--- a/quic/core/quic_framer_test.cc
+++ b/quic/core/quic_framer_test.cc
@@ -12,6 +12,7 @@
#include <utility>
#include <vector>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/null_decrypter.h"
#include "net/third_party/quiche/src/quic/core/crypto/null_encrypter.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_decrypter.h"
@@ -31,7 +32,6 @@
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/quic/test_tools/simple_data_producer.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
#include "net/third_party/quiche/src/common/test_tools/quiche_test_utils.h"
@@ -92,17 +92,17 @@
class TestEncrypter : public QuicEncrypter {
public:
~TestEncrypter() override {}
- bool SetKey(quiche::QuicheStringPiece /*key*/) override { return true; }
- bool SetNoncePrefix(quiche::QuicheStringPiece /*nonce_prefix*/) override {
+ bool SetKey(absl::string_view /*key*/) override { return true; }
+ bool SetNoncePrefix(absl::string_view /*nonce_prefix*/) override {
return true;
}
- bool SetIV(quiche::QuicheStringPiece /*iv*/) override { return true; }
- bool SetHeaderProtectionKey(quiche::QuicheStringPiece /*key*/) override {
+ bool SetIV(absl::string_view /*iv*/) override { return true; }
+ bool SetHeaderProtectionKey(absl::string_view /*key*/) override {
return true;
}
bool EncryptPacket(uint64_t packet_number,
- quiche::QuicheStringPiece associated_data,
- quiche::QuicheStringPiece plaintext,
+ absl::string_view associated_data,
+ absl::string_view plaintext,
char* output,
size_t* output_length,
size_t /*max_output_length*/) override {
@@ -114,7 +114,7 @@
return true;
}
std::string GenerateHeaderProtectionMask(
- quiche::QuicheStringPiece /*sample*/) override {
+ absl::string_view /*sample*/) override {
return std::string(5, 0);
}
size_t GetKeySize() const override { return 0; }
@@ -126,11 +126,9 @@
size_t GetCiphertextSize(size_t plaintext_size) const override {
return plaintext_size;
}
- quiche::QuicheStringPiece GetKey() const override {
- return quiche::QuicheStringPiece();
- }
- quiche::QuicheStringPiece GetNoncePrefix() const override {
- return quiche::QuicheStringPiece();
+ absl::string_view GetKey() const override { return absl::string_view(); }
+ absl::string_view GetNoncePrefix() const override {
+ return absl::string_view();
}
QuicPacketNumber packet_number_;
@@ -141,15 +139,15 @@
class TestDecrypter : public QuicDecrypter {
public:
~TestDecrypter() override {}
- bool SetKey(quiche::QuicheStringPiece /*key*/) override { return true; }
- bool SetNoncePrefix(quiche::QuicheStringPiece /*nonce_prefix*/) override {
+ bool SetKey(absl::string_view /*key*/) override { return true; }
+ bool SetNoncePrefix(absl::string_view /*nonce_prefix*/) override {
return true;
}
- bool SetIV(quiche::QuicheStringPiece /*iv*/) override { return true; }
- bool SetHeaderProtectionKey(quiche::QuicheStringPiece /*key*/) override {
+ bool SetIV(absl::string_view /*iv*/) override { return true; }
+ bool SetHeaderProtectionKey(absl::string_view /*key*/) override {
return true;
}
- bool SetPreliminaryKey(quiche::QuicheStringPiece /*key*/) override {
+ bool SetPreliminaryKey(absl::string_view /*key*/) override {
QUIC_BUG << "should not be called";
return false;
}
@@ -157,8 +155,8 @@
return true;
}
bool DecryptPacket(uint64_t packet_number,
- quiche::QuicheStringPiece associated_data,
- quiche::QuicheStringPiece ciphertext,
+ absl::string_view associated_data,
+ absl::string_view ciphertext,
char* output,
size_t* output_length,
size_t /*max_output_length*/) override {
@@ -176,11 +174,9 @@
size_t GetKeySize() const override { return 0; }
size_t GetNoncePrefixSize() const override { return 0; }
size_t GetIVSize() const override { return 0; }
- quiche::QuicheStringPiece GetKey() const override {
- return quiche::QuicheStringPiece();
- }
- quiche::QuicheStringPiece GetNoncePrefix() const override {
- return quiche::QuicheStringPiece();
+ absl::string_view GetKey() const override { return absl::string_view(); }
+ absl::string_view GetNoncePrefix() const override {
+ return absl::string_view();
}
// Use a distinct value starting with 0xFFFFFF, which is never used by TLS.
uint32_t cipher_id() const override { return 0xFFFFFFF2; }
@@ -224,9 +220,9 @@
void OnRetryPacket(QuicConnectionId original_connection_id,
QuicConnectionId new_connection_id,
- quiche::QuicheStringPiece retry_token,
- quiche::QuicheStringPiece retry_integrity_tag,
- quiche::QuicheStringPiece retry_without_tag) override {
+ absl::string_view retry_token,
+ absl::string_view retry_integrity_tag,
+ absl::string_view retry_without_tag) override {
on_retry_packet_called_ = true;
retry_original_connection_id_ =
std::make_unique<QuicConnectionId>(original_connection_id);
@@ -707,7 +703,7 @@
<< " actual: " << decrypter_->packet_number_;
return false;
}
- quiche::QuicheStringPiece associated_data =
+ absl::string_view associated_data =
QuicFramer::GetAssociatedDataFromEncryptedPacket(
framer_.transport_version(), encrypted,
destination_connection_id_length, source_connection_id_length,
@@ -722,7 +718,7 @@
decrypter_->associated_data_);
return false;
}
- quiche::QuicheStringPiece ciphertext(
+ absl::string_view ciphertext(
encrypted.AsStringPiece().substr(GetStartOfEncryptedData(
framer_.transport_version(), destination_connection_id_length,
source_connection_id_length, includes_version,
@@ -1070,7 +1066,7 @@
QuicVersionLabel version_label;
std::string detailed_error;
bool retry_token_present, use_length_prefix;
- quiche::QuicheStringPiece retry_token;
+ absl::string_view retry_token;
ParsedQuicVersion parsed_version = UnsupportedQuicVersion();
const QuicErrorCode error_code = QuicFramer::ParsePublicHeaderDispatcher(
*encrypted, kQuicDefaultConnectionIdLength, &format, &long_packet_type,
@@ -1135,7 +1131,7 @@
QuicVersionLabel version_label;
std::string detailed_error;
bool retry_token_present, use_length_prefix;
- quiche::QuicheStringPiece retry_token;
+ absl::string_view retry_token;
ParsedQuicVersion parsed_version = UnsupportedQuicVersion();
const QuicErrorCode error_code = QuicFramer::ParsePublicHeaderDispatcher(
*encrypted, kQuicDefaultConnectionIdLength, &format, &long_packet_type,
@@ -1215,7 +1211,7 @@
QuicVersionLabel version_label = 0;
std::string detailed_error = "";
bool retry_token_present, use_length_prefix;
- quiche::QuicheStringPiece retry_token;
+ absl::string_view retry_token;
ParsedQuicVersion parsed_version = UnsupportedQuicVersion();
const QuicErrorCode error_code = QuicFramer::ParsePublicHeaderDispatcher(
encrypted, kQuicDefaultConnectionIdLength, &format, &long_packet_type,
@@ -1305,7 +1301,7 @@
QuicLongHeaderType long_packet_type = INVALID_PACKET_TYPE;
QuicVariableLengthIntegerLength retry_token_length_length =
VARIABLE_LENGTH_INTEGER_LENGTH_4;
- quiche::QuicheStringPiece retry_token;
+ absl::string_view retry_token;
std::string detailed_error = "foobar";
QuicDataReader reader(AsChars(p), p_length);
@@ -1328,7 +1324,7 @@
EXPECT_EQ(FramerTestConnectionId(), destination_connection_id);
EXPECT_EQ(EmptyQuicConnectionId(), source_connection_id);
EXPECT_EQ(VARIABLE_LENGTH_INTEGER_LENGTH_0, retry_token_length_length);
- EXPECT_EQ(quiche::QuicheStringPiece(), retry_token);
+ EXPECT_EQ(absl::string_view(), retry_token);
if (VersionHasIetfInvariantHeader(framer_.transport_version())) {
EXPECT_EQ(IETF_QUIC_LONG_HEADER_PACKET, format);
EXPECT_EQ(HANDSHAKE, long_packet_type);
@@ -1375,7 +1371,7 @@
QuicLongHeaderType long_packet_type = INVALID_PACKET_TYPE;
QuicVariableLengthIntegerLength retry_token_length_length =
VARIABLE_LENGTH_INTEGER_LENGTH_4;
- quiche::QuicheStringPiece retry_token;
+ absl::string_view retry_token;
std::string detailed_error = "foobar";
QuicDataReader reader(AsChars(p), p_length);
@@ -1395,7 +1391,7 @@
EXPECT_EQ(FramerTestConnectionId(), destination_connection_id);
EXPECT_EQ(EmptyQuicConnectionId(), source_connection_id);
EXPECT_EQ(VARIABLE_LENGTH_INTEGER_LENGTH_0, retry_token_length_length);
- EXPECT_EQ(quiche::QuicheStringPiece(), retry_token);
+ EXPECT_EQ(absl::string_view(), retry_token);
EXPECT_EQ(IETF_QUIC_LONG_HEADER_PACKET, format);
}
@@ -6167,7 +6163,7 @@
header.version_flag = false;
header.packet_number = kPacketNumber;
QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset,
- quiche::QuicheStringPiece("hello world!"));
+ absl::string_view("hello world!"));
QuicPaddingFrame padding_frame(2);
QuicFrames frames = {QuicFrame(padding_frame), QuicFrame(stream_frame),
QuicFrame(padding_frame)};
@@ -6510,7 +6506,7 @@
}
QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset,
- quiche::QuicheStringPiece("hello world!"));
+ absl::string_view("hello world!"));
QuicFrames frames = {QuicFrame(stream_frame)};
@@ -6609,7 +6605,7 @@
}
QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset,
- quiche::QuicheStringPiece("hello world!"));
+ absl::string_view("hello world!"));
QuicFrames frames = {QuicFrame(stream_frame)};
// clang-format off
@@ -6742,7 +6738,7 @@
SimpleDataProducer data_producer;
framer_.set_data_producer(&data_producer);
- quiche::QuicheStringPiece crypto_frame_contents("hello world!");
+ absl::string_view crypto_frame_contents("hello world!");
QuicCryptoFrame crypto_frame(ENCRYPTION_INITIAL, kStreamOffset,
crypto_frame_contents.length());
data_producer.SaveCryptoData(ENCRYPTION_INITIAL, kStreamOffset,
@@ -14029,7 +14025,7 @@
QuicConnectionId destination_connection_id = TestConnectionId(0x33);
QuicConnectionId source_connection_id = TestConnectionId(0x34);
bool retry_token_present = true;
- quiche::QuicheStringPiece retry_token;
+ absl::string_view retry_token;
std::string detailed_error = "foobar";
QuicErrorCode parse_result = QuicFramer::ParsePublicHeaderDispatcher(
@@ -14046,7 +14042,7 @@
EXPECT_EQ(probe_payload_connection_id, destination_connection_id);
EXPECT_EQ(EmptyQuicConnectionId(), source_connection_id);
EXPECT_FALSE(retry_token_present);
- EXPECT_EQ(quiche::QuicheStringPiece(), retry_token);
+ EXPECT_EQ(absl::string_view(), retry_token);
EXPECT_EQ("", detailed_error);
}
@@ -14181,7 +14177,7 @@
QuicConnectionId destination_connection_id = TestConnectionId(1);
QuicConnectionId source_connection_id = TestConnectionId(2);
bool retry_token_present = true;
- quiche::QuicheStringPiece retry_token;
+ absl::string_view retry_token;
std::string detailed_error = "foobar";
QuicErrorCode header_parse_result = QuicFramer::ParsePublicHeaderDispatcher(
encrypted, kQuicDefaultConnectionIdLength, &format, &long_packet_type,
@@ -14260,7 +14256,7 @@
QuicConnectionId destination_connection_id = TestConnectionId(1);
QuicConnectionId source_connection_id = TestConnectionId(2);
bool retry_token_present = true;
- quiche::QuicheStringPiece retry_token;
+ absl::string_view retry_token;
std::string detailed_error = "foobar";
QuicErrorCode header_parse_result = QuicFramer::ParsePublicHeaderDispatcher(
encrypted, kQuicDefaultConnectionIdLength, &format, &long_packet_type,
diff --git a/quic/core/quic_legacy_version_encapsulator.cc b/quic/core/quic_legacy_version_encapsulator.cc
index 4afd342..8e93172 100644
--- a/quic/core/quic_legacy_version_encapsulator.cc
+++ b/quic/core/quic_legacy_version_encapsulator.cc
@@ -19,7 +19,7 @@
// static
QuicByteCount QuicLegacyVersionEncapsulator::GetMinimumOverhead(
- quiche::QuicheStringPiece sni) {
+ absl::string_view sni) {
// The number 52 is the sum of:
// - Flags (1 byte)
// - Server Connection ID (8 bytes)
@@ -85,8 +85,8 @@
// static
QuicPacketLength QuicLegacyVersionEncapsulator::Encapsulate(
- quiche::QuicheStringPiece sni,
- quiche::QuicheStringPiece inner_packet,
+ absl::string_view sni,
+ absl::string_view inner_packet,
const QuicConnectionId& server_connection_id,
QuicTime creation_time,
QuicByteCount outer_max_packet_length,
diff --git a/quic/core/quic_legacy_version_encapsulator.h b/quic/core/quic_legacy_version_encapsulator.h
index 413829b..7a4ada6 100644
--- a/quic/core/quic_legacy_version_encapsulator.h
+++ b/quic/core/quic_legacy_version_encapsulator.h
@@ -5,11 +5,11 @@
#ifndef QUICHE_QUIC_CORE_QUIC_LEGACY_VERSION_ENCAPSULATOR_H_
#define QUICHE_QUIC_CORE_QUIC_LEGACY_VERSION_ENCAPSULATOR_H_
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_packet_creator.h"
#include "net/third_party/quiche/src/quic/core/quic_packets.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 {
@@ -27,8 +27,8 @@
// the contents of the encapsulated packet to |out|. |out| must point to a
// valid memory buffer capable of holding kMaxOutgoingPacketSize bytes.
static QuicPacketLength Encapsulate(
- quiche::QuicheStringPiece sni,
- quiche::QuicheStringPiece inner_packet,
+ absl::string_view sni,
+ absl::string_view inner_packet,
const QuicConnectionId& server_connection_id,
QuicTime creation_time,
QuicByteCount outer_max_packet_length,
@@ -37,7 +37,7 @@
// Returns the number of bytes of minimum overhead caused by Legacy Version
// Encapsulation, based on the length of the provided server name |sni|.
// The overhead may be higher due to extra padding added.
- static QuicByteCount GetMinimumOverhead(quiche::QuicheStringPiece sni);
+ static QuicByteCount GetMinimumOverhead(absl::string_view sni);
// Overrides for QuicPacketCreator::DelegateInterface.
QuicPacketBuffer GetPacketBuffer() override;
diff --git a/quic/core/quic_legacy_version_encapsulator_test.cc b/quic/core/quic_legacy_version_encapsulator_test.cc
index a71b2f4..d765fff 100644
--- a/quic/core/quic_legacy_version_encapsulator_test.cc
+++ b/quic/core/quic_legacy_version_encapsulator_test.cc
@@ -4,11 +4,11 @@
#include "net/third_party/quiche/src/quic/core/quic_legacy_version_encapsulator.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_versions.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_expect_bug.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
namespace quic {
@@ -43,7 +43,7 @@
ParsedQuicVersion parsed_version = ParsedQuicVersion::Unsupported();
QuicConnectionId destination_connection_id, source_connection_id;
bool retry_token_present;
- quiche::QuicheStringPiece retry_token;
+ absl::string_view retry_token;
std::string detailed_error;
const QuicErrorCode error = QuicFramer::ParsePublicHeaderDispatcher(
QuicEncryptedPacket(outer_buffer_, encapsulated_length_),
diff --git a/quic/core/quic_packet_creator.cc b/quic/core/quic_packet_creator.cc
index af9d079..85960c4 100644
--- a/quic/core/quic_packet_creator.cc
+++ b/quic/core/quic_packet_creator.cc
@@ -11,6 +11,7 @@
#include <string>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_protocol.h"
#include "net/third_party/quiche/src/quic/core/frames/quic_frame.h"
#include "net/third_party/quiche/src/quic/core/frames/quic_path_challenge_frame.h"
@@ -31,7 +32,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_server_stats.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.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"
namespace quic {
@@ -1291,16 +1291,16 @@
return VARIABLE_LENGTH_INTEGER_LENGTH_0;
}
-quiche::QuicheStringPiece QuicPacketCreator::GetRetryToken() const {
+absl::string_view QuicPacketCreator::GetRetryToken() const {
if (QuicVersionHasLongHeaderLengths(framer_->transport_version()) &&
HasIetfLongHeader() &&
EncryptionlevelToLongHeaderType(packet_.encryption_level) == INITIAL) {
return retry_token_;
}
- return quiche::QuicheStringPiece();
+ return absl::string_view();
}
-void QuicPacketCreator::SetRetryToken(quiche::QuicheStringPiece retry_token) {
+void QuicPacketCreator::SetRetryToken(absl::string_view retry_token) {
retry_token_ = std::string(retry_token);
}
diff --git a/quic/core/quic_packet_creator.h b/quic/core/quic_packet_creator.h
index b65bd27..882b17d 100644
--- a/quic/core/quic_packet_creator.h
+++ b/quic/core/quic_packet_creator.h
@@ -20,6 +20,7 @@
#include <utility>
#include <vector>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/frames/quic_stream_frame.h"
#include "net/third_party/quiche/src/quic/core/quic_circular_deque.h"
#include "net/third_party/quiche/src/quic/core/quic_coalesced_packet.h"
@@ -28,7 +29,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_macros.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
namespace test {
@@ -322,7 +322,7 @@
void AddPendingPadding(QuicByteCount size);
// Sets the retry token to be sent over the wire in IETF Initial packets.
- void SetRetryToken(quiche::QuicheStringPiece retry_token);
+ void SetRetryToken(absl::string_view retry_token);
// Consumes retransmittable control |frame|. Returns true if the frame is
// successfully consumed. Returns false otherwise.
@@ -573,7 +573,7 @@
// Returns the retry token to send over the wire, only sent in
// v99 IETF Initial packets.
- quiche::QuicheStringPiece GetRetryToken() const;
+ absl::string_view GetRetryToken() const;
// Returns length of the length variable length integer to send over the
// wire. Is non-zero for v99 IETF Initial, 0-RTT or Handshake packets.
diff --git a/quic/core/quic_packet_creator_test.cc b/quic/core/quic_packet_creator_test.cc
index 4afbf06..c31d3c7 100644
--- a/quic/core/quic_packet_creator_test.cc
+++ b/quic/core/quic_packet_creator_test.cc
@@ -11,6 +11,7 @@
#include <string>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/null_decrypter.h"
#include "net/third_party/quiche/src/quic/core/crypto/null_encrypter.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_decrypter.h"
@@ -32,7 +33,6 @@
#include "net/third_party/quiche/src/quic/test_tools/simple_quic_framer.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.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/test_tools/quiche_test_utils.h"
using testing::_;
@@ -227,8 +227,7 @@
producer_.WriteStreamData(stream_id, frame.stream_frame.offset,
frame.stream_frame.data_length, &writer);
}
- EXPECT_EQ(data,
- quiche::QuicheStringPiece(buf, frame.stream_frame.data_length));
+ EXPECT_EQ(data, absl::string_view(buf, frame.stream_frame.data_length));
EXPECT_EQ(offset, frame.stream_frame.offset);
EXPECT_EQ(fin, frame.stream_frame.fin);
}
@@ -306,7 +305,7 @@
client_framer_.transport_version(), Perspective::IS_CLIENT);
if (level != ENCRYPTION_INITIAL && level != ENCRYPTION_HANDSHAKE) {
frames_.push_back(QuicFrame(
- QuicStreamFrame(stream_id, false, 0u, quiche::QuicheStringPiece())));
+ QuicStreamFrame(stream_id, false, 0u, absl::string_view())));
}
SerializedPacket serialized = SerializeAllFrames(frames_);
EXPECT_EQ(level, serialized.encryption_level);
@@ -1296,7 +1295,7 @@
if (!QuicVersionUsesCryptoFrames(client_framer_.transport_version())) {
QuicStreamFrame stream_frame(
QuicUtils::GetCryptoStreamId(client_framer_.transport_version()),
- /*fin=*/false, 0u, quiche::QuicheStringPiece());
+ /*fin=*/false, 0u, absl::string_view());
frames_.push_back(QuicFrame(stream_frame));
} else {
producer_.SaveCryptoData(ENCRYPTION_INITIAL, 0, data);
@@ -1333,7 +1332,7 @@
if (!QuicVersionUsesCryptoFrames(client_framer_.transport_version())) {
QuicStreamFrame stream_frame(
QuicUtils::GetCryptoStreamId(client_framer_.transport_version()),
- /*fin=*/false, 0u, quiche::QuicheStringPiece());
+ /*fin=*/false, 0u, absl::string_view());
frames_.push_back(QuicFrame(stream_frame));
} else {
producer_.SaveCryptoData(ENCRYPTION_INITIAL, 0, data);
@@ -1556,7 +1555,7 @@
creator_.set_encryption_level(ENCRYPTION_INITIAL);
EXPECT_CALL(delegate_, OnUnrecoverableError(_, _));
QuicStreamFrame stream_frame(GetNthClientInitiatedStreamId(0),
- /*fin=*/false, 0u, quiche::QuicheStringPiece());
+ /*fin=*/false, 0u, absl::string_view());
EXPECT_QUIC_BUG(
creator_.AddFrame(QuicFrame(stream_frame), NOT_RETRANSMISSION),
"Cannot send stream data with level: ENCRYPTION_INITIAL");
@@ -1571,7 +1570,7 @@
creator_.set_encryption_level(ENCRYPTION_HANDSHAKE);
EXPECT_CALL(delegate_, OnUnrecoverableError(_, _));
QuicStreamFrame stream_frame(GetNthClientInitiatedStreamId(0),
- /*fin=*/false, 0u, quiche::QuicheStringPiece());
+ /*fin=*/false, 0u, absl::string_view());
EXPECT_QUIC_BUG(
creator_.AddFrame(QuicFrame(stream_frame), NOT_RETRANSMISSION),
"Cannot send stream data with level: ENCRYPTION_HANDSHAKE");
@@ -1598,9 +1597,8 @@
message_data = framer.ConstructHandshakeMessage(message);
struct iovec iov;
- MakeIOVector(
- quiche::QuicheStringPiece(message_data->data(), message_data->length()),
- &iov);
+ MakeIOVector(absl::string_view(message_data->data(), message_data->length()),
+ &iov);
QuicFrame frame;
EXPECT_CALL(delegate_, OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, _));
EXPECT_QUIC_BUG(
@@ -1677,7 +1675,7 @@
.WillRepeatedly(
Invoke(this, &QuicPacketCreatorTest::SaveSerializedPacket));
// Send stream frame of size kStreamFramePayloadSize.
- MakeIOVector(quiche::QuicheStringPiece(buf, kStreamFramePayloadSize), &iov_);
+ MakeIOVector(absl::string_view(buf, kStreamFramePayloadSize), &iov_);
creator_.ConsumeDataToFillCurrentPacket(stream_id, &iov_, 1u, iov_.iov_len,
0u, 0u, false, false,
NOT_RETRANSMISSION, &frame);
@@ -1685,8 +1683,7 @@
// 1 byte padding is sent.
EXPECT_EQ(pending_padding_bytes - 1, creator_.pending_padding_bytes());
// Send stream frame of size kStreamFramePayloadSize + 1.
- MakeIOVector(quiche::QuicheStringPiece(buf, kStreamFramePayloadSize + 1),
- &iov_);
+ MakeIOVector(absl::string_view(buf, kStreamFramePayloadSize + 1), &iov_);
creator_.ConsumeDataToFillCurrentPacket(stream_id, &iov_, 1u, iov_.iov_len,
0u, kStreamFramePayloadSize, false,
false, NOT_RETRANSMISSION, &frame);
@@ -1798,7 +1795,7 @@
creator_.SetMaxDatagramFrameSize(kMaxAcceptedDatagramFrameSize);
}
std::string message_data(kDefaultMaxPacketSize, 'a');
- quiche::QuicheStringPiece message_buffer(message_data);
+ absl::string_view message_buffer(message_data);
QuicMemSliceStorage storage(nullptr, 0, nullptr, 0);
// Test all possible encryption levels of message frames.
for (EncryptionLevel level :
@@ -1809,10 +1806,9 @@
message_size <= creator_.GetCurrentLargestMessagePayload();
++message_size) {
QuicMessageFrame* frame = new QuicMessageFrame(
- 0, MakeSpan(
- &allocator_,
- quiche::QuicheStringPiece(message_buffer.data(), message_size),
- &storage));
+ 0, MakeSpan(&allocator_,
+ absl::string_view(message_buffer.data(), message_size),
+ &storage));
EXPECT_TRUE(creator_.AddFrame(QuicFrame(frame), NOT_RETRANSMISSION));
EXPECT_TRUE(creator_.HasPendingFrames());
@@ -1938,7 +1934,7 @@
client_framer_.transport_version(), Perspective::IS_CLIENT);
QuicFrame stream_frame(QuicStreamFrame(stream_id,
/*fin=*/false, 0u,
- quiche::QuicheStringPiece()));
+ absl::string_view()));
ASSERT_TRUE(QuicUtils::IsRetransmittableFrame(stream_frame.type));
QuicFrame padding_frame{QuicPaddingFrame()};
@@ -1979,7 +1975,7 @@
if (!QuicVersionUsesCryptoFrames(client_framer_.transport_version())) {
QuicStreamFrame stream_frame(
QuicUtils::GetCryptoStreamId(client_framer_.transport_version()),
- /*fin=*/false, 0u, quiche::QuicheStringPiece());
+ /*fin=*/false, 0u, absl::string_view());
frames_.push_back(QuicFrame(stream_frame));
} else {
producer_.SaveCryptoData(ENCRYPTION_INITIAL, 0, data);
@@ -2146,8 +2142,8 @@
QuicAckFrame ack_frame(InitAckFrame(1));
frames_.push_back(QuicFrame(&ack_frame));
if (level != ENCRYPTION_INITIAL && level != ENCRYPTION_HANDSHAKE) {
- frames_.push_back(QuicFrame(
- QuicStreamFrame(1, false, 0u, quiche::QuicheStringPiece())));
+ frames_.push_back(
+ QuicFrame(QuicStreamFrame(1, false, 0u, absl::string_view())));
}
SerializedPacket serialized = SerializeAllFrames(frames_);
EXPECT_EQ(level, serialized.encryption_level);
@@ -2420,7 +2416,7 @@
}
size_t ConsumeCryptoData(EncryptionLevel level,
- quiche::QuicheStringPiece data,
+ absl::string_view data,
QuicStreamOffset offset) {
producer_->SaveCryptoData(level, offset, data);
if (!has_ack() && delegate_->ShouldGeneratePacket(NO_RETRANSMITTABLE_DATA,
@@ -3576,7 +3572,7 @@
ConnectionCloseFrameLargerThanPacketSize) {
delegate_.SetCanWriteAnything();
char buf[2000] = {};
- quiche::QuicheStringPiece error_details(buf, 2000);
+ absl::string_view error_details(buf, 2000);
const QuicErrorCode kQuicErrorCode = QUIC_PACKET_WRITE_ERROR;
QuicConnectionCloseFrame* frame = new QuicConnectionCloseFrame(
@@ -3616,7 +3612,7 @@
EXPECT_CALL(delegate_, OnSerializedPacket(_))
.WillOnce(
Invoke(this, &QuicPacketCreatorMultiplePacketsTest::SavePacket));
- MakeIOVector(quiche::QuicheStringPiece(buf, kStreamFramePayloadSize), &iov_);
+ MakeIOVector(absl::string_view(buf, kStreamFramePayloadSize), &iov_);
QuicConsumedData consumed = creator_.ConsumeData(
kDataStreamId, &iov_, 1u, iov_.iov_len, 0, FIN_AND_PADDING);
creator_.Flush();
@@ -3659,7 +3655,7 @@
EXPECT_CALL(delegate_, OnSerializedPacket(_))
.WillRepeatedly(
Invoke(this, &QuicPacketCreatorMultiplePacketsTest::SavePacket));
- MakeIOVector(quiche::QuicheStringPiece(buf, kStreamFramePayloadSize), &iov_);
+ MakeIOVector(absl::string_view(buf, kStreamFramePayloadSize), &iov_);
QuicConsumedData consumed = creator_.ConsumeData(
kDataStreamId, &iov_, 1u, iov_.iov_len, 0, FIN_AND_PADDING);
creator_.Flush();
@@ -3714,11 +3710,11 @@
EXPECT_CALL(delegate_, OnSerializedPacket(_))
.WillRepeatedly(
Invoke(this, &QuicPacketCreatorMultiplePacketsTest::SavePacket));
- MakeIOVector(quiche::QuicheStringPiece(buf, kStreamFramePayloadSize), &iov_);
+ MakeIOVector(absl::string_view(buf, kStreamFramePayloadSize), &iov_);
QuicConsumedData consumed = creator_.ConsumeData(
kDataStreamId1, &iov_, 1u, iov_.iov_len, 0, FIN_AND_PADDING);
EXPECT_EQ(kStreamFramePayloadSize, consumed.bytes_consumed);
- MakeIOVector(quiche::QuicheStringPiece(buf, kStreamFramePayloadSize), &iov_);
+ MakeIOVector(absl::string_view(buf, kStreamFramePayloadSize), &iov_);
consumed = creator_.ConsumeData(kDataStreamId2, &iov_, 1u, iov_.iov_len, 0,
FIN_AND_PADDING);
EXPECT_EQ(kStreamFramePayloadSize, consumed.bytes_consumed);
diff --git a/quic/core/quic_packets.cc b/quic/core/quic_packets.cc
index f54cf00..0325909 100644
--- a/quic/core/quic_packets.cc
+++ b/quic/core/quic_packets.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_connection_id.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quic/core/quic_utils.h"
@@ -14,7 +15,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_string_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
namespace quic {
@@ -185,7 +185,7 @@
long_packet_type(INITIAL),
possible_stateless_reset_token(0),
retry_token_length_length(VARIABLE_LENGTH_INTEGER_LENGTH_0),
- retry_token(quiche::QuicheStringPiece()),
+ retry_token(absl::string_view()),
length_length(VARIABLE_LENGTH_INTEGER_LENGTH_0),
remaining_packet_length(0) {}
@@ -263,8 +263,8 @@
}
if (header.nonce != nullptr) {
os << ", diversification_nonce: "
- << quiche::QuicheTextUtils::HexEncode(quiche::QuicheStringPiece(
- header.nonce->data(), header.nonce->size()));
+ << quiche::QuicheTextUtils::HexEncode(
+ absl::string_view(header.nonce->data(), header.nonce->size()));
}
os << ", packet_number: " << header.packet_number << " }\n";
return os;
@@ -276,7 +276,7 @@
QuicData::QuicData(const char* buffer, size_t length, bool owns_buffer)
: buffer_(buffer), length_(length), owns_buffer_(owns_buffer) {}
-QuicData::QuicData(quiche::QuicheStringPiece packet_data)
+QuicData::QuicData(absl::string_view packet_data)
: buffer_(packet_data.data()),
length_(packet_data.length()),
owns_buffer_(false) {}
@@ -335,7 +335,7 @@
bool owns_buffer)
: QuicData(buffer, length, owns_buffer) {}
-QuicEncryptedPacket::QuicEncryptedPacket(quiche::QuicheStringPiece data)
+QuicEncryptedPacket::QuicEncryptedPacket(absl::string_view data)
: QuicData(data) {}
std::unique_ptr<QuicEncryptedPacket> QuicEncryptedPacket::Clone() const {
@@ -426,9 +426,9 @@
return os;
}
-quiche::QuicheStringPiece QuicPacket::AssociatedData(
+absl::string_view QuicPacket::AssociatedData(
QuicTransportVersion version) const {
- return quiche::QuicheStringPiece(
+ return absl::string_view(
data(),
GetStartOfEncryptedData(version, destination_connection_id_length_,
source_connection_id_length_, includes_version_,
@@ -437,14 +437,13 @@
retry_token_length_, length_length_));
}
-quiche::QuicheStringPiece QuicPacket::Plaintext(
- QuicTransportVersion version) const {
+absl::string_view QuicPacket::Plaintext(QuicTransportVersion version) const {
const size_t start_of_encrypted_data = GetStartOfEncryptedData(
version, destination_connection_id_length_, source_connection_id_length_,
includes_version_, includes_diversification_nonce_, packet_number_length_,
retry_token_length_length_, retry_token_length_, length_length_);
- return quiche::QuicheStringPiece(data() + start_of_encrypted_data,
- length() - start_of_encrypted_data);
+ return absl::string_view(data() + start_of_encrypted_data,
+ length() - start_of_encrypted_data);
}
SerializedPacket::SerializedPacket(QuicPacketNumber packet_number,
diff --git a/quic/core/quic_packets.h b/quic/core/quic_packets.h
index e9c811c..8cf7305 100644
--- a/quic/core/quic_packets.h
+++ b/quic/core/quic_packets.h
@@ -14,6 +14,7 @@
#include <utility>
#include <vector>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/frames/quic_frame.h"
#include "net/third_party/quiche/src/quic/core/quic_ack_listener_interface.h"
#include "net/third_party/quiche/src/quic/core/quic_bandwidth.h"
@@ -25,7 +26,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_uint128.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -160,7 +160,7 @@
// carried only by v99 IETF Initial packets.
QuicVariableLengthIntegerLength retry_token_length_length;
// Retry token, carried only by v99 IETF Initial packets.
- quiche::QuicheStringPiece retry_token;
+ absl::string_view retry_token;
// Length of the length variable length integer field,
// carried only by v99 IETF Initial, 0-RTT and Handshake packets.
QuicVariableLengthIntegerLength length_length;
@@ -211,15 +211,15 @@
// Creates a QuicData from a buffer and length,
// optionally taking ownership of the buffer.
QuicData(const char* buffer, size_t length, bool owns_buffer);
- // Creates a QuicData from a quiche::QuicheStringPiece. Does not own the
+ // Creates a QuicData from a absl::string_view. Does not own the
// buffer.
- QuicData(quiche::QuicheStringPiece data);
+ QuicData(absl::string_view data);
QuicData(const QuicData&) = delete;
QuicData& operator=(const QuicData&) = delete;
virtual ~QuicData();
- quiche::QuicheStringPiece AsStringPiece() const {
- return quiche::QuicheStringPiece(data(), length());
+ absl::string_view AsStringPiece() const {
+ return absl::string_view(data(), length());
}
const char* data() const { return buffer_; }
@@ -252,8 +252,8 @@
QuicPacket(const QuicPacket&) = delete;
QuicPacket& operator=(const QuicPacket&) = delete;
- quiche::QuicheStringPiece AssociatedData(QuicTransportVersion version) const;
- quiche::QuicheStringPiece Plaintext(QuicTransportVersion version) const;
+ absl::string_view AssociatedData(QuicTransportVersion version) const;
+ absl::string_view Plaintext(QuicTransportVersion version) const;
char* mutable_data() { return buffer_; }
@@ -277,9 +277,9 @@
// Creates a QuicEncryptedPacket from a buffer and length,
// optionally taking ownership of the buffer.
QuicEncryptedPacket(const char* buffer, size_t length, bool owns_buffer);
- // Creates a QuicEncryptedPacket from a quiche::QuicheStringPiece.
+ // Creates a QuicEncryptedPacket from a absl::string_view.
// Does not own the buffer.
- QuicEncryptedPacket(quiche::QuicheStringPiece data);
+ QuicEncryptedPacket(absl::string_view data);
QuicEncryptedPacket(const QuicEncryptedPacket&) = delete;
QuicEncryptedPacket& operator=(const QuicEncryptedPacket&) = delete;
diff --git a/quic/core/quic_sent_packet_manager_test.cc b/quic/core/quic_sent_packet_manager_test.cc
index c186f65..ef651a7 100644
--- a/quic/core/quic_sent_packet_manager_test.cc
+++ b/quic/core/quic_sent_packet_manager_test.cc
@@ -7,6 +7,7 @@
#include <memory>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/frames/quic_ack_frequency_frame.h"
#include "net/third_party/quiche/src/quic/core/quic_time.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_expect_bug.h"
@@ -16,7 +17,6 @@
#include "net/third_party/quiche/src/quic/test_tools/quic_sent_packet_manager_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
using testing::_;
using testing::AnyNumber;
@@ -68,7 +68,7 @@
kDefaultLength, HAS_RETRANSMITTABLE_DATA));
SerializedPacket packet(CreatePacket(packet_number, false));
packet.retransmittable_frames.push_back(
- QuicFrame(QuicStreamFrame(1, false, 0, quiche::QuicheStringPiece())));
+ QuicFrame(QuicStreamFrame(1, false, 0, absl::string_view())));
packet.has_crypto_handshake = IS_HANDSHAKE;
manager_.OnPacketSent(&packet, clock_.Now(), HANDSHAKE_RETRANSMISSION,
HAS_RETRANSMITTABLE_DATA, true);
@@ -252,8 +252,8 @@
PACKET_4BYTE_PACKET_NUMBER, nullptr, kDefaultLength,
false, false);
if (retransmittable) {
- packet.retransmittable_frames.push_back(QuicFrame(
- QuicStreamFrame(kStreamId, false, 0, quiche::QuicheStringPiece())));
+ packet.retransmittable_frames.push_back(
+ QuicFrame(QuicStreamFrame(kStreamId, false, 0, absl::string_view())));
}
return packet;
}
@@ -299,7 +299,7 @@
kDefaultLength, HAS_RETRANSMITTABLE_DATA));
SerializedPacket packet(CreatePacket(packet_number, false));
packet.retransmittable_frames.push_back(
- QuicFrame(QuicStreamFrame(1, false, 0, quiche::QuicheStringPiece())));
+ QuicFrame(QuicStreamFrame(1, false, 0, absl::string_view())));
packet.has_crypto_handshake = IS_HANDSHAKE;
manager_.OnPacketSent(&packet, clock_.Now(), NOT_RETRANSMISSION,
HAS_RETRANSMITTABLE_DATA, true);
@@ -3091,7 +3091,7 @@
}
QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2);
// Send SHLO.
- QuicStreamFrame crypto_frame(1, false, 0, quiche::QuicheStringPiece());
+ QuicStreamFrame crypto_frame(1, false, 0, absl::string_view());
SendCryptoPacket(1);
// Send data packet.
SendDataPacket(2, ENCRYPTION_FORWARD_SECURE);
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc
index 178ddf3..e28db59 100644
--- a/quic/core/quic_session.cc
+++ b/quic/core/quic_session.cc
@@ -8,6 +8,7 @@
#include <string>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_connection.h"
#include "net/third_party/quiche/src/quic/core/quic_error_codes.h"
#include "net/third_party/quiche/src/quic/core/quic_flow_controller.h"
@@ -23,7 +24,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_server_stats.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_stack_trace.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"
using spdy::SpdyPriority;
@@ -343,7 +343,7 @@
transport_goaway_received_ = true;
}
-void QuicSession::OnMessageReceived(quiche::QuicheStringPiece message) {
+void QuicSession::OnMessageReceived(absl::string_view message) {
QUIC_DVLOG(1) << ENDPOINT << "Received message, length: " << message.length()
<< ", " << message;
}
@@ -2391,13 +2391,13 @@
return stream_id_manager_.max_open_incoming_streams();
}
-std::vector<quiche::QuicheStringPiece>::const_iterator QuicSession::SelectAlpn(
- const std::vector<quiche::QuicheStringPiece>& alpns) const {
+std::vector<absl::string_view>::const_iterator QuicSession::SelectAlpn(
+ const std::vector<absl::string_view>& alpns) const {
const std::string alpn = AlpnForVersion(connection()->version());
return std::find(alpns.cbegin(), alpns.cend(), alpn);
}
-void QuicSession::OnAlpnSelected(quiche::QuicheStringPiece alpn) {
+void QuicSession::OnAlpnSelected(absl::string_view alpn) {
QUIC_DLOG(INFO) << (perspective() == Perspective::IS_SERVER ? "Server: "
: "Client: ")
<< "ALPN selected: " << alpn;
diff --git a/quic/core/quic_session.h b/quic/core/quic_session.h
index e5a0f5c..a3a982b 100644
--- a/quic/core/quic_session.h
+++ b/quic/core/quic_session.h
@@ -14,6 +14,7 @@
#include <string>
#include <vector>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/handshaker_delegate_interface.h"
#include "net/third_party/quiche/src/quic/core/legacy_quic_stream_id_manager.h"
#include "net/third_party/quiche/src/quic/core/quic_connection.h"
@@ -34,7 +35,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -98,7 +98,7 @@
void OnCryptoFrame(const QuicCryptoFrame& frame) override;
void OnRstStream(const QuicRstStreamFrame& frame) override;
void OnGoAway(const QuicGoAwayFrame& frame) override;
- void OnMessageReceived(quiche::QuicheStringPiece message) override;
+ void OnMessageReceived(absl::string_view message) override;
void OnHandshakeDoneReceived() override;
void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) override;
void OnBlockedFrame(const QuicBlockedFrame& frame) override;
@@ -449,12 +449,12 @@
// Provided a list of ALPNs offered by the client, selects an ALPN from the
// list, or alpns.end() if none of the ALPNs are acceptable.
- virtual std::vector<quiche::QuicheStringPiece>::const_iterator SelectAlpn(
- const std::vector<quiche::QuicheStringPiece>& alpns) const;
+ virtual std::vector<absl::string_view>::const_iterator SelectAlpn(
+ const std::vector<absl::string_view>& alpns) const;
// Called when the ALPN of the connection is established for a connection that
// uses TLS handshake.
- virtual void OnAlpnSelected(quiche::QuicheStringPiece alpn);
+ virtual void OnAlpnSelected(absl::string_view alpn);
// Called on clients by the crypto handshaker to provide application state
// necessary for sending application data in 0-RTT. The state provided here is
diff --git a/quic/core/quic_session_test.cc b/quic/core/quic_session_test.cc
index 4c611d1..b2c5b1f 100644
--- a/quic/core/quic_session_test.cc
+++ b/quic/core/quic_session_test.cc
@@ -9,6 +9,7 @@
#include <string>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_protocol.h"
#include "net/third_party/quiche/src/quic/core/crypto/null_decrypter.h"
#include "net/third_party/quiche/src/quic/core/crypto/null_encrypter.h"
@@ -40,7 +41,6 @@
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
using spdy::kV3HighestPriority;
using spdy::SpdyPriority;
@@ -1561,8 +1561,7 @@
/*is_static*/ true, BIDIRECTIONAL);
QuicSessionPeer::ActivateStream(&session_, std::move(fake_headers_stream));
// Send two bytes of payload.
- QuicStreamFrame data1(headers_stream_id, true, 0,
- quiche::QuicheStringPiece("HT"));
+ QuicStreamFrame data1(headers_stream_id, true, 0, absl::string_view("HT"));
EXPECT_CALL(*connection_,
CloseConnection(
QUIC_INVALID_STREAM_ID, "Attempt to close a static stream",
@@ -1574,7 +1573,7 @@
// Send two bytes of payload.
QuicStreamFrame data1(
QuicUtils::GetInvalidStreamId(connection_->transport_version()), true, 0,
- quiche::QuicheStringPiece("HT"));
+ absl::string_view("HT"));
EXPECT_CALL(*connection_,
CloseConnection(
QUIC_INVALID_STREAM_ID, "Received data for an invalid stream",
@@ -1763,7 +1762,7 @@
const QuicStreamOffset kByteOffset = 5678;
std::string body = "hello";
QuicStreamFrame frame(stream->id(), true, kByteOffset,
- quiche::QuicheStringPiece(body));
+ absl::string_view(body));
session_.OnStreamFrame(frame);
QuicStreamOffset total_stream_bytes_sent_by_peer =
@@ -1853,8 +1852,7 @@
EXPECT_CALL(*connection_, SendControlFrame(_));
EXPECT_CALL(*connection_, OnStreamReset(stream->id(), _));
stream->Reset(QUIC_STREAM_CANCELLED);
- QuicStreamFrame frame(stream->id(), true, kLargeOffset,
- quiche::QuicheStringPiece());
+ QuicStreamFrame frame(stream->id(), true, kLargeOffset, absl::string_view());
session_.OnStreamFrame(frame);
// Check that RST results in connection close.
@@ -1881,7 +1879,7 @@
// FIN or a RST_STREAM from the client.
for (QuicStreamId i = kFirstStreamId; i < kFinalStreamId;
i += QuicUtils::StreamIdDelta(connection_->transport_version())) {
- QuicStreamFrame data1(i, false, 0, quiche::QuicheStringPiece("HT"));
+ QuicStreamFrame data1(i, false, 0, absl::string_view("HT"));
session_.OnStreamFrame(data1);
CloseStream(i);
}
@@ -1898,8 +1896,7 @@
.Times(1);
}
// Create one more data streams to exceed limit of open stream.
- QuicStreamFrame data1(kFinalStreamId, false, 0,
- quiche::QuicheStringPiece("HT"));
+ QuicStreamFrame data1(kFinalStreamId, false, 0, absl::string_view("HT"));
session_.OnStreamFrame(data1);
}
@@ -1909,7 +1906,7 @@
// protocol point of view).
TestStream* stream = session_.CreateOutgoingBidirectionalStream();
QuicStreamId stream_id = stream->id();
- QuicStreamFrame data1(stream_id, true, 0, quiche::QuicheStringPiece("HT"));
+ QuicStreamFrame data1(stream_id, true, 0, absl::string_view("HT"));
session_.OnStreamFrame(data1);
EXPECT_CALL(session_, OnCanCreateNewOutgoingStream(false)).Times(1);
session_.StreamDraining(stream_id, /*unidirectional=*/false);
@@ -1920,11 +1917,11 @@
QuicStreamId stream_id = QuicUtils::GetFirstUnidirectionalStreamId(
transport_version(), Perspective::IS_CLIENT);
- QuicStreamFrame data1(stream_id, true, 10, quiche::QuicheStringPiece("HT"));
+ QuicStreamFrame data1(stream_id, true, 10, absl::string_view("HT"));
session_.OnStreamFrame(data1);
EXPECT_EQ(1, session_.num_incoming_streams_created());
- QuicStreamFrame data2(stream_id, false, 0, quiche::QuicheStringPiece("HT"));
+ QuicStreamFrame data2(stream_id, false, 0, absl::string_view("HT"));
session_.OnStreamFrame(data2);
EXPECT_EQ(1, session_.num_incoming_streams_created());
}
@@ -1937,12 +1934,12 @@
QuicStreamId stream_id = QuicUtils::GetFirstUnidirectionalStreamId(
transport_version(), Perspective::IS_CLIENT);
- QuicStreamFrame data1(stream_id, true, 10, quiche::QuicheStringPiece("HT"));
+ QuicStreamFrame data1(stream_id, true, 10, absl::string_view("HT"));
session_.OnStreamFrame(data1);
EXPECT_TRUE(QuicSessionPeer::GetPendingStream(&session_, stream_id));
EXPECT_EQ(0, session_.num_incoming_streams_created());
- QuicStreamFrame data2(stream_id, false, 0, quiche::QuicheStringPiece("HT"));
+ QuicStreamFrame data2(stream_id, false, 0, absl::string_view("HT"));
session_.OnStreamFrame(data2);
EXPECT_FALSE(QuicSessionPeer::GetPendingStream(&session_, stream_id));
EXPECT_EQ(1, session_.num_incoming_streams_created());
@@ -1956,7 +1953,7 @@
QuicStreamId stream_id = QuicUtils::GetFirstUnidirectionalStreamId(
transport_version(), Perspective::IS_CLIENT);
- QuicStreamFrame data1(stream_id, true, 10, quiche::QuicheStringPiece("HT"));
+ QuicStreamFrame data1(stream_id, true, 10, absl::string_view("HT"));
session_.OnStreamFrame(data1);
EXPECT_TRUE(QuicSessionPeer::GetPendingStream(&session_, stream_id));
EXPECT_EQ(0, session_.num_incoming_streams_created());
@@ -1969,7 +1966,7 @@
EXPECT_EQ(0, session_.num_incoming_streams_created());
EXPECT_EQ(0u, QuicSessionPeer::GetNumOpenDynamicStreams(&session_));
- QuicStreamFrame data2(stream_id, false, 0, quiche::QuicheStringPiece("HT"));
+ QuicStreamFrame data2(stream_id, false, 0, absl::string_view("HT"));
session_.OnStreamFrame(data2);
EXPECT_FALSE(QuicSessionPeer::GetPendingStream(&session_, stream_id));
EXPECT_EQ(0, session_.num_incoming_streams_created());
@@ -2000,7 +1997,7 @@
session_.set_uses_pending_streams(true);
QuicStreamId stream_id = QuicUtils::GetFirstUnidirectionalStreamId(
transport_version(), Perspective::IS_CLIENT);
- QuicStreamFrame data1(stream_id, true, 10, quiche::QuicheStringPiece("HT"));
+ QuicStreamFrame data1(stream_id, true, 10, absl::string_view("HT"));
session_.OnStreamFrame(data1);
EXPECT_TRUE(QuicSessionPeer::GetPendingStream(&session_, stream_id));
EXPECT_EQ(0, session_.num_incoming_streams_created());
@@ -2040,7 +2037,7 @@
GetNthClientInitiatedBidirectionalId(2 * kMaxStreams + 1);
for (QuicStreamId i = kFirstStreamId; i < kFinalStreamId;
i += QuicUtils::StreamIdDelta(connection_->transport_version())) {
- QuicStreamFrame data1(i, true, 0, quiche::QuicheStringPiece("HT"));
+ QuicStreamFrame data1(i, true, 0, absl::string_view("HT"));
session_.OnStreamFrame(data1);
EXPECT_EQ(1u, QuicSessionPeer::GetNumOpenDynamicStreams(&session_));
session_.StreamDraining(i, /*unidirectional=*/false);
@@ -2184,7 +2181,7 @@
QuicStreamPeer::CloseReadSide(stream);
// Receive a stream data frame with FIN.
- QuicStreamFrame frame(stream_id, true, 0, quiche::QuicheStringPiece());
+ QuicStreamFrame frame(stream_id, true, 0, absl::string_view());
session_.OnStreamFrame(frame);
EXPECT_TRUE(stream->fin_received());
@@ -2217,7 +2214,7 @@
QuicStreamFrame frame(GetNthClientInitiatedBidirectionalId(1),
/* fin = */ false, /* offset = */ 0,
- quiche::QuicheStringPiece("foo"));
+ absl::string_view("foo"));
session_.OnStreamFrame(frame);
}
@@ -2540,7 +2537,7 @@
session_.GetMutableCryptoStream()->OnHandshakeMessage(handshake_message);
EXPECT_TRUE(session_.OneRttKeysAvailable());
- quiche::QuicheStringPiece message;
+ absl::string_view message;
EXPECT_CALL(*connection_, SendMessage(1, _, false))
.WillOnce(Return(MESSAGE_STATUS_SUCCESS));
EXPECT_EQ(MessageResult(MESSAGE_STATUS_SUCCESS, 1),
@@ -3043,7 +3040,7 @@
QuicStreamFrame frame(GetNthServerInitiatedBidirectionalId(1),
/* fin = */ false, /* offset = */ 0,
- quiche::QuicheStringPiece("foo"));
+ absl::string_view("foo"));
session_.OnStreamFrame(frame);
}
diff --git a/quic/core/quic_stream.cc b/quic/core/quic_stream.cc
index 1ad8d37..b6d2cfd 100644
--- a/quic/core/quic_stream.cc
+++ b/quic/core/quic_stream.cc
@@ -7,6 +7,7 @@
#include <limits>
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_error_codes.h"
#include "net/third_party/quiche/src/quic/core/quic_flow_controller.h"
#include "net/third_party/quiche/src/quic/core/quic_session.h"
@@ -18,7 +19,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
using quiche::QuicheOptional;
using spdy::SpdyPriority;
@@ -623,7 +623,7 @@
}
void QuicStream::WriteOrBufferData(
- quiche::QuicheStringPiece data,
+ absl::string_view data,
bool fin,
QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) {
if (data.empty() && !fin) {
diff --git a/quic/core/quic_stream.h b/quic/core/quic_stream.h
index f0a5a71..70e6e98 100644
--- a/quic/core/quic_stream.h
+++ b/quic/core/quic_stream.h
@@ -22,6 +22,7 @@
#include <list>
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_flow_controller.h"
#include "net/third_party/quiche/src/quic/core/quic_packets.h"
#include "net/third_party/quiche/src/quic/core/quic_stream_send_buffer.h"
@@ -33,7 +34,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_mem_slice_span.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_reference_counted.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
namespace quic {
@@ -279,7 +279,7 @@
// If fin is true: if it is immediately passed on to the session,
// write_side_closed() becomes true, otherwise fin_buffered_ becomes true.
void WriteOrBufferData(
- quiche::QuicheStringPiece data,
+ absl::string_view data,
bool fin,
QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener);
diff --git a/quic/core/quic_stream_send_buffer_test.cc b/quic/core/quic_stream_send_buffer_test.cc
index 6232887..0d5471e 100644
--- a/quic/core/quic_stream_send_buffer_test.cc
+++ b/quic/core/quic_stream_send_buffer_test.cc
@@ -6,6 +6,7 @@
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_data_writer.h"
#include "net/third_party/quiche/src/quic/core/quic_simple_buffer_allocator.h"
#include "net/third_party/quiche/src/quic/core/quic_utils.h"
@@ -15,13 +16,12 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_test_mem_slice_vector.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_stream_send_buffer_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
namespace test {
namespace {
-struct iovec MakeIovec(quiche::QuicheStringPiece data) {
+struct iovec MakeIovec(absl::string_view data) {
struct iovec iov = {const_cast<char*>(data.data()),
static_cast<size_t>(data.size())};
return iov;
@@ -36,8 +36,8 @@
std::string data1(1536, 'a');
std::string data2 = std::string(256, 'b') + std::string(256, 'c');
struct iovec iov[2];
- iov[0] = MakeIovec(quiche::QuicheStringPiece(data1));
- iov[1] = MakeIovec(quiche::QuicheStringPiece(data2));
+ iov[0] = MakeIovec(absl::string_view(data1));
+ iov[1] = MakeIovec(absl::string_view(data2));
QuicUniqueBufferPtr buffer1 = MakeUniqueBuffer(&allocator_, 1024);
memset(buffer1.get(), 'c', 1024);
@@ -88,23 +88,23 @@
std::string copy4(768, 'd');
ASSERT_TRUE(send_buffer_.WriteStreamData(0, 1024, &writer));
- EXPECT_EQ(copy1, quiche::QuicheStringPiece(buf, 1024));
+ EXPECT_EQ(copy1, absl::string_view(buf, 1024));
ASSERT_TRUE(send_buffer_.WriteStreamData(1024, 1024, &writer));
- EXPECT_EQ(copy2, quiche::QuicheStringPiece(buf + 1024, 1024));
+ EXPECT_EQ(copy2, absl::string_view(buf + 1024, 1024));
ASSERT_TRUE(send_buffer_.WriteStreamData(2048, 1024, &writer));
- EXPECT_EQ(copy3, quiche::QuicheStringPiece(buf + 2048, 1024));
+ EXPECT_EQ(copy3, absl::string_view(buf + 2048, 1024));
ASSERT_TRUE(send_buffer_.WriteStreamData(3072, 768, &writer));
- EXPECT_EQ(copy4, quiche::QuicheStringPiece(buf + 3072, 768));
+ EXPECT_EQ(copy4, absl::string_view(buf + 3072, 768));
// Test data piece across boundries.
QuicDataWriter writer2(4000, buf, quiche::HOST_BYTE_ORDER);
std::string copy5 =
std::string(536, 'a') + std::string(256, 'b') + std::string(232, 'c');
ASSERT_TRUE(send_buffer_.WriteStreamData(1000, 1024, &writer2));
- EXPECT_EQ(copy5, quiche::QuicheStringPiece(buf, 1024));
+ EXPECT_EQ(copy5, absl::string_view(buf, 1024));
ASSERT_TRUE(send_buffer_.WriteStreamData(2500, 1024, &writer2));
std::string copy6 = std::string(572, 'c') + std::string(452, 'd');
- EXPECT_EQ(copy6, quiche::QuicheStringPiece(buf + 1024, 1024));
+ EXPECT_EQ(copy6, absl::string_view(buf + 1024, 1024));
// Invalid data copy.
QuicDataWriter writer3(4000, buf, quiche::HOST_BYTE_ORDER);
@@ -129,21 +129,20 @@
// Write more than one slice.
EXPECT_EQ(0, QuicStreamSendBufferPeer::write_index(&send_buffer_));
ASSERT_TRUE(send_buffer_.WriteStreamData(0, 1024, &writer));
- EXPECT_EQ(copy1, quiche::QuicheStringPiece(buf, 1024));
+ EXPECT_EQ(copy1, absl::string_view(buf, 1024));
EXPECT_EQ(1, QuicStreamSendBufferPeer::write_index(&send_buffer_));
// Retransmit the first frame and also send new data.
ASSERT_TRUE(send_buffer_.WriteStreamData(0, 2048, &writer));
- EXPECT_EQ(copy1 + copy2, quiche::QuicheStringPiece(buf + 1024, 2048));
+ EXPECT_EQ(copy1 + copy2, absl::string_view(buf + 1024, 2048));
// Write new data.
EXPECT_EQ(2048u, QuicStreamSendBufferPeer::EndOffset(&send_buffer_));
ASSERT_TRUE(send_buffer_.WriteStreamData(2048, 50, &writer));
- EXPECT_EQ(std::string(50, 'c'),
- quiche::QuicheStringPiece(buf + 1024 + 2048, 50));
+ EXPECT_EQ(std::string(50, 'c'), absl::string_view(buf + 1024 + 2048, 50));
EXPECT_EQ(3072u, QuicStreamSendBufferPeer::EndOffset(&send_buffer_));
ASSERT_TRUE(send_buffer_.WriteStreamData(2048, 1124, &writer));
- EXPECT_EQ(copy3, quiche::QuicheStringPiece(buf + 1024 + 2048 + 50, 1124));
+ EXPECT_EQ(copy3, absl::string_view(buf + 1024 + 2048 + 50, 1124));
EXPECT_EQ(3840u, QuicStreamSendBufferPeer::EndOffset(&send_buffer_));
}
diff --git a/quic/core/quic_stream_sequencer.cc b/quic/core/quic_stream_sequencer.cc
index 0dfc8f7..7d1c237 100644
--- a/quic/core/quic_stream_sequencer.cc
+++ b/quic/core/quic_stream_sequencer.cc
@@ -10,6 +10,7 @@
#include <string>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_clock.h"
#include "net/third_party/quiche/src/quic/core/quic_error_codes.h"
#include "net/third_party/quiche/src/quic/core/quic_packets.h"
@@ -22,7 +23,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -65,8 +65,8 @@
size_t bytes_written;
std::string error_details;
QuicErrorCode result = buffered_frames_.OnStreamData(
- byte_offset, quiche::QuicheStringPiece(data_buffer, data_len),
- &bytes_written, &error_details);
+ byte_offset, absl::string_view(data_buffer, data_len), &bytes_written,
+ &error_details);
if (result != QUIC_NO_ERROR) {
std::string details = quiche::QuicheStrCat("Stream ", stream_->id(), ": ",
QuicErrorCodeToString(result),
diff --git a/quic/core/quic_stream_sequencer_buffer.cc b/quic/core/quic_stream_sequencer_buffer.cc
index 8a26521..b4143ef 100644
--- a/quic/core/quic_stream_sequencer_buffer.cc
+++ b/quic/core/quic_stream_sequencer_buffer.cc
@@ -6,6 +6,7 @@
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_constants.h"
#include "net/third_party/quiche/src/quic/core/quic_interval.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h"
@@ -13,7 +14,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
namespace {
@@ -68,7 +68,7 @@
QuicErrorCode QuicStreamSequencerBuffer::OnStreamData(
QuicStreamOffset starting_offset,
- quiche::QuicheStringPiece data,
+ absl::string_view data,
size_t* const bytes_buffered,
std::string* error_details) {
*bytes_buffered = 0;
@@ -135,7 +135,7 @@
}
bool QuicStreamSequencerBuffer::CopyStreamData(QuicStreamOffset offset,
- quiche::QuicheStringPiece data,
+ absl::string_view data,
size_t* bytes_copy,
std::string* error_details) {
*bytes_copy = 0;
diff --git a/quic/core/quic_stream_sequencer_buffer.h b/quic/core/quic_stream_sequencer_buffer.h
index 0ad9841..98ffa9c 100644
--- a/quic/core/quic_stream_sequencer_buffer.h
+++ b/quic/core/quic_stream_sequencer_buffer.h
@@ -28,11 +28,11 @@
// Expected Use:
// QuicStreamSequencerBuffer buffer(2.5 * 8 * 1024);
// std::string source(1024, 'a');
-// quiche::QuicheStringPiece string_piece(source.data(), source.size());
+// absl::string_view string_piece(source.data(), source.size());
// size_t written = 0;
// buffer.OnStreamData(800, string_piece, GetEpollClockNow(), &written);
// source = std::string{800, 'b'};
-// quiche::QuicheStringPiece string_piece1(source.data(), 800);
+// absl::string_view string_piece1(source.data(), 800);
// // Try to write to [1, 801), but should fail due to overlapping,
// // res should be QUIC_INVALID_STREAM_DATA
// auto res = buffer.OnStreamData(1, string_piece1, &written));
@@ -64,12 +64,12 @@
#include <memory>
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_interval_set.h"
#include "net/third_party/quiche/src/quic/core/quic_packets.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/quic/platform/api/quic_iovec.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -107,7 +107,7 @@
// successfully buffered, returns QUIC_NO_ERROR and stores the number of
// bytes buffered in |bytes_buffered|. Returns an error otherwise.
QuicErrorCode OnStreamData(QuicStreamOffset offset,
- quiche::QuicheStringPiece data,
+ absl::string_view data,
size_t* bytes_buffered,
std::string* error_details);
@@ -168,7 +168,7 @@
// Copies |data| to blocks_, sets |bytes_copy|. Returns true if the copy is
// successful. Otherwise, sets |error_details| and returns false.
bool CopyStreamData(QuicStreamOffset offset,
- quiche::QuicheStringPiece data,
+ absl::string_view data,
size_t* bytes_copy,
std::string* error_details);
diff --git a/quic/core/quic_stream_sequencer_buffer_test.cc b/quic/core/quic_stream_sequencer_buffer_test.cc
index 7341983..f12810b 100644
--- a/quic/core/quic_stream_sequencer_buffer_test.cc
+++ b/quic/core/quic_stream_sequencer_buffer_test.cc
@@ -11,20 +11,20 @@
#include <string>
#include <utility>
+#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/quic_stream_sequencer_buffer_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
namespace test {
-quiche::QuicheStringPiece IovecToStringPiece(iovec iov) {
- return quiche::QuicheStringPiece(reinterpret_cast<const char*>(iov.iov_base),
- iov.iov_len);
+absl::string_view IovecToStringPiece(iovec iov) {
+ return absl::string_view(reinterpret_cast<const char*>(iov.iov_base),
+ iov.iov_len);
}
char GetCharFromIOVecs(size_t offset, iovec iov[], size_t count) {
@@ -159,8 +159,8 @@
TEST_F(QuicStreamSequencerBufferTest, OnStreamDataInvalidSource) {
// Pass in an invalid source, expects to return error.
- quiche::QuicheStringPiece source;
- source = quiche::QuicheStringPiece(nullptr, 1024);
+ absl::string_view source;
+ source = absl::string_view(nullptr, 1024);
EXPECT_THAT(buffer_->OnStreamData(800, source, &written_, &error_details_),
IsError(QUIC_STREAM_SEQUENCER_INVALID_STATE));
EXPECT_EQ(0u, error_details_.find(quiche::QuicheStrCat(
@@ -320,7 +320,7 @@
QUIC_LOG(ERROR) << error_details_;
EXPECT_EQ(100u, read);
EXPECT_EQ(100u, buffer_->BytesConsumed());
- EXPECT_EQ(source, quiche::QuicheStringPiece(dest, read));
+ EXPECT_EQ(source, absl::string_view(dest, read));
// The first block should be released as its data has been read out.
EXPECT_EQ(nullptr, helper_->GetBlock(0));
EXPECT_TRUE(helper_->CheckBufferInvariants());
@@ -610,8 +610,7 @@
// Peek at a different offset.
EXPECT_TRUE(buffer_->PeekRegion(100, &iov));
- EXPECT_EQ(quiche::QuicheStringPiece(source).substr(100),
- IovecToStringPiece(iov));
+ EXPECT_EQ(absl::string_view(source).substr(100), IovecToStringPiece(iov));
// Peeking at or after FirstMissingByte() returns false.
EXPECT_FALSE(buffer_->PeekRegion(kBlockSizeBytes, &iov));
@@ -638,15 +637,15 @@
// Peek with an offset inside the first write.
const QuicStreamOffset offset1 = 500;
EXPECT_TRUE(buffer_->PeekRegion(offset1, &iov));
- EXPECT_EQ(quiche::QuicheStringPiece(source1).substr(offset1),
+ EXPECT_EQ(absl::string_view(source1).substr(offset1),
IovecToStringPiece(iov).substr(0, length1 - offset1));
- EXPECT_EQ(quiche::QuicheStringPiece(source2),
+ EXPECT_EQ(absl::string_view(source2),
IovecToStringPiece(iov).substr(length1 - offset1));
// Peek with an offset inside the second write.
const QuicStreamOffset offset2 = 1500;
EXPECT_TRUE(buffer_->PeekRegion(offset2, &iov));
- EXPECT_EQ(quiche::QuicheStringPiece(source2).substr(offset2 - length1),
+ EXPECT_EQ(absl::string_view(source2).substr(offset2 - length1),
IovecToStringPiece(iov));
// Peeking at or after FirstMissingByte() returns false.
@@ -671,19 +670,16 @@
EXPECT_TRUE(buffer_->PeekRegion(0, &iov));
EXPECT_EQ(kBlockSizeBytes, iov.iov_len);
EXPECT_EQ(source1, IovecToStringPiece(iov).substr(0, length1));
- EXPECT_EQ(
- quiche::QuicheStringPiece(source2).substr(0, kBlockSizeBytes - length1),
- IovecToStringPiece(iov).substr(length1));
+ EXPECT_EQ(absl::string_view(source2).substr(0, kBlockSizeBytes - length1),
+ IovecToStringPiece(iov).substr(length1));
EXPECT_TRUE(buffer_->PeekRegion(length1, &iov));
- EXPECT_EQ(
- quiche::QuicheStringPiece(source2).substr(0, kBlockSizeBytes - length1),
- IovecToStringPiece(iov));
+ EXPECT_EQ(absl::string_view(source2).substr(0, kBlockSizeBytes - length1),
+ IovecToStringPiece(iov));
EXPECT_TRUE(buffer_->PeekRegion(kBlockSizeBytes, &iov));
- EXPECT_EQ(
- quiche::QuicheStringPiece(source2).substr(kBlockSizeBytes - length1),
- IovecToStringPiece(iov));
+ EXPECT_EQ(absl::string_view(source2).substr(kBlockSizeBytes - length1),
+ IovecToStringPiece(iov));
// Peeking at or after FirstMissingByte() returns false.
EXPECT_FALSE(buffer_->PeekRegion(length1 + length2, &iov));
@@ -706,12 +702,10 @@
EXPECT_FALSE(buffer_->PeekRegion(512, &iov));
EXPECT_TRUE(buffer_->PeekRegion(1024, &iov));
- EXPECT_EQ(quiche::QuicheStringPiece(source1).substr(1024),
- IovecToStringPiece(iov));
+ EXPECT_EQ(absl::string_view(source1).substr(1024), IovecToStringPiece(iov));
EXPECT_TRUE(buffer_->PeekRegion(1500, &iov));
- EXPECT_EQ(quiche::QuicheStringPiece(source1).substr(1500),
- IovecToStringPiece(iov));
+ EXPECT_EQ(absl::string_view(source1).substr(1500), IovecToStringPiece(iov));
// Consume rest of block.
EXPECT_TRUE(buffer_->MarkConsumed(kBlockSizeBytes - 1024));
@@ -725,8 +719,7 @@
EXPECT_EQ(source2, IovecToStringPiece(iov));
EXPECT_TRUE(buffer_->PeekRegion(kBlockSizeBytes + 128, &iov));
- EXPECT_EQ(quiche::QuicheStringPiece(source2).substr(128),
- IovecToStringPiece(iov));
+ EXPECT_EQ(absl::string_view(source2).substr(128), IovecToStringPiece(iov));
// Peeking into consumed data still fails.
EXPECT_FALSE(buffer_->PeekRegion(0, &iov));
@@ -933,7 +926,7 @@
for (size_t i = 0; i < num_to_write; ++i) {
write_buf[i] = (offset + i) % 256;
}
- quiche::QuicheStringPiece string_piece_w(write_buf.get(), num_to_write);
+ absl::string_view string_piece_w(write_buf.get(), num_to_write);
auto result = buffer_->OnStreamData(offset, string_piece_w, &written_,
&error_details_);
if (result == QUIC_NO_ERROR) {
diff --git a/quic/core/quic_stream_sequencer_test.cc b/quic/core/quic_stream_sequencer_test.cc
index bdf1412..cd39fcd 100644
--- a/quic/core/quic_stream_sequencer_test.cc
+++ b/quic/core/quic_stream_sequencer_test.cc
@@ -11,6 +11,7 @@
#include <utility>
#include <vector>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_stream.h"
#include "net/third_party/quiche/src/quic/core/quic_utils.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_expect_bug.h"
@@ -20,7 +21,6 @@
#include "net/third_party/quiche/src/quic/test_tools/quic_stream_sequencer_peer.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
using testing::_;
using testing::AnyNumber;
@@ -116,7 +116,7 @@
return true;
}
- bool VerifyIovec(const iovec& iovec, quiche::QuicheStringPiece expected) {
+ bool VerifyIovec(const iovec& iovec, absl::string_view expected) {
if (iovec.iov_len != expected.length()) {
QUIC_LOG(ERROR) << "Invalid length: " << iovec.iov_len << " vs "
<< expected.length();
@@ -600,10 +600,10 @@
// overlapping byte ranges - if they do, we close the connection.
QuicStreamId id = 1;
- QuicStreamFrame frame1(id, false, 1, quiche::QuicheStringPiece("hello"));
+ QuicStreamFrame frame1(id, false, 1, absl::string_view("hello"));
sequencer_->OnStreamFrame(frame1);
- QuicStreamFrame frame2(id, false, 2, quiche::QuicheStringPiece("hello"));
+ QuicStreamFrame frame2(id, false, 2, absl::string_view("hello"));
EXPECT_CALL(stream_, OnUnrecoverableError(QUIC_OVERLAPPING_STREAM_DATA, _))
.Times(0);
sequencer_->OnStreamFrame(frame2);
@@ -635,7 +635,7 @@
EXPECT_EQ(0u, sequencer_->NumBytesBuffered());
// Received [1498, 1503).
- QuicStreamFrame frame3(id, false, 1498, quiche::QuicheStringPiece("hello"));
+ QuicStreamFrame frame3(id, false, 1498, absl::string_view("hello"));
EXPECT_CALL(stream_, OnDataAvailable());
sequencer_->OnStreamFrame(frame3);
EXPECT_CALL(stream_, AddBytesConsumed(3));
@@ -644,7 +644,7 @@
EXPECT_EQ(0u, sequencer_->NumBytesBuffered());
// Received [1000, 1005).
- QuicStreamFrame frame4(id, false, 1000, quiche::QuicheStringPiece("hello"));
+ QuicStreamFrame frame4(id, false, 1000, absl::string_view("hello"));
EXPECT_CALL(stream_, OnDataAvailable()).Times(0);
sequencer_->OnStreamFrame(frame4);
EXPECT_EQ(1503u, sequencer_->NumBytesConsumed());
diff --git a/quic/core/quic_stream_test.cc b/quic/core/quic_stream_test.cc
index f2b5563..77b548a 100644
--- a/quic/core/quic_stream_test.cc
+++ b/quic/core/quic_stream_test.cc
@@ -8,6 +8,7 @@
#include <string>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/frames/quic_rst_stream_frame.h"
#include "net/third_party/quiche/src/quic/core/quic_connection.h"
#include "net/third_party/quiche/src/quic/core/quic_constants.h"
@@ -32,7 +33,6 @@
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
using testing::_;
using testing::AnyNumber;
@@ -295,8 +295,7 @@
// Write no data and no fin. If we consume nothing we should not be write
// blocked.
EXPECT_QUIC_BUG(
- stream_->WriteOrBufferData(quiche::QuicheStringPiece(), false, nullptr),
- "");
+ stream_->WriteOrBufferData(absl::string_view(), false, nullptr), "");
EXPECT_FALSE(HasWriteBlockedStreams());
}
@@ -310,8 +309,7 @@
return session_->ConsumeData(stream_->id(), 1u, 0u, NO_FIN,
NOT_RETRANSMISSION, QUICHE_NULLOPT);
}));
- stream_->WriteOrBufferData(quiche::QuicheStringPiece(kData1, 2), false,
- nullptr);
+ stream_->WriteOrBufferData(absl::string_view(kData1, 2), false, nullptr);
EXPECT_TRUE(session_->HasUnackedStreamData());
ASSERT_EQ(1u, write_blocked_list_->NumBlockedStreams());
EXPECT_EQ(1u, stream_->BufferedDataBytes());
@@ -329,8 +327,7 @@
return session_->ConsumeData(stream_->id(), 2u, 0u, NO_FIN,
NOT_RETRANSMISSION, QUICHE_NULLOPT);
}));
- stream_->WriteOrBufferData(quiche::QuicheStringPiece(kData1, 2), true,
- nullptr);
+ stream_->WriteOrBufferData(absl::string_view(kData1, 2), true, nullptr);
EXPECT_TRUE(session_->HasUnackedStreamData());
ASSERT_EQ(1u, write_blocked_list_->NumBlockedStreams());
}
@@ -342,7 +339,7 @@
// as the fin was not consumed.
EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _))
.WillOnce(Return(QuicConsumedData(0, false)));
- stream_->WriteOrBufferData(quiche::QuicheStringPiece(), true, nullptr);
+ stream_->WriteOrBufferData(absl::string_view(), true, nullptr);
ASSERT_EQ(1u, write_blocked_list_->NumBlockedStreams());
}
@@ -354,8 +351,7 @@
// crash with an unknown stream.
EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _))
.WillOnce(Invoke(this, &QuicStreamTest::CloseStreamOnWriteError));
- stream_->WriteOrBufferData(quiche::QuicheStringPiece(kData1, 2), false,
- nullptr);
+ stream_->WriteOrBufferData(absl::string_view(kData1, 2), false, nullptr);
ASSERT_EQ(0u, write_blocked_list_->NumBlockedStreams());
}
@@ -452,8 +448,7 @@
return session_->ConsumeData(stream_->id(), 1u, 0u, NO_FIN,
NOT_RETRANSMISSION, QUICHE_NULLOPT);
}));
- stream_->WriteOrBufferData(quiche::QuicheStringPiece(kData1, 1), false,
- nullptr);
+ stream_->WriteOrBufferData(absl::string_view(kData1, 1), false, nullptr);
EXPECT_TRUE(session_->HasUnackedStreamData());
EXPECT_FALSE(fin_sent());
EXPECT_FALSE(rst_sent());
@@ -482,8 +477,7 @@
return session_->ConsumeData(stream_->id(), 1u, 0u, FIN,
NOT_RETRANSMISSION, QUICHE_NULLOPT);
}));
- stream_->WriteOrBufferData(quiche::QuicheStringPiece(kData1, 1), true,
- nullptr);
+ stream_->WriteOrBufferData(absl::string_view(kData1, 1), true, nullptr);
EXPECT_TRUE(fin_sent());
EXPECT_FALSE(rst_sent());
@@ -673,7 +667,7 @@
current_connection_flow_control_offset);
QuicStreamFrame zero_length_stream_frame_with_fin(
stream_->id(), /*fin=*/true, kByteOffsetExceedingFlowControlWindow,
- quiche::QuicheStringPiece());
+ absl::string_view());
EXPECT_EQ(0, zero_length_stream_frame_with_fin.data_length);
EXPECT_CALL(*connection_, CloseConnection(_, _, _)).Times(0);
@@ -746,8 +740,7 @@
return session_->ConsumeData(stream_->id(), 2u, 0u, FIN,
NOT_RETRANSMISSION, QUICHE_NULLOPT);
}));
- stream_->WriteOrBufferData(quiche::QuicheStringPiece(kData1, 2), true,
- nullptr);
+ stream_->WriteOrBufferData(absl::string_view(kData1, 2), true, nullptr);
EXPECT_TRUE(stream_->write_side_closed());
EXPECT_EQ(1u, QuicSessionPeer::GetNumDrainingStreams(session_.get()));
@@ -764,8 +757,7 @@
return session_->ConsumeData(stream_->id(), 2u, 0u, FIN,
NOT_RETRANSMISSION, QUICHE_NULLOPT);
}));
- stream_->WriteOrBufferData(quiche::QuicheStringPiece(kData1, 2), true,
- nullptr);
+ stream_->WriteOrBufferData(absl::string_view(kData1, 2), true, nullptr);
EXPECT_TRUE(stream_->write_side_closed());
EXPECT_EQ(1u, QuicSessionPeer::GetNumOpenDynamicStreams(session_.get()));
diff --git a/quic/core/quic_tag.cc b/quic/core/quic_tag.cc
index d6c2f6c..7cc25e0 100644
--- a/quic/core/quic_tag.cc
+++ b/quic/core/quic_tag.cc
@@ -74,7 +74,7 @@
tag_vector.end();
}
-QuicTag ParseQuicTag(quiche::QuicheStringPiece tag_string) {
+QuicTag ParseQuicTag(absl::string_view tag_string) {
quiche::QuicheTextUtils::RemoveLeadingAndTrailingWhitespace(&tag_string);
std::string tag_bytes;
if (tag_string.length() == 8) {
@@ -92,13 +92,13 @@
return tag;
}
-QuicTagVector ParseQuicTagVector(quiche::QuicheStringPiece tags_string) {
+QuicTagVector ParseQuicTagVector(absl::string_view tags_string) {
QuicTagVector tag_vector;
quiche::QuicheTextUtils::RemoveLeadingAndTrailingWhitespace(&tags_string);
if (!tags_string.empty()) {
- std::vector<quiche::QuicheStringPiece> tag_strings =
+ std::vector<absl::string_view> tag_strings =
quiche::QuicheTextUtils::Split(tags_string, ',');
- for (quiche::QuicheStringPiece tag_string : tag_strings) {
+ for (absl::string_view tag_string : tag_strings) {
tag_vector.push_back(ParseQuicTag(tag_string));
}
}
diff --git a/quic/core/quic_tag.h b/quic/core/quic_tag.h
index 7ba6cfc..8b68e33 100644
--- a/quic/core/quic_tag.h
+++ b/quic/core/quic_tag.h
@@ -9,8 +9,8 @@
#include <string>
#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 {
@@ -53,12 +53,12 @@
// corresponding QuicTag. Note that tags that are less than four characters
// long are right-padded with zeroes. Tags that contain non-ASCII characters
// are represented as 8-character-long hexadecimal strings.
-QUIC_EXPORT_PRIVATE QuicTag ParseQuicTag(quiche::QuicheStringPiece tag_string);
+QUIC_EXPORT_PRIVATE QuicTag ParseQuicTag(absl::string_view tag_string);
// Utility function that converts a string of the form "ABCD,EFGH" to a vector
// of the form {kABCD,kEFGH}. Note the caveats on ParseQuicTag.
QUIC_EXPORT_PRIVATE QuicTagVector
-ParseQuicTagVector(quiche::QuicheStringPiece tags_string);
+ParseQuicTagVector(absl::string_view tags_string);
} // namespace quic
diff --git a/quic/core/quic_time_wait_list_manager.cc b/quic/core/quic_time_wait_list_manager.cc
index a09caac..769a9c5 100644
--- a/quic/core/quic_time_wait_list_manager.cc
+++ b/quic/core/quic_time_wait_list_manager.cc
@@ -9,6 +9,7 @@
#include <memory>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_protocol.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_decrypter.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_encrypter.h"
@@ -22,7 +23,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_map_util.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.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 {
@@ -239,7 +239,7 @@
<< (ietf_quic ? "" : "!") << "ietf_quic, "
<< (use_length_prefix ? "" : "!")
<< "use_length_prefix:" << std::endl
- << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
+ << quiche::QuicheTextUtils::HexDump(absl::string_view(
version_packet->data(), version_packet->length()));
SendOrQueuePacket(std::make_unique<QueuedPacket>(self_address, peer_address,
std::move(version_packet)),
@@ -263,9 +263,9 @@
BuildIetfStatelessResetPacket(connection_id);
QUIC_DVLOG(2) << "Dispatcher sending IETF reset packet for "
<< connection_id << std::endl
- << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
- ietf_reset_packet->data(),
- ietf_reset_packet->length()));
+ << quiche::QuicheTextUtils::HexDump(
+ absl::string_view(ietf_reset_packet->data(),
+ ietf_reset_packet->length()));
SendOrQueuePacket(
std::make_unique<QueuedPacket>(self_address, peer_address,
std::move(ietf_reset_packet)),
@@ -283,7 +283,7 @@
std::unique_ptr<QuicEncryptedPacket> reset_packet = BuildPublicReset(packet);
QUIC_DVLOG(2) << "Dispatcher sending reset packet for " << connection_id
<< std::endl
- << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
+ << quiche::QuicheTextUtils::HexDump(absl::string_view(
reset_packet->data(), reset_packet->length()));
SendOrQueuePacket(std::make_unique<QueuedPacket>(self_address, peer_address,
std::move(reset_packet)),
diff --git a/quic/core/quic_utils.cc b/quic/core/quic_utils.cc
index b6619d4..2e1562f 100644
--- a/quic/core/quic_utils.cc
+++ b/quic/core/quic_utils.cc
@@ -9,6 +9,7 @@
#include <cstring>
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_connection_id.h"
#include "net/third_party/quiche/src/quic/core/quic_constants.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
@@ -21,7 +22,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_uint128.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_endian.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
namespace {
@@ -36,8 +36,7 @@
#endif
#ifdef QUIC_UTIL_HAS_UINT128
-QuicUint128 IncrementalHashFast(QuicUint128 uhash,
- quiche::QuicheStringPiece data) {
+QuicUint128 IncrementalHashFast(QuicUint128 uhash, absl::string_view data) {
// This code ends up faster than the naive implementation for 2 reasons:
// 1. QuicUint128 is sufficiently complicated that the compiler
// cannot transform the multiplication by kPrime into a shift-multiply-add;
@@ -60,8 +59,7 @@
#ifndef QUIC_UTIL_HAS_UINT128
// Slow implementation of IncrementalHash. In practice, only used by Chromium.
-QuicUint128 IncrementalHashSlow(QuicUint128 hash,
- quiche::QuicheStringPiece data) {
+QuicUint128 IncrementalHashSlow(QuicUint128 hash, absl::string_view data) {
// kPrime = 309485009821345068724781371
static const QuicUint128 kPrime = MakeQuicUint128(16777216, 315);
const uint8_t* octets = reinterpret_cast<const uint8_t*>(data.data());
@@ -73,7 +71,7 @@
}
#endif
-QuicUint128 IncrementalHash(QuicUint128 hash, quiche::QuicheStringPiece data) {
+QuicUint128 IncrementalHash(QuicUint128 hash, absl::string_view data) {
#ifdef QUIC_UTIL_HAS_UINT128
return IncrementalHashFast(hash, data);
#else
@@ -84,7 +82,7 @@
} // namespace
// static
-uint64_t QuicUtils::FNV1a_64_Hash(quiche::QuicheStringPiece data) {
+uint64_t QuicUtils::FNV1a_64_Hash(absl::string_view data) {
static const uint64_t kOffset = UINT64_C(14695981039346656037);
static const uint64_t kPrime = UINT64_C(1099511628211);
@@ -101,21 +99,20 @@
}
// static
-QuicUint128 QuicUtils::FNV1a_128_Hash(quiche::QuicheStringPiece data) {
- return FNV1a_128_Hash_Three(data, quiche::QuicheStringPiece(),
- quiche::QuicheStringPiece());
+QuicUint128 QuicUtils::FNV1a_128_Hash(absl::string_view data) {
+ return FNV1a_128_Hash_Three(data, absl::string_view(), absl::string_view());
}
// static
-QuicUint128 QuicUtils::FNV1a_128_Hash_Two(quiche::QuicheStringPiece data1,
- quiche::QuicheStringPiece data2) {
- return FNV1a_128_Hash_Three(data1, data2, quiche::QuicheStringPiece());
+QuicUint128 QuicUtils::FNV1a_128_Hash_Two(absl::string_view data1,
+ absl::string_view data2) {
+ return FNV1a_128_Hash_Three(data1, data2, absl::string_view());
}
// static
-QuicUint128 QuicUtils::FNV1a_128_Hash_Three(quiche::QuicheStringPiece data1,
- quiche::QuicheStringPiece data2,
- quiche::QuicheStringPiece data3) {
+QuicUint128 QuicUtils::FNV1a_128_Hash_Three(absl::string_view data1,
+ absl::string_view data2,
+ absl::string_view data3) {
// The two constants are defined as part of the hash algorithm.
// see http://www.isthe.com/chongo/tech/comp/fnv/
// kOffset = 144066263297769815596495629667062367629
@@ -287,7 +284,7 @@
}
// static
-struct iovec QuicUtils::MakeIovec(quiche::QuicheStringPiece data) {
+struct iovec QuicUtils::MakeIovec(absl::string_view data) {
struct iovec iov = {const_cast<char*>(data.data()),
static_cast<size_t>(data.size())};
return iov;
@@ -511,7 +508,7 @@
return EmptyQuicConnectionId();
}
const uint64_t connection_id_hash64 = FNV1a_64_Hash(
- quiche::QuicheStringPiece(connection_id.data(), connection_id.length()));
+ absl::string_view(connection_id.data(), connection_id.length()));
if (expected_connection_id_length <= sizeof(uint64_t)) {
return QuicConnectionId(
reinterpret_cast<const char*>(&connection_id_hash64),
@@ -519,7 +516,7 @@
}
char new_connection_id_data[255] = {};
const QuicUint128 connection_id_hash128 = FNV1a_128_Hash(
- quiche::QuicheStringPiece(connection_id.data(), connection_id.length()));
+ absl::string_view(connection_id.data(), connection_id.length()));
static_assert(sizeof(connection_id_hash64) + sizeof(connection_id_hash128) <=
sizeof(new_connection_id_data),
"bad size");
@@ -615,7 +612,7 @@
QuicUint128 QuicUtils::GenerateStatelessResetToken(
QuicConnectionId connection_id) {
return FNV1a_128_Hash(
- quiche::QuicheStringPiece(connection_id.data(), connection_id.length()));
+ absl::string_view(connection_id.data(), connection_id.length()));
}
// static
diff --git a/quic/core/quic_utils.h b/quic/core/quic_utils.h
index 05c7124..c6f5ca0 100644
--- a/quic/core/quic_utils.h
+++ b/quic/core/quic_utils.h
@@ -11,6 +11,7 @@
#include <string>
#include <type_traits>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_random.h"
#include "net/third_party/quiche/src/quic/core/frames/quic_frame.h"
#include "net/third_party/quiche/src/quic/core/quic_connection_id.h"
@@ -21,7 +22,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_iovec.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_uint128.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -31,22 +31,22 @@
// Returns the 64 bit FNV1a hash of the data. See
// http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param
- static uint64_t FNV1a_64_Hash(quiche::QuicheStringPiece data);
+ static uint64_t FNV1a_64_Hash(absl::string_view data);
// Returns the 128 bit FNV1a hash of the data. See
// http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param
- static QuicUint128 FNV1a_128_Hash(quiche::QuicheStringPiece data);
+ static QuicUint128 FNV1a_128_Hash(absl::string_view data);
// Returns the 128 bit FNV1a hash of the two sequences of data. See
// http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param
- static QuicUint128 FNV1a_128_Hash_Two(quiche::QuicheStringPiece data1,
- quiche::QuicheStringPiece data2);
+ static QuicUint128 FNV1a_128_Hash_Two(absl::string_view data1,
+ absl::string_view data2);
// Returns the 128 bit FNV1a hash of the three sequences of data. See
// http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param
- static QuicUint128 FNV1a_128_Hash_Three(quiche::QuicheStringPiece data1,
- quiche::QuicheStringPiece data2,
- quiche::QuicheStringPiece data3);
+ static QuicUint128 FNV1a_128_Hash_Three(absl::string_view data1,
+ absl::string_view data2,
+ absl::string_view data3);
// SerializeUint128 writes the first 96 bits of |v| in little-endian form
// to |out|.
@@ -80,7 +80,7 @@
char* buffer);
// Creates an iovec pointing to the same data as |data|.
- static struct iovec MakeIovec(quiche::QuicheStringPiece data);
+ static struct iovec MakeIovec(absl::string_view data);
// Returns the opposite Perspective of the |perspective| passed in.
static constexpr Perspective InvertPerspective(Perspective perspective) {
diff --git a/quic/core/quic_utils_test.cc b/quic/core/quic_utils_test.cc
index 041cd98..b3b8457 100644
--- a/quic/core/quic_utils_test.cc
+++ b/quic/core/quic_utils_test.cc
@@ -6,12 +6,12 @@
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_protocol.h"
#include "net/third_party/quiche/src/quic/core/quic_connection_id.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
namespace test {
@@ -100,7 +100,7 @@
data[i] = i % 255;
}
EXPECT_EQ(IncrementalHashReference(data.data(), data.size()),
- QuicUtils::FNV1a_128_Hash(quiche::QuicheStringPiece(
+ QuicUtils::FNV1a_128_Hash(absl::string_view(
reinterpret_cast<const char*>(data.data()), data.size())));
}
diff --git a/quic/core/quic_versions.cc b/quic/core/quic_versions.cc
index d3f707b..745957f 100644
--- a/quic/core/quic_versions.cc
+++ b/quic/core/quic_versions.cc
@@ -328,8 +328,7 @@
return UnsupportedQuicVersion();
}
-ParsedQuicVersion ParseQuicVersionString(
- quiche::QuicheStringPiece version_string) {
+ParsedQuicVersion ParseQuicVersionString(absl::string_view version_string) {
if (version_string.empty()) {
return UnsupportedQuicVersion();
}
@@ -374,11 +373,11 @@
}
ParsedQuicVersionVector ParseQuicVersionVectorString(
- quiche::QuicheStringPiece versions_string) {
+ absl::string_view versions_string) {
ParsedQuicVersionVector versions;
- std::vector<quiche::QuicheStringPiece> version_strings =
+ std::vector<absl::string_view> version_strings =
quiche::QuicheTextUtils::Split(versions_string, ',');
- for (quiche::QuicheStringPiece version_string : version_strings) {
+ for (absl::string_view version_string : version_strings) {
quiche::QuicheTextUtils::RemoveLeadingAndTrailingWhitespace(
&version_string);
ParsedQuicVersion version = ParseQuicVersionString(version_string);
diff --git a/quic/core/quic_versions.h b/quic/core/quic_versions.h
index e983272..c29b715 100644
--- a/quic/core/quic_versions.h
+++ b/quic/core/quic_versions.h
@@ -26,10 +26,10 @@
#include <string>
#include <vector>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_tag.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 {
@@ -497,13 +497,13 @@
// ALPN such as "h3-29" or "h3-Q050". For PROTOCOL_QUIC_CRYPTO versions, also
// supports parsing numbers such as "46".
QUIC_EXPORT_PRIVATE ParsedQuicVersion
-ParseQuicVersionString(quiche::QuicheStringPiece version_string);
+ParseQuicVersionString(absl::string_view version_string);
// Parses a comma-separated list of QUIC version strings. Supports parsing by
// label, ALPN and numbers for PROTOCOL_QUIC_CRYPTO. Skips unknown versions.
// For example: "h3-29,Q050,46".
QUIC_EXPORT_PRIVATE ParsedQuicVersionVector
-ParseQuicVersionVectorString(quiche::QuicheStringPiece versions_string);
+ParseQuicVersionVectorString(absl::string_view versions_string);
// Constructs a QuicVersionLabel from the provided ParsedQuicVersion.
QUIC_EXPORT_PRIVATE QuicVersionLabel
diff --git a/quic/core/tls_chlo_extractor.cc b/quic/core/tls_chlo_extractor.cc
index 7c10d2c..06ed1c8 100644
--- a/quic/core/tls_chlo_extractor.cc
+++ b/quic/core/tls_chlo_extractor.cc
@@ -6,6 +6,7 @@
#include <cstring>
#include <memory>
+#include "absl/strings/string_view.h"
#include "third_party/boringssl/src/include/openssl/ssl.h"
#include "net/third_party/quiche/src/quic/core/frames/quic_crypto_frame.h"
#include "net/third_party/quiche/src/quic/core/quic_data_reader.h"
@@ -16,7 +17,6 @@
#include "net/third_party/quiche/src/quic/core/quic_versions.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.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"
namespace quic {
@@ -280,14 +280,14 @@
if (rv == 1) {
QuicDataReader alpns_reader(reinterpret_cast<const char*>(alpn_data),
alpn_len);
- quiche::QuicheStringPiece alpns_payload;
+ absl::string_view alpns_payload;
if (!alpns_reader.ReadStringPiece16(&alpns_payload)) {
HandleUnrecoverableError("Failed to read alpns_payload");
return;
}
QuicDataReader alpns_payload_reader(alpns_payload);
while (!alpns_payload_reader.IsDoneReading()) {
- quiche::QuicheStringPiece alpn_payload;
+ absl::string_view alpn_payload;
if (!alpns_payload_reader.ReadStringPiece8(&alpn_payload)) {
HandleUnrecoverableError("Failed to read alpn_payload");
return;
diff --git a/quic/core/tls_chlo_extractor.h b/quic/core/tls_chlo_extractor.h
index b50d2e2..53e06b4 100644
--- a/quic/core/tls_chlo_extractor.h
+++ b/quic/core/tls_chlo_extractor.h
@@ -67,10 +67,9 @@
const QuicVersionNegotiationPacket& /*packet*/) override {}
void OnRetryPacket(QuicConnectionId /*original_connection_id*/,
QuicConnectionId /*new_connection_id*/,
- quiche::QuicheStringPiece /*retry_token*/,
- quiche::QuicheStringPiece /*retry_integrity_tag*/,
- quiche::QuicheStringPiece /*retry_without_tag*/) override {
- }
+ absl::string_view /*retry_token*/,
+ absl::string_view /*retry_integrity_tag*/,
+ absl::string_view /*retry_without_tag*/) override {}
bool OnUnauthenticatedPublicHeader(const QuicPacketHeader& header) override;
bool OnUnauthenticatedHeader(const QuicPacketHeader& /*header*/) override {
return true;
diff --git a/quic/core/tls_chlo_extractor_test.cc b/quic/core/tls_chlo_extractor_test.cc
index 955e58c..db926b4 100644
--- a/quic/core/tls_chlo_extractor_test.cc
+++ b/quic/core/tls_chlo_extractor_test.cc
@@ -31,7 +31,7 @@
QuicSocketAddress(TestPeerIPAddress(), kTestPort), *packet);
std::string detailed_error;
bool retry_token_present;
- quiche::QuicheStringPiece retry_token;
+ absl::string_view retry_token;
const QuicErrorCode error = QuicFramer::ParsePublicHeaderDispatcher(
*packet, /*expected_destination_connection_id_length=*/0,
&packet_info.form, &packet_info.long_packet_type,
@@ -128,7 +128,7 @@
QuicSocketAddress(TestPeerIPAddress(), kTestPort), *packets_[0]);
std::string detailed_error;
bool retry_token_present;
- quiche::QuicheStringPiece retry_token;
+ absl::string_view retry_token;
const QuicErrorCode error = QuicFramer::ParsePublicHeaderDispatcher(
*packets_[0], /*expected_destination_connection_id_length=*/0,
&packet_info.form, &packet_info.long_packet_type,
diff --git a/quic/core/tls_client_handshaker.cc b/quic/core/tls_client_handshaker.cc
index ba3f9d4..c6e601e 100644
--- a/quic/core/tls_client_handshaker.cc
+++ b/quic/core/tls_client_handshaker.cc
@@ -7,6 +7,7 @@
#include <cstring>
#include <string>
+#include "absl/strings/string_view.h"
#include "third_party/boringssl/src/include/openssl/ssl.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_crypto_client_config.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_encrypter.h"
@@ -15,7 +16,6 @@
#include "net/third_party/quiche/src/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_hostname_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"
namespace quic {
@@ -189,7 +189,7 @@
success && (SSL_set_alpn_protos(ssl(), alpn, alpn_writer.length()) == 0);
if (!success) {
QUIC_BUG << "Failed to set ALPN: "
- << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
+ << quiche::QuicheTextUtils::HexDump(absl::string_view(
alpn_writer.data(), alpn_writer.length()));
return false;
}
@@ -616,7 +616,7 @@
}
void TlsClientHandshaker::WriteMessage(EncryptionLevel level,
- quiche::QuicheStringPiece data) {
+ absl::string_view data) {
if (level == ENCRYPTION_HANDSHAKE &&
state_ < STATE_ENCRYPTION_HANDSHAKE_DATA_SENT) {
state_ = STATE_ENCRYPTION_HANDSHAKE_DATA_SENT;
diff --git a/quic/core/tls_client_handshaker.h b/quic/core/tls_client_handshaker.h
index 2a09fb8..89388cc 100644
--- a/quic/core/tls_client_handshaker.h
+++ b/quic/core/tls_client_handshaker.h
@@ -9,6 +9,7 @@
#include <memory>
#include <string>
+#include "absl/strings/string_view.h"
#include "third_party/boringssl/src/include/openssl/ssl.h"
#include "net/third_party/quiche/src/quic/core/crypto/proof_verifier.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_crypto_client_config.h"
@@ -18,7 +19,6 @@
#include "net/third_party/quiche/src/quic/core/quic_crypto_stream.h"
#include "net/third_party/quiche/src/quic/core/tls_handshaker.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 {
@@ -69,8 +69,7 @@
const std::vector<uint8_t>& write_secret) override;
// Override to drop initial keys if trying to write ENCRYPTION_HANDSHAKE data.
- void WriteMessage(EncryptionLevel level,
- quiche::QuicheStringPiece data) override;
+ void WriteMessage(EncryptionLevel level, absl::string_view data) override;
void SetServerApplicationStateForResumption(
std::unique_ptr<ApplicationState> application_state) override;
diff --git a/quic/core/tls_client_handshaker_test.cc b/quic/core/tls_client_handshaker_test.cc
index bfd937f..6a05159 100644
--- a/quic/core/tls_client_handshaker_test.cc
+++ b/quic/core/tls_client_handshaker_test.cc
@@ -52,7 +52,7 @@
const uint16_t port,
const std::string& server_config,
QuicTransportVersion quic_version,
- quiche::QuicheStringPiece chlo_hash,
+ absl::string_view chlo_hash,
const std::vector<std::string>& certs,
const std::string& cert_sct,
const std::string& signature,
@@ -233,10 +233,9 @@
server_session_.reset(server_session);
std::string alpn = AlpnForVersion(connection_->version());
EXPECT_CALL(*server_session_, SelectAlpn(_))
- .WillRepeatedly(
- [alpn](const std::vector<quiche::QuicheStringPiece>& alpns) {
- return std::find(alpns.cbegin(), alpns.cend(), alpn);
- });
+ .WillRepeatedly([alpn](const std::vector<absl::string_view>& alpns) {
+ return std::find(alpns.cbegin(), alpns.cend(), alpn);
+ });
}
MockQuicConnectionHelper server_helper_;
@@ -286,8 +285,8 @@
0, 0, 0, // uint24 length
};
stream()->crypto_message_parser()->ProcessInput(
- quiche::QuicheStringPiece(bogus_handshake_message,
- QUICHE_ARRAYSIZE(bogus_handshake_message)),
+ absl::string_view(bogus_handshake_message,
+ QUICHE_ARRAYSIZE(bogus_handshake_message)),
ENCRYPTION_INITIAL);
EXPECT_FALSE(stream()->one_rtt_keys_available());
@@ -556,10 +555,9 @@
InitializeFakeServer();
const std::string kTestAlpn = "An ALPN That Client Did Not Offer";
EXPECT_CALL(*server_session_, SelectAlpn(_))
- .WillOnce(
- [kTestAlpn](const std::vector<quiche::QuicheStringPiece>& alpns) {
- return std::find(alpns.cbegin(), alpns.cend(), kTestAlpn);
- });
+ .WillOnce([kTestAlpn](const std::vector<absl::string_view>& alpns) {
+ return std::find(alpns.cbegin(), alpns.cend(), kTestAlpn);
+ });
EXPECT_CALL(*server_connection_,
CloseConnection(QUIC_HANDSHAKE_FAILED,
"TLS handshake failure (ENCRYPTION_INITIAL) 120: "
diff --git a/quic/core/tls_handshaker.cc b/quic/core/tls_handshaker.cc
index 04fab15..7e66302 100644
--- a/quic/core/tls_handshaker.cc
+++ b/quic/core/tls_handshaker.cc
@@ -4,6 +4,7 @@
#include "net/third_party/quiche/src/quic/core/tls_handshaker.h"
+#include "absl/strings/string_view.h"
#include "third_party/boringssl/src/include/openssl/crypto.h"
#include "third_party/boringssl/src/include/openssl/ssl.h"
#include "net/third_party/quiche/src/quic/core/quic_crypto_stream.h"
@@ -11,7 +12,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.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 {
@@ -20,7 +20,7 @@
TlsHandshaker::~TlsHandshaker() {}
-bool TlsHandshaker::ProcessInput(quiche::QuicheStringPiece input,
+bool TlsHandshaker::ProcessInput(absl::string_view input,
EncryptionLevel level) {
if (parser_error_ != QUIC_NO_ERROR) {
return false;
@@ -88,7 +88,7 @@
}
void TlsHandshaker::WriteMessage(EncryptionLevel level,
- quiche::QuicheStringPiece data) {
+ absl::string_view data) {
stream_->WriteCryptoData(level, data);
}
diff --git a/quic/core/tls_handshaker.h b/quic/core/tls_handshaker.h
index 2b3c9fc..ef3ade1 100644
--- a/quic/core/tls_handshaker.h
+++ b/quic/core/tls_handshaker.h
@@ -5,6 +5,7 @@
#ifndef QUICHE_QUIC_CORE_TLS_HANDSHAKER_H_
#define QUICHE_QUIC_CORE_TLS_HANDSHAKER_H_
+#include "absl/strings/string_view.h"
#include "third_party/boringssl/src/include/openssl/base.h"
#include "third_party/boringssl/src/include/openssl/ssl.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_handshake.h"
@@ -14,7 +15,6 @@
#include "net/third_party/quiche/src/quic/core/crypto/tls_connection.h"
#include "net/third_party/quiche/src/quic/core/quic_session.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 {
@@ -36,8 +36,7 @@
~TlsHandshaker() override;
// From CryptoMessageParser
- bool ProcessInput(quiche::QuicheStringPiece input,
- EncryptionLevel level) override;
+ bool ProcessInput(absl::string_view input, EncryptionLevel level) override;
size_t InputBytesRemaining() const override { return 0; }
QuicErrorCode error() const override { return parser_error_; }
const std::string& error_detail() const override {
@@ -88,8 +87,7 @@
// WriteMessage is called when there is |data| from the TLS stack ready for
// the QUIC stack to write in a crypto frame. The data must be transmitted at
// encryption level |level|.
- void WriteMessage(EncryptionLevel level,
- quiche::QuicheStringPiece data) override;
+ void WriteMessage(EncryptionLevel level, absl::string_view data) override;
// FlushFlight is called to signal that the current flight of
// messages have all been written (via calls to WriteMessage) and can be
diff --git a/quic/core/tls_server_handshaker.cc b/quic/core/tls_server_handshaker.cc
index a8f926e..f108a32 100644
--- a/quic/core/tls_server_handshaker.cc
+++ b/quic/core/tls_server_handshaker.cc
@@ -7,6 +7,7 @@
#include <memory>
#include <string>
+#include "absl/strings/string_view.h"
#include "third_party/boringssl/src/include/openssl/pool.h"
#include "third_party/boringssl/src/include/openssl/ssl.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_crypto_server_config.h"
@@ -14,7 +15,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_hostname_utils.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
namespace quic {
@@ -423,7 +423,7 @@
size_t* out_len,
size_t max_out,
uint16_t sig_alg,
- quiche::QuicheStringPiece in) {
+ absl::string_view in) {
signature_callback_ = new SignatureCallback(this);
proof_source_->ComputeTlsSignature(
session()->connection()->self_address(),
@@ -461,7 +461,7 @@
int TlsServerHandshaker::SessionTicketSeal(uint8_t* out,
size_t* out_len,
size_t max_out_len,
- quiche::QuicheStringPiece in) {
+ absl::string_view in) {
DCHECK(proof_source_->GetTicketCrypter());
std::vector<uint8_t> ticket = proof_source_->GetTicketCrypter()->Encrypt(in);
if (max_out_len < ticket.size()) {
@@ -480,7 +480,7 @@
uint8_t* out,
size_t* out_len,
size_t max_out_len,
- quiche::QuicheStringPiece in) {
+ absl::string_view in) {
DCHECK(proof_source_->GetTicketCrypter());
if (!ticket_decryption_callback_) {
@@ -586,7 +586,7 @@
CBS all_alpns;
CBS_init(&all_alpns, in, in_len);
- std::vector<quiche::QuicheStringPiece> alpns;
+ std::vector<absl::string_view> alpns;
while (CBS_len(&all_alpns) > 0) {
CBS alpn;
if (!CBS_get_u8_length_prefixed(&all_alpns, &alpn)) {
diff --git a/quic/core/tls_server_handshaker.h b/quic/core/tls_server_handshaker.h
index 063e5ca..79d19cb 100644
--- a/quic/core/tls_server_handshaker.h
+++ b/quic/core/tls_server_handshaker.h
@@ -7,6 +7,7 @@
#include <string>
+#include "absl/strings/string_view.h"
#include "third_party/boringssl/src/include/openssl/pool.h"
#include "third_party/boringssl/src/include/openssl/ssl.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_crypto_server_config.h"
@@ -16,7 +17,6 @@
#include "net/third_party/quiche/src/quic/core/quic_crypto_stream.h"
#include "net/third_party/quiche/src/quic/core/tls_handshaker.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 {
@@ -94,12 +94,11 @@
uint8_t* out_len,
const uint8_t* in,
unsigned in_len) override;
- ssl_private_key_result_t PrivateKeySign(
- uint8_t* out,
- size_t* out_len,
- size_t max_out,
- uint16_t sig_alg,
- quiche::QuicheStringPiece in) override;
+ ssl_private_key_result_t PrivateKeySign(uint8_t* out,
+ size_t* out_len,
+ size_t max_out,
+ uint16_t sig_alg,
+ absl::string_view in) override;
ssl_private_key_result_t PrivateKeyComplete(uint8_t* out,
size_t* out_len,
size_t max_out) override;
@@ -107,12 +106,11 @@
int SessionTicketSeal(uint8_t* out,
size_t* out_len,
size_t max_out_len,
- quiche::QuicheStringPiece in) override;
- ssl_ticket_aead_result_t SessionTicketOpen(
- uint8_t* out,
- size_t* out_len,
- size_t max_out_len,
- quiche::QuicheStringPiece in) override;
+ absl::string_view in) override;
+ ssl_ticket_aead_result_t SessionTicketOpen(uint8_t* out,
+ size_t* out_len,
+ size_t max_out_len,
+ absl::string_view in) override;
TlsConnection::Delegate* ConnectionDelegate() override { return this; }
private:
diff --git a/quic/core/tls_server_handshaker_test.cc b/quic/core/tls_server_handshaker_test.cc
index 295af9d..b95b281 100644
--- a/quic/core/tls_server_handshaker_test.cc
+++ b/quic/core/tls_server_handshaker_test.cc
@@ -6,6 +6,7 @@
#include <utility>
#include <vector>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/proof_source.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_random.h"
#include "net/third_party/quiche/src/quic/core/quic_crypto_client_stream.h"
@@ -23,7 +24,6 @@
#include "net/third_party/quiche/src/quic/test_tools/simple_session_cache.h"
#include "net/third_party/quiche/src/quic/test_tools/test_ticket_crypter.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 {
class QuicConnection;
@@ -101,7 +101,7 @@
.Times(testing::AnyNumber());
EXPECT_CALL(*server_session_, SelectAlpn(_))
.WillRepeatedly(
- [this](const std::vector<quiche::QuicheStringPiece>& alpns) {
+ [this](const std::vector<absl::string_view>& alpns) {
return std::find(
alpns.cbegin(), alpns.cend(),
AlpnForVersion(server_session_->connection()->version()));
@@ -295,8 +295,8 @@
0, 0, 0, // uint24 length
};
server_stream()->crypto_message_parser()->ProcessInput(
- quiche::QuicheStringPiece(bogus_handshake_message,
- QUICHE_ARRAYSIZE(bogus_handshake_message)),
+ absl::string_view(bogus_handshake_message,
+ QUICHE_ARRAYSIZE(bogus_handshake_message)),
ENCRYPTION_INITIAL);
EXPECT_FALSE(server_stream()->one_rtt_keys_available());
@@ -330,15 +330,13 @@
EXPECT_CALL(*client_session_, GetAlpnsToOffer())
.WillRepeatedly(Return(kTestAlpns));
EXPECT_CALL(*server_session_, SelectAlpn(_))
- .WillOnce([kTestAlpn, kTestAlpns](
- const std::vector<quiche::QuicheStringPiece>& alpns) {
- EXPECT_THAT(alpns, testing::ElementsAreArray(kTestAlpns));
- return std::find(alpns.cbegin(), alpns.cend(), kTestAlpn);
- });
- EXPECT_CALL(*client_session_,
- OnAlpnSelected(quiche::QuicheStringPiece(kTestAlpn)));
- EXPECT_CALL(*server_session_,
- OnAlpnSelected(quiche::QuicheStringPiece(kTestAlpn)));
+ .WillOnce(
+ [kTestAlpn, kTestAlpns](const std::vector<absl::string_view>& alpns) {
+ EXPECT_THAT(alpns, testing::ElementsAreArray(kTestAlpns));
+ return std::find(alpns.cbegin(), alpns.cend(), kTestAlpn);
+ });
+ EXPECT_CALL(*client_session_, OnAlpnSelected(absl::string_view(kTestAlpn)));
+ EXPECT_CALL(*server_session_, OnAlpnSelected(absl::string_view(kTestAlpn)));
CompleteCryptoHandshake();
ExpectHandshakeSuccessful();