Replace QuicheStringPiece with absl::string_view
Tested:
TAP for global presubmit queue passed after automated deflaking of failures: http://mondo/deflaker/run/96cd5e40-b4cb-4ad8-8e9f-62d5c247385b http://mondo/deflaker/run/0a6209be-9013-4346-bd74-893b793b94d1 http://mondo/deflaker/run/f97a1fae-e543-4aea-a52f-88ddf6054d33
http://test/OCL:335945875:BASE:335945937:1602132930213:6b6e6496
PiperOrigin-RevId: 336088095
Change-Id: I3a39387a5c382c401e0cf55b937dbd5babc7bdf3
diff --git a/quic/tools/fake_proof_verifier.h b/quic/tools/fake_proof_verifier.h
index 7f4a38e..2d7d7f4 100644
--- a/quic/tools/fake_proof_verifier.h
+++ b/quic/tools/fake_proof_verifier.h
@@ -5,8 +5,8 @@
#ifndef QUICHE_QUIC_TOOLS_FAKE_PROOF_VERIFIER_H_
#define QUICHE_QUIC_TOOLS_FAKE_PROOF_VERIFIER_H_
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/proof_verifier.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -19,7 +19,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*/,
diff --git a/quic/tools/quic_backend_response.h b/quic/tools/quic_backend_response.h
index af6cf84..379bec8 100644
--- a/quic/tools/quic_backend_response.h
+++ b/quic/tools/quic_backend_response.h
@@ -5,8 +5,8 @@
#ifndef QUICHE_QUIC_TOOLS_QUIC_BACKEND_RESPONSE_H_
#define QUICHE_QUIC_TOOLS_QUIC_BACKEND_RESPONSE_H_
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/tools/quic_url.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 {
@@ -53,9 +53,7 @@
SpecialResponseType response_type() const { return response_type_; }
const spdy::SpdyHeaderBlock& headers() const { return headers_; }
const spdy::SpdyHeaderBlock& trailers() const { return trailers_; }
- const quiche::QuicheStringPiece body() const {
- return quiche::QuicheStringPiece(body_);
- }
+ const absl::string_view body() const { return absl::string_view(body_); }
void set_response_type(SpecialResponseType response_type) {
response_type_ = response_type;
@@ -67,7 +65,7 @@
void set_trailers(spdy::SpdyHeaderBlock trailers) {
trailers_ = std::move(trailers);
}
- void set_body(quiche::QuicheStringPiece body) {
+ void set_body(absl::string_view body) {
body_.assign(body.data(), body.size());
}
diff --git a/quic/tools/quic_client_base.h b/quic/tools/quic_client_base.h
index 4df3a2b..873c362 100644
--- a/quic/tools/quic_client_base.h
+++ b/quic/tools/quic_client_base.h
@@ -10,6 +10,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/http/quic_client_push_promise_index.h"
#include "net/third_party/quiche/src/quic/core/http/quic_spdy_client_session.h"
@@ -17,7 +18,6 @@
#include "net/third_party/quiche/src/quic/core/quic_config.h"
#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/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -227,7 +227,7 @@
bool initialized() const { return initialized_; }
- void SetPreSharedKey(quiche::QuicheStringPiece key) {
+ void SetPreSharedKey(absl::string_view key) {
crypto_config_.set_pre_shared_key(key);
}
diff --git a/quic/tools/quic_client_test.cc b/quic/tools/quic_client_test.cc
index b1923b6..219fa70 100644
--- a/quic/tools/quic_client_test.cc
+++ b/quic/tools/quic_client_test.cc
@@ -10,13 +10,13 @@
#include <memory>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_epoll.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_port_utils.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test_loopback.h"
#include "net/third_party/quiche/src/quic/test_tools/crypto_test_utils.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_client_peer.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 {
@@ -40,7 +40,7 @@
std::unique_ptr<DIR, int (*)(DIR*)> fd_directory(opendir(kPathToFds),
closedir);
while ((file = readdir(fd_directory.get())) != nullptr) {
- quiche::QuicheStringPiece name(file->d_name);
+ absl::string_view name(file->d_name);
if (name == "." || name == "..") {
continue;
}
diff --git a/quic/tools/quic_memory_cache_backend.cc b/quic/tools/quic_memory_cache_backend.cc
index 370eb4a..5efe0e6 100644
--- a/quic/tools/quic_memory_cache_backend.cc
+++ b/quic/tools/quic_memory_cache_backend.cc
@@ -6,12 +6,12 @@
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/http/spdy_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_file_utils.h"
#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/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
using spdy::kV3LowestPriority;
@@ -40,7 +40,7 @@
if (file_contents_[pos - 1] == '\r') {
len -= 1;
}
- quiche::QuicheStringPiece line(file_contents_.data() + start, len);
+ absl::string_view line(file_contents_.data() + start, len);
start = pos + 1;
// Headers end with an empty line.
if (line.empty()) {
@@ -83,30 +83,29 @@
// stuff as described in https://w3c.github.io/preload/.
it = spdy_headers_.find("x-push-url");
if (it != spdy_headers_.end()) {
- quiche::QuicheStringPiece push_urls = it->second;
+ absl::string_view push_urls = it->second;
size_t start = 0;
while (start < push_urls.length()) {
size_t pos = push_urls.find('\0', start);
if (pos == std::string::npos) {
- push_urls_.push_back(quiche::QuicheStringPiece(
- push_urls.data() + start, push_urls.length() - start));
+ push_urls_.push_back(absl::string_view(push_urls.data() + start,
+ push_urls.length() - start));
break;
}
- push_urls_.push_back(
- quiche::QuicheStringPiece(push_urls.data() + start, pos));
+ push_urls_.push_back(absl::string_view(push_urls.data() + start, pos));
start += pos + 1;
}
}
- body_ = quiche::QuicheStringPiece(file_contents_.data() + start,
- file_contents_.size() - start);
+ body_ = absl::string_view(file_contents_.data() + start,
+ file_contents_.size() - start);
}
void QuicMemoryCacheBackend::ResourceFile::SetHostPathFromBase(
- quiche::QuicheStringPiece base) {
+ absl::string_view base) {
DCHECK(base[0] != '/') << base;
size_t path_start = base.find_first_of('/');
- if (path_start == quiche::QuicheStringPiece::npos) {
+ if (path_start == absl::string_view::npos) {
host_ = std::string(base);
path_ = "";
return;
@@ -121,8 +120,8 @@
}
}
-quiche::QuicheStringPiece QuicMemoryCacheBackend::ResourceFile::RemoveScheme(
- quiche::QuicheStringPiece url) {
+absl::string_view QuicMemoryCacheBackend::ResourceFile::RemoveScheme(
+ absl::string_view url) {
if (quiche::QuicheTextUtils::StartsWith(url, "https://")) {
url.remove_prefix(8);
} else if (quiche::QuicheTextUtils::StartsWith(url, "http://")) {
@@ -132,13 +131,13 @@
}
void QuicMemoryCacheBackend::ResourceFile::HandleXOriginalUrl() {
- quiche::QuicheStringPiece url(x_original_url_);
+ absl::string_view url(x_original_url_);
SetHostPathFromBase(RemoveScheme(url));
}
const QuicBackendResponse* QuicMemoryCacheBackend::GetResponse(
- quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path) const {
+ absl::string_view host,
+ absl::string_view path) const {
QuicWriterMutexLock lock(&response_mutex_);
auto it = responses_.find(GetKey(host, path));
@@ -146,8 +145,7 @@
uint64_t ignored = 0;
if (generate_bytes_response_) {
if (quiche::QuicheTextUtils::StringToUint64(
- quiche::QuicheStringPiece(path.data() + 1, path.size() - 1),
- &ignored)) {
+ absl::string_view(path.data() + 1, path.size() - 1), &ignored)) {
// The actual parsed length is ignored here and will be recomputed
// by the caller.
return generate_bytes_response_.get();
@@ -166,10 +164,10 @@
typedef QuicBackendResponse::ServerPushInfo ServerPushInfo;
typedef QuicBackendResponse::SpecialResponseType SpecialResponseType;
-void QuicMemoryCacheBackend::AddSimpleResponse(quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path,
+void QuicMemoryCacheBackend::AddSimpleResponse(absl::string_view host,
+ absl::string_view path,
int response_code,
- quiche::QuicheStringPiece body) {
+ absl::string_view body) {
SpdyHeaderBlock response_headers;
response_headers[":status"] =
quiche::QuicheTextUtils::Uint64ToString(response_code);
@@ -179,10 +177,10 @@
}
void QuicMemoryCacheBackend::AddSimpleResponseWithServerPushResources(
- quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path,
+ absl::string_view host,
+ absl::string_view path,
int response_code,
- quiche::QuicheStringPiece body,
+ absl::string_view body,
std::list<ServerPushInfo> push_resources) {
AddSimpleResponse(host, path, response_code, body);
MaybeAddServerPushResources(host, path, push_resources);
@@ -193,40 +191,38 @@
default_response_.reset(response);
}
-void QuicMemoryCacheBackend::AddResponse(
- quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path,
- SpdyHeaderBlock response_headers,
- quiche::QuicheStringPiece response_body) {
+void QuicMemoryCacheBackend::AddResponse(absl::string_view host,
+ absl::string_view path,
+ SpdyHeaderBlock response_headers,
+ absl::string_view response_body) {
AddResponseImpl(host, path, QuicBackendResponse::REGULAR_RESPONSE,
std::move(response_headers), response_body,
SpdyHeaderBlock());
}
-void QuicMemoryCacheBackend::AddResponse(
- quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path,
- SpdyHeaderBlock response_headers,
- quiche::QuicheStringPiece response_body,
- SpdyHeaderBlock response_trailers) {
+void QuicMemoryCacheBackend::AddResponse(absl::string_view host,
+ absl::string_view path,
+ SpdyHeaderBlock response_headers,
+ absl::string_view response_body,
+ SpdyHeaderBlock response_trailers) {
AddResponseImpl(host, path, QuicBackendResponse::REGULAR_RESPONSE,
std::move(response_headers), response_body,
std::move(response_trailers));
}
void QuicMemoryCacheBackend::AddSpecialResponse(
- quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path,
+ absl::string_view host,
+ absl::string_view path,
SpecialResponseType response_type) {
AddResponseImpl(host, path, response_type, SpdyHeaderBlock(), "",
SpdyHeaderBlock());
}
void QuicMemoryCacheBackend::AddSpecialResponse(
- quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path,
+ absl::string_view host,
+ absl::string_view path,
spdy::SpdyHeaderBlock response_headers,
- quiche::QuicheStringPiece response_body,
+ absl::string_view response_body,
SpecialResponseType response_type) {
AddResponseImpl(host, path, response_type, std::move(response_headers),
response_body, SpdyHeaderBlock());
@@ -353,11 +349,11 @@
}
void QuicMemoryCacheBackend::AddResponseImpl(
- quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path,
+ absl::string_view host,
+ absl::string_view path,
SpecialResponseType response_type,
SpdyHeaderBlock response_headers,
- quiche::QuicheStringPiece response_body,
+ absl::string_view response_body,
SpdyHeaderBlock response_trailers) {
QuicWriterMutexLock lock(&response_mutex_);
@@ -376,9 +372,8 @@
responses_[key] = std::move(new_response);
}
-std::string QuicMemoryCacheBackend::GetKey(
- quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path) const {
+std::string QuicMemoryCacheBackend::GetKey(absl::string_view host,
+ absl::string_view path) const {
std::string host_string = std::string(host);
size_t port = host_string.find(':');
if (port != std::string::npos)
@@ -387,8 +382,8 @@
}
void QuicMemoryCacheBackend::MaybeAddServerPushResources(
- quiche::QuicheStringPiece request_host,
- quiche::QuicheStringPiece request_path,
+ absl::string_view request_host,
+ absl::string_view request_path,
std::list<ServerPushInfo> push_resources) {
std::string request_url = GetKey(request_host, request_path);
@@ -418,7 +413,7 @@
}
if (!found_existing_response) {
// Add a server push response to responses map, if it is not in the map.
- quiche::QuicheStringPiece body = push_resource.body;
+ absl::string_view body = push_resource.body;
QUIC_DVLOG(1) << "Add response for push resource: host " << host
<< " path " << path;
AddResponse(host, path, push_resource.headers.Clone(), body);
diff --git a/quic/tools/quic_memory_cache_backend.h b/quic/tools/quic_memory_cache_backend.h
index 1c56ce6..ecf87bc 100644
--- a/quic/tools/quic_memory_cache_backend.h
+++ b/quic/tools/quic_memory_cache_backend.h
@@ -10,13 +10,13 @@
#include <memory>
#include <vector>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/http/spdy_utils.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_containers.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_mutex.h"
#include "net/third_party/quiche/src/quic/tools/quic_backend_response.h"
#include "net/third_party/quiche/src/quic/tools/quic_simple_server_backend.h"
#include "net/third_party/quiche/src/quic/tools/quic_url.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/spdy_framer.h"
namespace quic {
@@ -40,32 +40,30 @@
void Read();
// |base| is |file_name_| with |cache_directory| prefix stripped.
- void SetHostPathFromBase(quiche::QuicheStringPiece base);
+ void SetHostPathFromBase(absl::string_view base);
const std::string& file_name() { return file_name_; }
- quiche::QuicheStringPiece host() { return host_; }
+ absl::string_view host() { return host_; }
- quiche::QuicheStringPiece path() { return path_; }
+ absl::string_view path() { return path_; }
const spdy::SpdyHeaderBlock& spdy_headers() { return spdy_headers_; }
- quiche::QuicheStringPiece body() { return body_; }
+ absl::string_view body() { return body_; }
- const std::vector<quiche::QuicheStringPiece>& push_urls() {
- return push_urls_;
- }
+ const std::vector<absl::string_view>& push_urls() { return push_urls_; }
private:
void HandleXOriginalUrl();
- quiche::QuicheStringPiece RemoveScheme(quiche::QuicheStringPiece url);
+ absl::string_view RemoveScheme(absl::string_view url);
std::string file_name_;
std::string file_contents_;
- quiche::QuicheStringPiece body_;
+ absl::string_view body_;
spdy::SpdyHeaderBlock spdy_headers_;
- quiche::QuicheStringPiece x_original_url_;
- std::vector<quiche::QuicheStringPiece> push_urls_;
+ absl::string_view x_original_url_;
+ std::vector<absl::string_view> push_urls_;
std::string host_;
std::string path_;
};
@@ -77,51 +75,51 @@
// Retrieve a response from this cache for a given host and path..
// If no appropriate response exists, nullptr is returned.
- const QuicBackendResponse* GetResponse(quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path) const;
+ const QuicBackendResponse* GetResponse(absl::string_view host,
+ absl::string_view path) const;
// Adds a simple response to the cache. The response headers will
// only contain the "content-length" header with the length of |body|.
- void AddSimpleResponse(quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path,
+ void AddSimpleResponse(absl::string_view host,
+ absl::string_view path,
int response_code,
- quiche::QuicheStringPiece body);
+ absl::string_view body);
// Add a simple response to the cache as AddSimpleResponse() does, and add
// some server push resources(resource path, corresponding response status and
// path) associated with it.
// Push resource implicitly come from the same host.
void AddSimpleResponseWithServerPushResources(
- quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path,
+ absl::string_view host,
+ absl::string_view path,
int response_code,
- quiche::QuicheStringPiece body,
+ absl::string_view body,
std::list<QuicBackendResponse::ServerPushInfo> push_resources);
// Add a response to the cache.
- void AddResponse(quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path,
+ void AddResponse(absl::string_view host,
+ absl::string_view path,
spdy::SpdyHeaderBlock response_headers,
- quiche::QuicheStringPiece response_body);
+ absl::string_view response_body);
// Add a response, with trailers, to the cache.
- void AddResponse(quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path,
+ void AddResponse(absl::string_view host,
+ absl::string_view path,
spdy::SpdyHeaderBlock response_headers,
- quiche::QuicheStringPiece response_body,
+ absl::string_view response_body,
spdy::SpdyHeaderBlock response_trailers);
// Simulate a special behavior at a particular path.
void AddSpecialResponse(
- quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path,
+ absl::string_view host,
+ absl::string_view path,
QuicBackendResponse::SpecialResponseType response_type);
void AddSpecialResponse(
- quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path,
+ absl::string_view host,
+ absl::string_view path,
spdy::SpdyHeaderBlock response_headers,
- quiche::QuicheStringPiece response_body,
+ absl::string_view response_body,
QuicBackendResponse::SpecialResponseType response_type);
// Sets a default response in case of cache misses. Takes ownership of
@@ -148,21 +146,20 @@
QuicSimpleServerBackend::RequestHandler* quic_server_stream) override;
private:
- void AddResponseImpl(quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path,
+ void AddResponseImpl(absl::string_view host,
+ absl::string_view path,
QuicBackendResponse::SpecialResponseType response_type,
spdy::SpdyHeaderBlock response_headers,
- quiche::QuicheStringPiece response_body,
+ absl::string_view response_body,
spdy::SpdyHeaderBlock response_trailers);
- std::string GetKey(quiche::QuicheStringPiece host,
- quiche::QuicheStringPiece path) const;
+ std::string GetKey(absl::string_view host, absl::string_view path) const;
// Add some server push urls with given responses for specified
// request if these push resources are not associated with this request yet.
void MaybeAddServerPushResources(
- quiche::QuicheStringPiece request_host,
- quiche::QuicheStringPiece request_path,
+ absl::string_view request_host,
+ absl::string_view request_path,
std::list<QuicBackendResponse::ServerPushInfo> push_resources);
// Check if push resource(push_host/push_path) associated with given request
diff --git a/quic/tools/quic_packet_printer_bin.cc b/quic/tools/quic_packet_printer_bin.cc
index 3efedde..a19646f 100644
--- a/quic/tools/quic_packet_printer_bin.cc
+++ b/quic/tools/quic_packet_printer_bin.cc
@@ -32,7 +32,7 @@
#include "net/third_party/quiche/src/quic/core/quic_utils.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "absl/strings/string_view.h"
DEFINE_QUIC_COMMAND_LINE_FLAG(std::string,
quic_version,
@@ -65,9 +65,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 {
std::cerr << "OnRetryPacket\n";
}
bool OnUnauthenticatedPublicHeader(
diff --git a/quic/tools/quic_server.h b/quic/tools/quic_server.h
index 6059ea0..bf1555c 100644
--- a/quic/tools/quic_server.h
+++ b/quic/tools/quic_server.h
@@ -13,6 +13,7 @@
#include <memory>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_crypto_server_config.h"
#include "net/third_party/quiche/src/quic/core/quic_config.h"
#include "net/third_party/quiche/src/quic/core/quic_epoll_connection_helper.h"
@@ -24,7 +25,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h"
#include "net/third_party/quiche/src/quic/tools/quic_simple_server_backend.h"
#include "net/third_party/quiche/src/quic/tools/quic_spdy_server_base.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -81,7 +81,7 @@
crypto_config_.set_chlo_multiplier(multiplier);
}
- void SetPreSharedKey(quiche::QuicheStringPiece key) {
+ void SetPreSharedKey(absl::string_view key) {
crypto_config_.set_pre_shared_key(key);
}
diff --git a/quic/tools/quic_simple_dispatcher.cc b/quic/tools/quic_simple_dispatcher.cc
index c5ba63d..95d5071 100644
--- a/quic/tools/quic_simple_dispatcher.cc
+++ b/quic/tools/quic_simple_dispatcher.cc
@@ -4,8 +4,8 @@
#include "net/third_party/quiche/src/quic/tools/quic_simple_dispatcher.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/tools/quic_simple_server_session.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -52,7 +52,7 @@
QuicConnectionId connection_id,
const QuicSocketAddress& self_address,
const QuicSocketAddress& peer_address,
- quiche::QuicheStringPiece /*alpn*/,
+ absl::string_view /*alpn*/,
const ParsedQuicVersion& version) {
// The QuicServerSessionBase takes ownership of |connection| below.
QuicConnection* connection =
diff --git a/quic/tools/quic_simple_dispatcher.h b/quic/tools/quic_simple_dispatcher.h
index c01359d..d213814 100644
--- a/quic/tools/quic_simple_dispatcher.h
+++ b/quic/tools/quic_simple_dispatcher.h
@@ -5,10 +5,10 @@
#ifndef QUICHE_QUIC_TOOLS_QUIC_SIMPLE_DISPATCHER_H_
#define QUICHE_QUIC_TOOLS_QUIC_SIMPLE_DISPATCHER_H_
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/http/quic_server_session_base.h"
#include "net/third_party/quiche/src/quic/core/quic_dispatcher.h"
#include "net/third_party/quiche/src/quic/tools/quic_simple_server_backend.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -35,7 +35,7 @@
QuicConnectionId connection_id,
const QuicSocketAddress& self_address,
const QuicSocketAddress& peer_address,
- quiche::QuicheStringPiece alpn,
+ absl::string_view alpn,
const ParsedQuicVersion& version) override;
QuicSimpleServerBackend* server_backend() {
diff --git a/quic/tools/quic_simple_server_session_test.cc b/quic/tools/quic_simple_server_session_test.cc
index c591f81..4bc2cc5 100644
--- a/quic/tools/quic_simple_server_session_test.cc
+++ b/quic/tools/quic_simple_server_session_test.cc
@@ -8,6 +8,7 @@
#include <memory>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_crypto_server_config.h"
#include "net/third_party/quiche/src/quic/core/crypto/quic_random.h"
#include "net/third_party/quiche/src/quic/core/http/http_encoder.h"
@@ -35,7 +36,6 @@
#include "net/third_party/quiche/src/quic/tools/quic_backend_response.h"
#include "net/third_party/quiche/src/quic/tools/quic_memory_cache_backend.h"
#include "net/third_party/quiche/src/quic/tools/quic_simple_server_stream.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
using testing::_;
@@ -326,7 +326,7 @@
// Open a stream, then reset it.
// Send two bytes of payload to open it.
QuicStreamFrame data1(GetNthClientInitiatedBidirectionalId(0), false, 0,
- quiche::QuicheStringPiece("HT"));
+ absl::string_view("HT"));
session_->OnStreamFrame(data1);
EXPECT_EQ(1u, QuicSessionPeer::GetNumOpenDynamicStreams(session_.get()));
@@ -382,7 +382,7 @@
// Send two bytes of payload.
QuicStreamFrame data1(GetNthClientInitiatedBidirectionalId(0), false, 0,
- quiche::QuicheStringPiece("HT"));
+ absl::string_view("HT"));
session_->OnStreamFrame(data1);
// The stream should never be opened, now that the reset is received.
@@ -393,9 +393,9 @@
TEST_P(QuicSimpleServerSessionTest, AcceptClosedStream) {
// Send (empty) compressed headers followed by two bytes of data.
QuicStreamFrame frame1(GetNthClientInitiatedBidirectionalId(0), false, 0,
- quiche::QuicheStringPiece("\1\0\0\0\0\0\0\0HT"));
+ absl::string_view("\1\0\0\0\0\0\0\0HT"));
QuicStreamFrame frame2(GetNthClientInitiatedBidirectionalId(1), false, 0,
- quiche::QuicheStringPiece("\3\0\0\0\0\0\0\0HT"));
+ absl::string_view("\3\0\0\0\0\0\0\0HT"));
session_->OnStreamFrame(frame1);
session_->OnStreamFrame(frame2);
EXPECT_EQ(2u, QuicSessionPeer::GetNumOpenDynamicStreams(session_.get()));
@@ -423,9 +423,9 @@
// past the reset point of stream 3. As it's a closed stream we just drop the
// data on the floor, but accept the packet because it has data for stream 5.
QuicStreamFrame frame3(GetNthClientInitiatedBidirectionalId(0), false, 2,
- quiche::QuicheStringPiece("TP"));
+ absl::string_view("TP"));
QuicStreamFrame frame4(GetNthClientInitiatedBidirectionalId(1), false, 2,
- quiche::QuicheStringPiece("TP"));
+ absl::string_view("TP"));
session_->OnStreamFrame(frame3);
session_->OnStreamFrame(frame4);
// The stream should never be opened, now that the reset is received.
@@ -502,7 +502,7 @@
// Receive some data to initiate a incoming stream which should not effect
// creating outgoing streams.
QuicStreamFrame data1(GetNthClientInitiatedBidirectionalId(0), false, 0,
- quiche::QuicheStringPiece("HT"));
+ absl::string_view("HT"));
session_->OnStreamFrame(data1);
EXPECT_EQ(1u, QuicSessionPeer::GetNumOpenDynamicStreams(session_.get()));
EXPECT_EQ(0u, QuicSessionPeer::GetNumOpenDynamicStreams(session_.get()) -
@@ -551,7 +551,7 @@
// Create peer initiated stream should have no problem.
QuicStreamFrame data2(GetNthClientInitiatedBidirectionalId(1), false, 0,
- quiche::QuicheStringPiece("HT"));
+ absl::string_view("HT"));
session_->OnStreamFrame(data2);
EXPECT_EQ(2u, QuicSessionPeer::GetNumOpenDynamicStreams(session_.get()) -
/*outcoming=*/kMaxStreamsForTest);
@@ -559,7 +559,7 @@
TEST_P(QuicSimpleServerSessionTest, OnStreamFrameWithEvenStreamId) {
QuicStreamFrame frame(GetNthServerInitiatedUnidirectionalId(0), false, 0,
- quiche::QuicheStringPiece());
+ absl::string_view());
EXPECT_CALL(*connection_,
CloseConnection(QUIC_INVALID_STREAM_ID,
"Client sent data on server push stream", _));
diff --git a/quic/tools/quic_simple_server_stream.cc b/quic/tools/quic_simple_server_stream.cc
index 84ddb05..1806fae 100644
--- a/quic/tools/quic_simple_server_stream.cc
+++ b/quic/tools/quic_simple_server_stream.cc
@@ -7,6 +7,7 @@
#include <list>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/http/quic_spdy_stream.h"
#include "net/third_party/quiche/src/quic/core/http/spdy_utils.h"
#include "net/third_party/quiche/src/quic/core/quic_utils.h"
@@ -15,7 +16,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/tools/quic_simple_server_session.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
#include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
@@ -323,7 +323,7 @@
void QuicSimpleServerStream::SendIncompleteResponse(
SpdyHeaderBlock response_headers,
- quiche::QuicheStringPiece body) {
+ absl::string_view body) {
QUIC_DLOG(INFO) << "Stream " << id() << " writing headers (fin = false) : "
<< response_headers.DebugString();
WriteHeaders(std::move(response_headers), /*fin=*/false, nullptr);
@@ -337,14 +337,14 @@
void QuicSimpleServerStream::SendHeadersAndBody(
SpdyHeaderBlock response_headers,
- quiche::QuicheStringPiece body) {
+ absl::string_view body) {
SendHeadersAndBodyAndTrailers(std::move(response_headers), body,
SpdyHeaderBlock());
}
void QuicSimpleServerStream::SendHeadersAndBodyAndTrailers(
SpdyHeaderBlock response_headers,
- quiche::QuicheStringPiece body,
+ absl::string_view body,
SpdyHeaderBlock response_trailers) {
// Send the headers, with a FIN if there's nothing else to send.
bool send_fin = (body.empty() && response_trailers.empty());
diff --git a/quic/tools/quic_simple_server_stream.h b/quic/tools/quic_simple_server_stream.h
index add4a12..254fe8d 100644
--- a/quic/tools/quic_simple_server_stream.h
+++ b/quic/tools/quic_simple_server_stream.h
@@ -5,11 +5,11 @@
#ifndef QUICHE_QUIC_TOOLS_QUIC_SIMPLE_SERVER_STREAM_H_
#define QUICHE_QUIC_TOOLS_QUIC_SIMPLE_SERVER_STREAM_H_
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/http/quic_spdy_server_stream_base.h"
#include "net/third_party/quiche/src/quic/core/quic_packets.h"
#include "net/third_party/quiche/src/quic/tools/quic_backend_response.h"
#include "net/third_party/quiche/src/quic/tools/quic_simple_server_backend.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/spdy_framer.h"
namespace quic {
@@ -77,12 +77,12 @@
// Sends the response header and body, but not the fin.
void SendIncompleteResponse(spdy::SpdyHeaderBlock response_headers,
- quiche::QuicheStringPiece body);
+ absl::string_view body);
void SendHeadersAndBody(spdy::SpdyHeaderBlock response_headers,
- quiche::QuicheStringPiece body);
+ absl::string_view body);
void SendHeadersAndBodyAndTrailers(spdy::SpdyHeaderBlock response_headers,
- quiche::QuicheStringPiece body,
+ absl::string_view body,
spdy::SpdyHeaderBlock response_trailers);
spdy::SpdyHeaderBlock* request_headers() { return &request_headers_; }
diff --git a/quic/tools/quic_simple_server_stream_test.cc b/quic/tools/quic_simple_server_stream_test.cc
index f5c1b53..8a59139 100644
--- a/quic/tools/quic_simple_server_stream_test.cc
+++ b/quic/tools/quic_simple_server_stream_test.cc
@@ -8,6 +8,7 @@
#include <memory>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/http/http_encoder.h"
#include "net/third_party/quiche/src/quic/core/http/spdy_utils.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
@@ -28,7 +29,6 @@
#include "net/third_party/quiche/src/quic/tools/quic_simple_server_session.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;
@@ -75,7 +75,7 @@
const std::string& body() const { return body_; }
int content_length() const { return content_length_; }
- quiche::QuicheStringPiece GetHeader(quiche::QuicheStringPiece key) const {
+ absl::string_view GetHeader(absl::string_view key) const {
auto it = request_headers_.find(key);
DCHECK(it != request_headers_.end());
return it->second;
@@ -629,8 +629,7 @@
spdy::SpdyHeaderBlock request_headers;
// \000 is a way to write the null byte when followed by a literal digit.
- header_list_.OnHeader("content-length",
- quiche::QuicheStringPiece("11\00012", 5));
+ header_list_.OnHeader("content-length", absl::string_view("11\00012", 5));
EXPECT_CALL(*stream_, WriteHeadersMock(false));
EXPECT_CALL(session_, WritevData(_, _, _, _, _, _))
@@ -648,8 +647,7 @@
spdy::SpdyHeaderBlock request_headers;
// \000 is a way to write the null byte when followed by a literal digit.
- header_list_.OnHeader("content-length",
- quiche::QuicheStringPiece("\00012", 3));
+ header_list_.OnHeader("content-length", absl::string_view("\00012", 3));
EXPECT_CALL(*stream_, WriteHeadersMock(false));
EXPECT_CALL(session_, WritevData(_, _, _, _, _, _))
@@ -665,8 +663,7 @@
TEST_P(QuicSimpleServerStreamTest, ValidMultipleContentLength) {
spdy::SpdyHeaderBlock request_headers;
// \000 is a way to write the null byte when followed by a literal digit.
- header_list_.OnHeader("content-length",
- quiche::QuicheStringPiece("11\00011", 5));
+ header_list_.OnHeader("content-length", absl::string_view("11\00011", 5));
stream_->OnStreamHeaderList(false, kFakeFrameLen, header_list_);
@@ -730,7 +727,7 @@
0x54, 0x54, 0x50, 0x2f, // TTP/
0x31, 0x2e, 0x31, // 1.1
};
- quiche::QuicheStringPiece data(arr, QUICHE_ARRAYSIZE(arr));
+ absl::string_view data(arr, QUICHE_ARRAYSIZE(arr));
QuicStreamFrame frame(stream_->id(), true, 0, data);
// Verify that we don't crash when we get a invalid headers in stream frame.
stream_->OnStreamFrame(frame);
diff --git a/quic/tools/quic_spdy_client_base.cc b/quic/tools/quic_spdy_client_base.cc
index 212e605..273d067 100644
--- a/quic/tools/quic_spdy_client_base.cc
+++ b/quic/tools/quic_spdy_client_base.cc
@@ -6,12 +6,12 @@
#include <utility>
+#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/http/spdy_utils.h"
#include "net/third_party/quiche/src/quic/core/quic_server_id.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
using spdy::SpdyHeaderBlock;
@@ -25,7 +25,7 @@
QuicSpdyClientBase::QuicDataToResend::QuicDataToResend(
std::unique_ptr<SpdyHeaderBlock> headers,
- quiche::QuicheStringPiece body,
+ absl::string_view body,
bool fin)
: headers_(std::move(headers)), body_(body), fin_(fin) {}
@@ -114,7 +114,7 @@
}
void QuicSpdyClientBase::SendRequest(const SpdyHeaderBlock& headers,
- quiche::QuicheStringPiece body,
+ absl::string_view body,
bool fin) {
if (GetQuicFlag(FLAGS_quic_client_convert_http_header_name_to_lowercase)) {
QUIC_CODE_COUNT(quic_client_convert_http_header_name_to_lowercase);
@@ -130,7 +130,7 @@
}
void QuicSpdyClientBase::SendRequestInternal(SpdyHeaderBlock sanitized_headers,
- quiche::QuicheStringPiece body,
+ absl::string_view body,
bool fin) {
QuicClientPushPromiseIndex::TryHandle* handle;
QuicAsyncStatus rv =
@@ -154,7 +154,7 @@
void QuicSpdyClientBase::SendRequestAndWaitForResponse(
const SpdyHeaderBlock& headers,
- quiche::QuicheStringPiece body,
+ absl::string_view body,
bool fin) {
SendRequest(headers, body, fin);
while (WaitForEvents()) {
@@ -233,7 +233,7 @@
}
void QuicSpdyClientBase::AddPromiseDataToResend(const SpdyHeaderBlock& headers,
- quiche::QuicheStringPiece body,
+ absl::string_view body,
bool fin) {
std::unique_ptr<SpdyHeaderBlock> new_headers(
new SpdyHeaderBlock(headers.Clone()));
diff --git a/quic/tools/quic_spdy_client_base.h b/quic/tools/quic_spdy_client_base.h
index fdd67fb..ca59431 100644
--- a/quic/tools/quic_spdy_client_base.h
+++ b/quic/tools/quic_spdy_client_base.h
@@ -10,6 +10,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/http/quic_client_push_promise_index.h"
#include "net/third_party/quiche/src/quic/core/http/quic_spdy_client_session.h"
@@ -17,7 +18,6 @@
#include "net/third_party/quiche/src/quic/core/quic_config.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h"
#include "net/third_party/quiche/src/quic/tools/quic_client_base.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -47,7 +47,7 @@
public:
// |headers| may be null, since it's possible to send data without headers.
QuicDataToResend(std::unique_ptr<spdy::SpdyHeaderBlock> headers,
- quiche::QuicheStringPiece body,
+ absl::string_view body,
bool fin);
QuicDataToResend(const QuicDataToResend&) = delete;
QuicDataToResend& operator=(const QuicDataToResend&) = delete;
@@ -60,7 +60,7 @@
protected:
std::unique_ptr<spdy::SpdyHeaderBlock> headers_;
- quiche::QuicheStringPiece body_;
+ absl::string_view body_;
bool fin_;
};
@@ -86,12 +86,12 @@
// Sends an HTTP request and does not wait for response before returning.
void SendRequest(const spdy::SpdyHeaderBlock& headers,
- quiche::QuicheStringPiece body,
+ absl::string_view body,
bool fin);
// Sends an HTTP request and waits for response before returning.
void SendRequestAndWaitForResponse(const spdy::SpdyHeaderBlock& headers,
- quiche::QuicheStringPiece body,
+ absl::string_view body,
bool fin);
// Sends a request simple GET for each URL in |url_list|, and then waits for
@@ -162,7 +162,7 @@
void ResendSavedData() override;
void AddPromiseDataToResend(const spdy::SpdyHeaderBlock& headers,
- quiche::QuicheStringPiece body,
+ absl::string_view body,
bool fin);
bool HasActiveRequests() override;
@@ -171,7 +171,7 @@
class ClientQuicDataToResend : public QuicDataToResend {
public:
ClientQuicDataToResend(std::unique_ptr<spdy::SpdyHeaderBlock> headers,
- quiche::QuicheStringPiece body,
+ absl::string_view body,
bool fin,
QuicSpdyClientBase* client)
: QuicDataToResend(std::move(headers), body, fin), client_(client) {
@@ -190,7 +190,7 @@
};
void SendRequestInternal(spdy::SpdyHeaderBlock sanitized_headers,
- quiche::QuicheStringPiece body,
+ absl::string_view body,
bool fin);
// Index of pending promised streams. Must outlive |session_|.
diff --git a/quic/tools/quic_toy_client.cc b/quic/tools/quic_toy_client.cc
index 582f3c7..06c4d17 100644
--- a/quic/tools/quic_toy_client.cc
+++ b/quic/tools/quic_toy_client.cc
@@ -48,6 +48,7 @@
#include <utility>
#include <vector>
+#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_server_id.h"
#include "net/third_party/quiche/src/quic/core/quic_utils.h"
@@ -58,13 +59,11 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_system_event_loop.h"
#include "net/third_party/quiche/src/quic/tools/fake_proof_verifier.h"
#include "net/third_party/quiche/src/quic/tools/quic_url.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 {
using quic::QuicUrl;
-using quiche::QuicheStringPiece;
using quiche::QuicheTextUtils;
} // namespace
@@ -334,12 +333,12 @@
// Append any additional headers supplied on the command line.
const std::string headers = GetQuicFlag(FLAGS_headers);
- for (QuicheStringPiece sp : QuicheTextUtils::Split(headers, ';')) {
+ for (absl::string_view sp : QuicheTextUtils::Split(headers, ';')) {
QuicheTextUtils::RemoveLeadingAndTrailingWhitespace(&sp);
if (sp.empty()) {
continue;
}
- std::vector<QuicheStringPiece> kv = QuicheTextUtils::Split(sp, ':');
+ std::vector<absl::string_view> kv = QuicheTextUtils::Split(sp, ':');
QuicheTextUtils::RemoveLeadingAndTrailingWhitespace(&kv[0]);
QuicheTextUtils::RemoveLeadingAndTrailingWhitespace(&kv[1]);
header_block[kv[0]] = kv[1];
diff --git a/quic/tools/quic_transport_simple_server_dispatcher.cc b/quic/tools/quic_transport_simple_server_dispatcher.cc
index 35108c9..ec52d3a 100644
--- a/quic/tools/quic_transport_simple_server_dispatcher.cc
+++ b/quic/tools/quic_transport_simple_server_dispatcher.cc
@@ -6,12 +6,12 @@
#include <memory>
+#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_dispatcher.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quic/core/quic_versions.h"
#include "net/third_party/quiche/src/quic/tools/quic_transport_simple_server_session.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -38,7 +38,7 @@
QuicConnectionId server_connection_id,
const QuicSocketAddress& self_address,
const QuicSocketAddress& peer_address,
- quiche::QuicheStringPiece /*alpn*/,
+ absl::string_view /*alpn*/,
const ParsedQuicVersion& version) {
auto connection = std::make_unique<QuicConnection>(
server_connection_id, self_address, peer_address, helper(),
diff --git a/quic/tools/quic_transport_simple_server_dispatcher.h b/quic/tools/quic_transport_simple_server_dispatcher.h
index da27585..62e4432 100644
--- a/quic/tools/quic_transport_simple_server_dispatcher.h
+++ b/quic/tools/quic_transport_simple_server_dispatcher.h
@@ -5,10 +5,10 @@
#ifndef QUICHE_QUIC_TOOLS_QUIC_TRANSPORT_SIMPLE_SERVER_DISPATCHER_H_
#define QUICHE_QUIC_TOOLS_QUIC_TRANSPORT_SIMPLE_SERVER_DISPATCHER_H_
+#include "absl/strings/string_view.h"
#include "url/origin.h"
#include "net/third_party/quiche/src/quic/core/quic_dispatcher.h"
#include "net/third_party/quiche/src/quic/tools/quic_transport_simple_server_session.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace quic {
@@ -31,7 +31,7 @@
QuicConnectionId server_connection_id,
const QuicSocketAddress& self_address,
const QuicSocketAddress& peer_address,
- quiche::QuicheStringPiece alpn,
+ absl::string_view alpn,
const ParsedQuicVersion& version) override;
std::vector<url::Origin> accepted_origins_;
diff --git a/quic/tools/quic_transport_simple_server_session.cc b/quic/tools/quic_transport_simple_server_session.cc
index d07da11..386bd00 100644
--- a/quic/tools/quic_transport_simple_server_session.cc
+++ b/quic/tools/quic_transport_simple_server_session.cc
@@ -226,7 +226,7 @@
}
void QuicTransportSimpleServerSession::OnMessageReceived(
- quiche::QuicheStringPiece message) {
+ absl::string_view message) {
if (mode_ != ECHO) {
return;
}
diff --git a/quic/tools/quic_transport_simple_server_session.h b/quic/tools/quic_transport_simple_server_session.h
index 7cfd197..fc018fb 100644
--- a/quic/tools/quic_transport_simple_server_session.h
+++ b/quic/tools/quic_transport_simple_server_session.h
@@ -58,7 +58,7 @@
void OnCanCreateNewOutgoingStream(bool unidirectional) override;
bool CheckOrigin(url::Origin origin) override;
bool ProcessPath(const GURL& url) override;
- void OnMessageReceived(quiche::QuicheStringPiece message) override;
+ void OnMessageReceived(absl::string_view message) override;
void EchoStreamBack(const std::string& data) {
streams_to_echo_back_.push_back(data);
diff --git a/quic/tools/quic_url.cc b/quic/tools/quic_url.cc
index 438847c..9f9e98a 100644
--- a/quic/tools/quic_url.cc
+++ b/quic/tools/quic_url.cc
@@ -4,18 +4,16 @@
#include "net/third_party/quiche/src/quic/tools/quic_url.h"
+#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 {
static constexpr size_t kMaxHostNameLength = 256;
-QuicUrl::QuicUrl(quiche::QuicheStringPiece url)
- : url_(static_cast<std::string>(url)) {}
+QuicUrl::QuicUrl(absl::string_view url) : url_(static_cast<std::string>(url)) {}
-QuicUrl::QuicUrl(quiche::QuicheStringPiece url,
- quiche::QuicheStringPiece default_scheme)
+QuicUrl::QuicUrl(absl::string_view url, absl::string_view default_scheme)
: QuicUrl(url) {
if (url_.has_scheme()) {
return;
diff --git a/quic/tools/quic_url.h b/quic/tools/quic_url.h
index 4b057db..ca4ac8e 100644
--- a/quic/tools/quic_url.h
+++ b/quic/tools/quic_url.h
@@ -7,9 +7,9 @@
#include <string>
+#include "absl/strings/string_view.h"
#include "url/gurl.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 {
@@ -24,12 +24,11 @@
// NOTE: If |url| doesn't have a scheme, it will have an empty scheme
// field. If that's not what you want, use the QuicUrlImpl(url,
// default_scheme) form below.
- explicit QuicUrl(quiche::QuicheStringPiece url);
+ explicit QuicUrl(absl::string_view url);
// Constructs a QuicUrlImpl from |url|, assuming that the scheme for the URL
// is |default_scheme| if there is no scheme specified in |url|.
- QuicUrl(quiche::QuicheStringPiece url,
- quiche::QuicheStringPiece default_scheme);
+ QuicUrl(absl::string_view url, absl::string_view default_scheme);
// Returns false if the URL is not valid.
bool IsValid() const;
diff --git a/quic/tools/simple_ticket_crypter.cc b/quic/tools/simple_ticket_crypter.cc
index 3da114e..b742dbf 100644
--- a/quic/tools/simple_ticket_crypter.cc
+++ b/quic/tools/simple_ticket_crypter.cc
@@ -38,8 +38,7 @@
return kEpochSize + kIVSize + kAuthTagSize;
}
-std::vector<uint8_t> SimpleTicketCrypter::Encrypt(
- quiche::QuicheStringPiece in) {
+std::vector<uint8_t> SimpleTicketCrypter::Encrypt(absl::string_view in) {
MaybeRotateKeys();
std::vector<uint8_t> out(in.size() + MaxOverhead());
out[0] = key_epoch_;
@@ -56,8 +55,7 @@
return out;
}
-std::vector<uint8_t> SimpleTicketCrypter::Decrypt(
- quiche::QuicheStringPiece in) {
+std::vector<uint8_t> SimpleTicketCrypter::Decrypt(absl::string_view in) {
MaybeRotateKeys();
if (in.size() < kMessageOffset) {
return std::vector<uint8_t>();
@@ -83,7 +81,7 @@
}
void SimpleTicketCrypter::Decrypt(
- quiche::QuicheStringPiece in,
+ absl::string_view in,
std::unique_ptr<quic::ProofSource::DecryptCallback> callback) {
callback->Run(Decrypt(in));
}
diff --git a/quic/tools/simple_ticket_crypter.h b/quic/tools/simple_ticket_crypter.h
index 330c509..c150ae2 100644
--- a/quic/tools/simple_ticket_crypter.h
+++ b/quic/tools/simple_ticket_crypter.h
@@ -24,13 +24,13 @@
~SimpleTicketCrypter() override;
size_t MaxOverhead() override;
- std::vector<uint8_t> Encrypt(quiche::QuicheStringPiece in) override;
+ std::vector<uint8_t> Encrypt(absl::string_view in) override;
void Decrypt(
- quiche::QuicheStringPiece in,
+ absl::string_view in,
std::unique_ptr<quic::ProofSource::DecryptCallback> callback) override;
private:
- std::vector<uint8_t> Decrypt(quiche::QuicheStringPiece in);
+ std::vector<uint8_t> Decrypt(absl::string_view in);
void MaybeRotateKeys();
diff --git a/quic/tools/simple_ticket_crypter_test.cc b/quic/tools/simple_ticket_crypter_test.cc
index e609dc0..568fa2b 100644
--- a/quic/tools/simple_ticket_crypter_test.cc
+++ b/quic/tools/simple_ticket_crypter_test.cc
@@ -26,9 +26,8 @@
std::vector<uint8_t>* out_;
};
-quiche::QuicheStringPiece StringPiece(const std::vector<uint8_t>& in) {
- return quiche::QuicheStringPiece(reinterpret_cast<const char*>(in.data()),
- in.size());
+absl::string_view StringPiece(const std::vector<uint8_t>& in) {
+ return absl::string_view(reinterpret_cast<const char*>(in.data()), in.size());
}
class SimpleTicketCrypterTest : public QuicTest {
@@ -81,7 +80,7 @@
TEST_F(SimpleTicketCrypterTest, DecryptionFailureWithEmptyCiphertext) {
std::vector<uint8_t> out_plaintext;
- ticket_crypter_.Decrypt(quiche::QuicheStringPiece(),
+ ticket_crypter_.Decrypt(absl::string_view(),
std::make_unique<DecryptCallback>(&out_plaintext));
EXPECT_TRUE(out_plaintext.empty());
}