Use quiche string libraries in third_party/quic/core

gfe-relnote: n/a, no functional change
PiperOrigin-RevId: 285401547
Change-Id: Ice6d421ff7058fe2d47aee426d7634b6d403ee3f
diff --git a/quic/core/chlo_extractor.cc b/quic/core/chlo_extractor.cc
index 0430f8d..d2a0608 100644
--- a/quic/core/chlo_extractor.cc
+++ b/quic/core/chlo_extractor.cc
@@ -13,8 +13,8 @@
 #include "net/third_party/quiche/src/quic/core/crypto/quic_encrypter.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_string_piece.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_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 {
 
@@ -38,7 +38,7 @@
       const QuicVersionNegotiationPacket& /*packet*/) override {}
   void OnRetryPacket(QuicConnectionId /*original_connection_id*/,
                      QuicConnectionId /*new_connection_id*/,
-                     QuicStringPiece /*retry_token*/) override {}
+                     quiche::QuicheStringPiece /*retry_token*/) override {}
   bool OnUnauthenticatedPublicHeader(const QuicPacketHeader& header) override;
   bool OnUnauthenticatedHeader(const QuicPacketHeader& header) override;
   void OnDecryptedPacket(EncryptionLevel /*level*/) override {}
@@ -83,7 +83,7 @@
   void OnHandshakeMessage(const CryptoHandshakeMessage& message) override;
 
   // Shared implementation between OnStreamFrame and OnCryptoFrame.
-  bool OnHandshakeData(QuicStringPiece data);
+  bool OnHandshakeData(quiche::QuicheStringPiece data);
 
   bool found_chlo() { return found_chlo_; }
   bool chlo_contains_tags() { return chlo_contains_tags_; }
@@ -147,10 +147,10 @@
     // CHLO will be sent in CRYPTO frames in v47 and above.
     return false;
   }
-  QuicStringPiece data(frame.data_buffer, frame.data_length);
+  quiche::QuicheStringPiece data(frame.data_buffer, frame.data_length);
   if (QuicUtils::IsCryptoStreamId(framer_->transport_version(),
                                   frame.stream_id) &&
-      frame.offset == 0 && QuicTextUtils::StartsWith(data, "CHLO")) {
+      frame.offset == 0 && quiche::QuicheTextUtils::StartsWith(data, "CHLO")) {
     return OnHandshakeData(data);
   }
   return true;
@@ -161,14 +161,14 @@
     // CHLO will be in stream frames before v47.
     return false;
   }
-  QuicStringPiece data(frame.data_buffer, frame.data_length);
-  if (frame.offset == 0 && QuicTextUtils::StartsWith(data, "CHLO")) {
+  quiche::QuicheStringPiece data(frame.data_buffer, frame.data_length);
+  if (frame.offset == 0 && quiche::QuicheTextUtils::StartsWith(data, "CHLO")) {
     return OnHandshakeData(data);
   }
   return true;
 }
 
-bool ChloFramerVisitor::OnHandshakeData(QuicStringPiece data) {
+bool ChloFramerVisitor::OnHandshakeData(quiche::QuicheStringPiece 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 aab0f65..d556f7a 100644
--- a/quic/core/chlo_extractor_test.cc
+++ b/quic/core/chlo_extractor_test.cc
@@ -14,6 +14,7 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
 #include "net/third_party/quiche/src/quic/test_tools/crypto_test_utils.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 {
@@ -60,7 +61,7 @@
   }
 
   void MakePacket(ParsedQuicVersion version,
-                  QuicStringPiece data,
+                  quiche::QuicheStringPiece data,
                   bool munge_offset,
                   bool munge_stream_id) {
     QuicFrames frames;
diff --git a/quic/core/congestion_control/bbr2_simulator_test.cc b/quic/core/congestion_control/bbr2_simulator_test.cc
index 811161d..19d68b2 100644
--- a/quic/core/congestion_control/bbr2_simulator_test.cc
+++ b/quic/core/congestion_control/bbr2_simulator_test.cc
@@ -25,6 +25,7 @@
 #include "net/third_party/quiche/src/quic/test_tools/simulator/simulator.h"
 #include "net/third_party/quiche/src/quic/test_tools/simulator/switch.h"
 #include "net/third_party/quiche/src/quic/test_tools/simulator/traffic_policer.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
 
 using testing::AllOf;
 using testing::Ge;
@@ -804,8 +805,8 @@
     uint64_t first_connection_id = 42;
     std::vector<simulator::QuicEndpointBase*> receiver_endpoint_pointers;
     for (size_t i = 0; i < MultiSenderTopologyParams::kNumLocalLinks; ++i) {
-      std::string sender_name = QuicStrCat("Sender", i + 1);
-      std::string receiver_name = QuicStrCat("Receiver", i + 1);
+      std::string sender_name = quiche::QuicheStrCat("Sender", i + 1);
+      std::string receiver_name = quiche::QuicheStrCat("Receiver", i + 1);
       sender_endpoints_.push_back(std::make_unique<simulator::QuicEndpoint>(
           &simulator_, sender_name, receiver_name, Perspective::IS_CLIENT,
           TestConnectionId(first_connection_id + i)));
diff --git a/quic/core/congestion_control/cubic_bytes_test.cc b/quic/core/congestion_control/cubic_bytes_test.cc
index 4f3e9b1..7a48ddf 100644
--- a/quic/core/congestion_control/cubic_bytes_test.cc
+++ b/quic/core/congestion_control/cubic_bytes_test.cc
@@ -7,7 +7,6 @@
 #include <cstdint>
 
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
 #include "net/third_party/quiche/src/quic/test_tools/mock_clock.h"
 
diff --git a/quic/core/congestion_control/send_algorithm_test.cc b/quic/core/congestion_control/send_algorithm_test.cc
index b363813..150ac1a 100644
--- a/quic/core/congestion_control/send_algorithm_test.cc
+++ b/quic/core/congestion_control/send_algorithm_test.cc
@@ -13,7 +13,6 @@
 #include "net/third_party/quiche/src/quic/core/quic_types.h"
 #include "net/third_party/quiche/src/quic/core/quic_utils.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
 #include "net/third_party/quiche/src/quic/test_tools/mock_clock.h"
 #include "net/third_party/quiche/src/quic/test_tools/quic_config_peer.h"
@@ -23,6 +22,7 @@
 #include "net/third_party/quiche/src/quic/test_tools/simulator/quic_endpoint.h"
 #include "net/third_party/quiche/src/quic/test_tools/simulator/simulator.h"
 #include "net/third_party/quiche/src/quic/test_tools/simulator/switch.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
 
 namespace quic {
 namespace test {
@@ -134,7 +134,7 @@
 
 std::string TestParamToString(
     const testing::TestParamInfo<TestParams>& params) {
-  return QuicStrCat(
+  return quiche::QuicheStrCat(
       CongestionControlTypeToString(params.param.congestion_control_type), "_");
 }
 
diff --git a/quic/core/legacy_quic_stream_id_manager.cc b/quic/core/legacy_quic_stream_id_manager.cc
index b8498b3..6e8f13a 100644
--- a/quic/core/legacy_quic_stream_id_manager.cc
+++ b/quic/core/legacy_quic_stream_id_manager.cc
@@ -8,6 +8,7 @@
 #include "net/third_party/quiche/src/quic/core/quic_utils.h"
 #include "net/third_party/quiche/src/quic/core/quic_versions.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_map_util.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
 
 namespace quic {
 
diff --git a/quic/core/quic_bandwidth.cc b/quic/core/quic_bandwidth.cc
index 9fcc3b9..ad2c032 100644
--- a/quic/core/quic_bandwidth.cc
+++ b/quic/core/quic_bandwidth.cc
@@ -7,14 +7,16 @@
 #include <cinttypes>
 #include <string>
 
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.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 {
 
 std::string QuicBandwidth::ToDebuggingValue() const {
   if (bits_per_second_ < 80000) {
-    return QuicStringPrintf("%" PRId64 " bits/s (%" PRId64 " bytes/s)",
-                            bits_per_second_, bits_per_second_ / 8);
+    return quiche::QuicheStringPrintf("%" PRId64 " bits/s (%" PRId64
+                                      " bytes/s)",
+                                      bits_per_second_, bits_per_second_ / 8);
   }
 
   double divisor;
@@ -32,9 +34,9 @@
 
   double bits_per_second_with_unit = bits_per_second_ / divisor;
   double bytes_per_second_with_unit = bits_per_second_with_unit / 8;
-  return QuicStringPrintf("%.2f %cbits/s (%.2f %cbytes/s)",
-                          bits_per_second_with_unit, unit,
-                          bytes_per_second_with_unit, unit);
+  return quiche::QuicheStringPrintf("%.2f %cbits/s (%.2f %cbytes/s)",
+                                    bits_per_second_with_unit, unit,
+                                    bytes_per_second_with_unit, unit);
 }
 
 }  // namespace quic
diff --git a/quic/core/quic_config.cc b/quic/core/quic_config.cc
index 3d8fe3f..d5c4d33 100644
--- a/quic/core/quic_config.cc
+++ b/quic/core/quic_config.cc
@@ -20,8 +20,8 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.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/quic/platform/api/quic_string_piece.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 {
 
@@ -380,7 +380,7 @@
     const CryptoHandshakeMessage& peer_hello,
     HelloType /*hello_type*/,
     std::string* error_details) {
-  QuicStringPiece address;
+  quiche::QuicheStringPiece 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 6ff097e..1d176d7 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -34,9 +34,10 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_map_util.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_string_utils.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_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 {
 
@@ -606,7 +607,7 @@
   }
 
   if (QuicContainsValue(packet.versions, version())) {
-    const std::string error_details = QuicStrCat(
+    const std::string error_details = quiche::QuicheStrCat(
         "Server already supports client's version ",
         ParsedQuicVersionToString(version()),
         " and should have accepted the connection instead of sending {",
@@ -620,7 +621,7 @@
   server_supported_versions_ = packet.versions;
   CloseConnection(
       QUIC_INVALID_VERSION,
-      QuicStrCat(
+      quiche::QuicheStrCat(
           "Client may support one of the versions in the server's list, but "
           "it's going to close the connection anyway. Supported versions: {",
           ParsedQuicVersionVectorToString(framer_.supported_versions()),
@@ -632,18 +633,18 @@
 // Handles retry for client connection.
 void QuicConnection::OnRetryPacket(QuicConnectionId original_connection_id,
                                    QuicConnectionId new_connection_id,
-                                   QuicStringPiece retry_token) {
+                                   quiche::QuicheStringPiece retry_token) {
   DCHECK_EQ(Perspective::IS_CLIENT, perspective_);
   if (original_connection_id != server_connection_id_) {
     QUIC_DLOG(ERROR) << "Ignoring RETRY with original connection ID "
                      << original_connection_id << " not matching expected "
                      << server_connection_id_ << " token "
-                     << QuicTextUtils::HexEncode(retry_token);
+                     << quiche::QuicheTextUtils::HexEncode(retry_token);
     return;
   }
   if (retry_has_been_parsed_) {
     QUIC_DLOG(ERROR) << "Ignoring non-first RETRY with token "
-                     << QuicTextUtils::HexEncode(retry_token);
+                     << quiche::QuicheTextUtils::HexEncode(retry_token);
     return;
   }
   retry_has_been_parsed_ = true;
@@ -651,7 +652,7 @@
   QUIC_DLOG(INFO) << "Received RETRY, replacing connection ID "
                   << server_connection_id_ << " with " << new_connection_id
                   << ", received token "
-                  << QuicTextUtils::HexEncode(retry_token);
+                  << quiche::QuicheTextUtils::HexEncode(retry_token);
   server_connection_id_ = new_connection_id;
   packet_creator_.SetServerConnectionId(server_connection_id_);
   packet_creator_.SetRetryToken(retry_token);
@@ -763,9 +764,9 @@
       if (!header.version_flag) {
         // Packets should have the version flag till version negotiation is
         // done.
-        std::string error_details =
-            QuicStrCat(ENDPOINT, "Packet ", header.packet_number.ToUint64(),
-                       " without version flag before version negotiated.");
+        std::string error_details = quiche::QuicheStrCat(
+            ENDPOINT, "Packet ", header.packet_number.ToUint64(),
+            " without version flag before version negotiated.");
         QUIC_DLOG(WARNING) << error_details;
         CloseConnection(QUIC_INVALID_VERSION, error_details,
                         ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
@@ -1349,7 +1350,7 @@
     debug_visitor_->OnMessageFrame(frame);
   }
   visitor_->OnMessageReceived(
-      QuicStringPiece(frame.data, frame.message_length));
+      quiche::QuicheStringPiece(frame.data, frame.message_length));
   should_last_packet_instigate_acks_ = true;
   return connected_;
 }
@@ -1501,12 +1502,12 @@
           sent_packet_manager_.GetLeastUnacked() + max_tracked_packets_) {
     CloseConnection(
         QUIC_TOO_MANY_OUTSTANDING_SENT_PACKETS,
-        QuicStrCat("More than ", max_tracked_packets_,
-                   " outstanding, least_unacked: ",
-                   sent_packet_manager_.GetLeastUnacked().ToUint64(),
-                   ", packets_processed: ", stats_.packets_processed,
-                   ", last_decrypted_packet_level: ",
-                   EncryptionLevelToString(last_decrypted_packet_level_)),
+        quiche::QuicheStrCat(
+            "More than ", max_tracked_packets_, " outstanding, least_unacked: ",
+            sent_packet_manager_.GetLeastUnacked().ToUint64(),
+            ", packets_processed: ", stats_.packets_processed,
+            ", last_decrypted_packet_level: ",
+            EncryptionLevelToString(last_decrypted_packet_level_)),
         ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
   }
 }
@@ -1576,7 +1577,7 @@
   QUIC_DVLOG(2) << ENDPOINT << "Sending version negotiation packet: {"
                 << ParsedQuicVersionVectorToString(framer_.supported_versions())
                 << "}, " << (ietf_quic ? "" : "!") << "ietf_quic:" << std::endl
-                << QuicTextUtils::HexDump(QuicStringPiece(
+                << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
                        version_packet->data(), version_packet->length()));
   WriteResult result = writer_->WritePacket(
       version_packet->data(), version_packet->length(), self_address().host(),
@@ -1753,8 +1754,8 @@
   }
   QUIC_DVLOG(2) << ENDPOINT << "Received encrypted " << packet.length()
                 << " bytes:" << std::endl
-                << QuicTextUtils::HexDump(
-                       QuicStringPiece(packet.data(), packet.length()));
+                << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
+                       packet.data(), packet.length()));
   QUIC_BUG_IF(current_packet_data_ != nullptr)
       << "ProcessUdpPacket must not be called while processing a packet.";
   if (debug_visitor_ != nullptr) {
@@ -2198,7 +2199,7 @@
                 << ", encrypted length:" << encrypted_length
                 << ", fate: " << SerializedPacketFateToString(fate);
   QUIC_DVLOG(2) << ENDPOINT << "packet(" << packet_number << "): " << std::endl
-                << QuicTextUtils::HexDump(QuicStringPiece(
+                << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
                        packet->encrypted_buffer, encrypted_length));
 
   // Measure the RTT from before the write begins to avoid underestimating the
@@ -2430,7 +2431,7 @@
   }
   write_error_occurred_ = true;
 
-  const std::string error_details = QuicStrCat(
+  const std::string error_details = quiche::QuicheStrCat(
       "Write failed with error: ", error_code, " (", strerror(error_code), ")");
   QUIC_LOG_FIRST_N(ERROR, 2) << ENDPOINT << error_details;
   switch (error_code) {
@@ -2605,8 +2606,8 @@
   if (sent_packet_manager_.pto_enabled() && max_consecutive_ptos_ > 0 &&
       sent_packet_manager_.GetConsecutivePtoCount() >= max_consecutive_ptos_) {
     CloseConnection(QUIC_TOO_MANY_RTOS,
-                    QuicStrCat(max_consecutive_ptos_ + 1,
-                               "consecutive retransmission timeouts"),
+                    quiche::QuicheStrCat(max_consecutive_ptos_ + 1,
+                                         "consecutive retransmission timeouts"),
                     ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
     return;
   }
@@ -3450,9 +3451,9 @@
   QUIC_DVLOG(2) << ENDPOINT
                 << "Sending path probe packet for server connection ID "
                 << server_connection_id_ << std::endl
-                << QuicTextUtils::HexDump(
-                       QuicStringPiece(probing_packet->encrypted_buffer,
-                                       probing_packet->encrypted_length));
+                << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
+                       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_);
@@ -3553,11 +3554,11 @@
   return uber_received_packet_manager_.IsAckFrameUpdated();
 }
 
-QuicStringPiece QuicConnection::GetCurrentPacket() {
+quiche::QuicheStringPiece QuicConnection::GetCurrentPacket() {
   if (current_packet_data_ == nullptr) {
-    return QuicStringPiece();
+    return quiche::QuicheStringPiece();
   }
-  return QuicStringPiece(current_packet_data_, last_size_);
+  return quiche::QuicheStringPiece(current_packet_data_, last_size_);
 }
 
 bool QuicConnection::MaybeConsiderAsMemoryCorruption(
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h
index ca4e9ca..9c5810a 100644
--- a/quic/core/quic_connection.h
+++ b/quic/core/quic_connection.h
@@ -46,7 +46,8 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_containers.h"
 #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_string_piece.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 {
 
@@ -86,7 +87,7 @@
   virtual void OnGoAway(const QuicGoAwayFrame& frame) = 0;
 
   // Called when |message| has been received.
-  virtual void OnMessageReceived(QuicStringPiece message) = 0;
+  virtual void OnMessageReceived(quiche::QuicheStringPiece message) = 0;
 
   // Called when a MAX_STREAMS frame has been received from the peer.
   virtual bool OnMaxStreamsFrame(const QuicMaxStreamsFrame& frame) = 0;
@@ -480,7 +481,7 @@
       const QuicVersionNegotiationPacket& packet) override;
   void OnRetryPacket(QuicConnectionId original_connection_id,
                      QuicConnectionId new_connection_id,
-                     QuicStringPiece retry_token) override;
+                     quiche::QuicheStringPiece retry_token) override;
   bool OnUnauthenticatedPublicHeader(const QuicPacketHeader& header) override;
   bool OnUnauthenticatedHeader(const QuicPacketHeader& header) override;
   void OnDecryptedPacket(EncryptionLevel level) override;
@@ -782,7 +783,7 @@
   QuicConnectionHelperInterface* helper() { return helper_; }
   QuicAlarmFactory* alarm_factory() { return alarm_factory_; }
 
-  QuicStringPiece GetCurrentPacket();
+  quiche::QuicheStringPiece GetCurrentPacket();
 
   const QuicFramer& framer() const { return framer_; }
 
@@ -996,7 +997,7 @@
     ~BufferedPacket();
 
     // encrypted_buffer is owned by buffered packet.
-    QuicStringPiece encrypted_buffer;
+    quiche::QuicheStringPiece encrypted_buffer;
     // Self and peer addresses when the packet is serialized.
     const QuicSocketAddress self_address;
     const QuicSocketAddress peer_address;
diff --git a/quic/core/quic_connection_id.cc b/quic/core/quic_connection_id.cc
index 49e90b6..c495b35 100644
--- a/quic/core/quic_connection_id.cc
+++ b/quic/core/quic_connection_id.cc
@@ -17,8 +17,8 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
 #include "net/third_party/quiche/src/common/platform/api/quiche_endian.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
 
 namespace quic {
 
@@ -152,7 +152,7 @@
   if (IsEmpty()) {
     return std::string("0");
   }
-  return QuicTextUtils::HexEncode(data(), length_);
+  return quiche::QuicheTextUtils::HexEncode(data(), length_);
 }
 
 std::ostream& operator<<(std::ostream& os, const QuicConnectionId& v) {
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index ab5a7ba..efe3544 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -27,8 +27,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/quic/platform/api/quic_reference_counted.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
 #include "net/third_party/quiche/src/quic/test_tools/mock_clock.h"
 #include "net/third_party/quiche/src/quic/test_tools/mock_random.h"
@@ -41,6 +39,8 @@
 #include "net/third_party/quiche/src/quic/test_tools/simple_data_producer.h"
 #include "net/third_party/quiche/src/quic/test_tools/simple_quic_framer.h"
 #include "net/third_party/quiche/src/quic/test_tools/simple_session_notifier.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;
@@ -117,19 +117,21 @@
   ~TaggingEncrypter() override {}
 
   // QuicEncrypter interface.
-  bool SetKey(QuicStringPiece /*key*/) override { return true; }
+  bool SetKey(quiche::QuicheStringPiece /*key*/) override { return true; }
 
-  bool SetNoncePrefix(QuicStringPiece /*nonce_prefix*/) override {
+  bool SetNoncePrefix(quiche::QuicheStringPiece /*nonce_prefix*/) override {
     return true;
   }
 
-  bool SetIV(QuicStringPiece /*iv*/) override { return true; }
+  bool SetIV(quiche::QuicheStringPiece /*iv*/) override { return true; }
 
-  bool SetHeaderProtectionKey(QuicStringPiece /*key*/) override { return true; }
+  bool SetHeaderProtectionKey(quiche::QuicheStringPiece /*key*/) override {
+    return true;
+  }
 
   bool EncryptPacket(uint64_t /*packet_number*/,
-                     QuicStringPiece /*associated_data*/,
-                     QuicStringPiece plaintext,
+                     quiche::QuicheStringPiece /*associated_data*/,
+                     quiche::QuicheStringPiece plaintext,
                      char* output,
                      size_t* output_length,
                      size_t max_output_length) override {
@@ -146,7 +148,7 @@
   }
 
   std::string GenerateHeaderProtectionMask(
-      QuicStringPiece /*sample*/) override {
+      quiche::QuicheStringPiece /*sample*/) override {
     return std::string(5, 0);
   }
 
@@ -162,9 +164,13 @@
     return plaintext_size + kTagSize;
   }
 
-  QuicStringPiece GetKey() const override { return QuicStringPiece(); }
+  quiche::QuicheStringPiece GetKey() const override {
+    return quiche::QuicheStringPiece();
+  }
 
-  QuicStringPiece GetNoncePrefix() const override { return QuicStringPiece(); }
+  quiche::QuicheStringPiece GetNoncePrefix() const override {
+    return quiche::QuicheStringPiece();
+  }
 
  private:
   enum {
@@ -181,17 +187,19 @@
   ~TaggingDecrypter() override {}
 
   // QuicDecrypter interface
-  bool SetKey(QuicStringPiece /*key*/) override { return true; }
+  bool SetKey(quiche::QuicheStringPiece /*key*/) override { return true; }
 
-  bool SetNoncePrefix(QuicStringPiece /*nonce_prefix*/) override {
+  bool SetNoncePrefix(quiche::QuicheStringPiece /*nonce_prefix*/) override {
     return true;
   }
 
-  bool SetIV(QuicStringPiece /*iv*/) override { return true; }
+  bool SetIV(quiche::QuicheStringPiece /*iv*/) override { return true; }
 
-  bool SetHeaderProtectionKey(QuicStringPiece /*key*/) override { return true; }
+  bool SetHeaderProtectionKey(quiche::QuicheStringPiece /*key*/) override {
+    return true;
+  }
 
-  bool SetPreliminaryKey(QuicStringPiece /*key*/) override {
+  bool SetPreliminaryKey(quiche::QuicheStringPiece /*key*/) override {
     QUIC_BUG << "should not be called";
     return false;
   }
@@ -201,8 +209,8 @@
   }
 
   bool DecryptPacket(uint64_t /*packet_number*/,
-                     QuicStringPiece /*associated_data*/,
-                     QuicStringPiece ciphertext,
+                     quiche::QuicheStringPiece /*associated_data*/,
+                     quiche::QuicheStringPiece ciphertext,
                      char* output,
                      size_t* output_length,
                      size_t /*max_output_length*/) override {
@@ -225,13 +233,17 @@
   size_t GetKeySize() const override { return 0; }
   size_t GetNoncePrefixSize() const override { return 0; }
   size_t GetIVSize() const override { return 0; }
-  QuicStringPiece GetKey() const override { return QuicStringPiece(); }
-  QuicStringPiece GetNoncePrefix() const override { return QuicStringPiece(); }
+  quiche::QuicheStringPiece GetKey() const override {
+    return quiche::QuicheStringPiece();
+  }
+  quiche::QuicheStringPiece GetNoncePrefix() const override {
+    return quiche::QuicheStringPiece();
+  }
   // Use a distinct value starting with 0xFFFFFF, which is never used by TLS.
   uint32_t cipher_id() const override { return 0xFFFFFFF0; }
 
  protected:
-  virtual uint8_t GetTag(QuicStringPiece ciphertext) {
+  virtual uint8_t GetTag(quiche::QuicheStringPiece ciphertext) {
     return ciphertext.data()[ciphertext.size() - 1];
   }
 
@@ -240,7 +252,7 @@
     kTagSize = 12,
   };
 
-  bool CheckTag(QuicStringPiece ciphertext, uint8_t tag) {
+  bool CheckTag(quiche::QuicheStringPiece ciphertext, uint8_t tag) {
     for (size_t i = ciphertext.size() - kTagSize; i < ciphertext.size(); i++) {
       if (ciphertext.data()[i] != tag) {
         return false;
@@ -259,7 +271,9 @@
   ~StrictTaggingDecrypter() override {}
 
   // TaggingQuicDecrypter
-  uint8_t GetTag(QuicStringPiece /*ciphertext*/) override { return tag_; }
+  uint8_t GetTag(quiche::QuicheStringPiece /*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; }
@@ -673,7 +687,7 @@
   }
 
   QuicConsumedData SendStreamDataWithString(QuicStreamId id,
-                                            QuicStringPiece data,
+                                            quiche::QuicheStringPiece data,
                                             QuicStreamOffset offset,
                                             StreamSendingState state) {
     ScopedPacketFlusher flusher(this);
@@ -694,7 +708,7 @@
 
   QuicConsumedData SendApplicationDataAtLevel(EncryptionLevel encryption_level,
                                               QuicStreamId id,
-                                              QuicStringPiece data,
+                                              quiche::QuicheStringPiece data,
                                               QuicStreamOffset offset,
                                               StreamSendingState state) {
     ScopedPacketFlusher flusher(this);
@@ -731,7 +745,7 @@
   // tests for some cases for this stream.
   QuicConsumedData SendCryptoStreamData() {
     QuicStreamOffset offset = 0;
-    QuicStringPiece data("chlo");
+    quiche::QuicheStringPiece data("chlo");
     if (!QuicVersionUsesCryptoFrames(transport_version())) {
       return SendCryptoDataWithString(data, offset);
     }
@@ -747,7 +761,7 @@
     return QuicConsumedData(bytes_written, /*fin_consumed*/ false);
   }
 
-  QuicConsumedData SendCryptoDataWithString(QuicStringPiece data,
+  QuicConsumedData SendCryptoDataWithString(quiche::QuicheStringPiece data,
                                             QuicStreamOffset offset) {
     if (!QuicVersionUsesCryptoFrames(transport_version())) {
       return SendStreamDataWithString(
@@ -910,7 +924,7 @@
 
 // Used by ::testing::PrintToStringParamName().
 std::string PrintToString(const TestParams& p) {
-  return QuicStrCat(
+  return quiche::QuicheStrCat(
       ParsedQuicVersionToString(p.version), "_",
       (p.ack_response == AckResponse::kDefer ? "defer" : "immediate"), "_",
       (p.no_stop_waiting ? "No" : ""), "StopWaiting");
@@ -976,9 +990,9 @@
                     version()),
         creator_(QuicConnectionPeer::GetPacketCreator(&connection_)),
         manager_(QuicConnectionPeer::GetSentPacketManager(&connection_)),
-        frame1_(0, false, 0, QuicStringPiece(data1)),
-        frame2_(0, false, 3, QuicStringPiece(data2)),
-        crypto_frame_(ENCRYPTION_INITIAL, 0, QuicStringPiece(data1)),
+        frame1_(0, false, 0, quiche::QuicheStringPiece(data1)),
+        frame2_(0, false, 3, quiche::QuicheStringPiece(data2)),
+        crypto_frame_(ENCRYPTION_INITIAL, 0, quiche::QuicheStringPiece(data1)),
         packet_number_length_(PACKET_4BYTE_PACKET_NUMBER),
         connection_id_included_(CONNECTION_ID_PRESENT),
         notifier_(&connection_),
@@ -1307,7 +1321,7 @@
   }
 
   QuicByteCount SendStreamDataToPeer(QuicStreamId id,
-                                     QuicStringPiece data,
+                                     quiche::QuicheStringPiece data,
                                      QuicStreamOffset offset,
                                      StreamSendingState state,
                                      QuicPacketNumber* last_packet) {
@@ -1717,7 +1731,7 @@
   } else {
     frame = QuicFrame(QuicStreamFrame(
         QuicUtils::GetCryptoStreamId(connection_.transport_version()), false,
-        0u, QuicStringPiece()));
+        0u, quiche::QuicheStringPiece()));
     EXPECT_CALL(visitor_, OnStreamFrame(_));
   }
   ProcessFramePacketWithAddresses(frame, kSelfAddress, kPeerAddress);
@@ -1748,7 +1762,7 @@
   } else {
     frame = QuicFrame(QuicStreamFrame(
         QuicUtils::GetCryptoStreamId(connection_.transport_version()), false,
-        0u, QuicStringPiece()));
+        0u, quiche::QuicheStringPiece()));
     EXPECT_CALL(visitor_, OnStreamFrame(_));
   }
   ProcessFramePacketWithAddresses(frame, kSelfAddress, kPeerAddress);
@@ -1777,7 +1791,7 @@
   } else {
     frame = QuicFrame(QuicStreamFrame(
         QuicUtils::GetCryptoStreamId(connection_.transport_version()), false,
-        0u, QuicStringPiece()));
+        0u, quiche::QuicheStringPiece()));
     EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(3);
   }
   QuicIpAddress host;
@@ -1786,8 +1800,8 @@
   ProcessFramePacketWithAddresses(frame, self_address1, kPeerAddress);
   // Cause self_address change to mapped Ipv4 address.
   QuicIpAddress host2;
-  host2.FromString(
-      QuicStrCat("::ffff:", connection_.self_address().host().ToString()));
+  host2.FromString(quiche::QuicheStrCat(
+      "::ffff:", connection_.self_address().host().ToString()));
   QuicSocketAddress self_address2(host2, connection_.self_address().port());
   ProcessFramePacketWithAddresses(frame, self_address2, kPeerAddress);
   EXPECT_TRUE(connection_.connected());
@@ -1814,7 +1828,7 @@
   } else {
     frame = QuicFrame(QuicStreamFrame(
         QuicUtils::GetCryptoStreamId(connection_.transport_version()), false,
-        0u, QuicStringPiece()));
+        0u, quiche::QuicheStringPiece()));
     EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AnyNumber());
   }
   QuicPacketCreatorPeer::SetPacketNumber(&peer_creator_, 5);
@@ -1854,7 +1868,7 @@
   } else {
     frame = QuicFrame(QuicStreamFrame(
         QuicUtils::GetCryptoStreamId(connection_.transport_version()), false,
-        0u, QuicStringPiece()));
+        0u, quiche::QuicheStringPiece()));
     EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AnyNumber());
   }
   ProcessFramePacketWithAddresses(frame, kSelfAddress, kPeerAddress);
@@ -1893,7 +1907,7 @@
   } else {
     frame = QuicFrame(QuicStreamFrame(
         QuicUtils::GetCryptoStreamId(connection_.transport_version()), false,
-        0u, QuicStringPiece()));
+        0u, quiche::QuicheStringPiece()));
     EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AnyNumber());
   }
   ProcessFramePacketWithAddresses(frame, kSelfAddress, kPeerAddress);
@@ -1976,7 +1990,7 @@
   } else {
     frame = QuicFrame(QuicStreamFrame(
         QuicUtils::GetCryptoStreamId(connection_.transport_version()), false,
-        0u, QuicStringPiece()));
+        0u, quiche::QuicheStringPiece()));
     EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AnyNumber());
   }
   ProcessFramePacketWithAddresses(frame, kSelfAddress, kPeerAddress);
@@ -2083,7 +2097,7 @@
   } else {
     frame = QuicFrame(QuicStreamFrame(
         QuicUtils::GetCryptoStreamId(connection_.transport_version()), false,
-        0u, QuicStringPiece()));
+        0u, quiche::QuicheStringPiece()));
     EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AnyNumber());
   }
   ProcessFramePacketWithAddresses(frame, kSelfAddress, kPeerAddress);
@@ -2141,7 +2155,7 @@
   } else {
     frame = QuicFrame(QuicStreamFrame(
         QuicUtils::GetCryptoStreamId(connection_.transport_version()), false,
-        0u, QuicStringPiece()));
+        0u, quiche::QuicheStringPiece()));
     EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AnyNumber());
   }
   QuicPacketCreatorPeer::SetPacketNumber(&peer_creator_, 5);
@@ -2197,7 +2211,7 @@
   } else {
     frame = QuicFrame(QuicStreamFrame(
         QuicUtils::GetCryptoStreamId(connection_.transport_version()), false,
-        0u, QuicStringPiece()));
+        0u, quiche::QuicheStringPiece()));
     EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AnyNumber());
   }
   ProcessFramePacketWithAddresses(frame, kSelfAddress, kPeerAddress);
@@ -2250,7 +2264,7 @@
   } else {
     frame = QuicFrame(QuicStreamFrame(
         QuicUtils::GetCryptoStreamId(connection_.transport_version()), false,
-        0u, QuicStringPiece()));
+        0u, quiche::QuicheStringPiece()));
     EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AnyNumber());
   }
   ProcessFramePacketWithAddresses(frame, kSelfAddress, kPeerAddress);
@@ -2297,7 +2311,7 @@
   } else {
     frame = QuicFrame(QuicStreamFrame(
         QuicUtils::GetCryptoStreamId(connection_.transport_version()), false,
-        0u, QuicStringPiece()));
+        0u, quiche::QuicheStringPiece()));
     EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AnyNumber());
   }
   ProcessFramePacketWithAddresses(frame, kSelfAddress, kPeerAddress);
@@ -2347,7 +2361,7 @@
   } else {
     frame = QuicFrame(QuicStreamFrame(
         QuicUtils::GetCryptoStreamId(connection_.transport_version()), false,
-        0u, QuicStringPiece()));
+        0u, quiche::QuicheStringPiece()));
     EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AnyNumber());
   }
   ProcessFramePacketWithAddresses(frame, kSelfAddress, kPeerAddress);
@@ -3175,7 +3189,8 @@
   EXPECT_EQ(0u, writer_->padding_frames().size());
   QuicStreamFrame* frame = writer_->stream_frames()[0].get();
   EXPECT_EQ(stream_id, frame->stream_id);
-  EXPECT_EQ("ABCDEF", QuicStringPiece(frame->data_buffer, frame->data_length));
+  EXPECT_EQ("ABCDEF",
+            quiche::QuicheStringPiece(frame->data_buffer, frame->data_length));
 }
 
 TEST_P(QuicConnectionTest, FramePackingSendvQueued) {
@@ -8606,7 +8621,7 @@
     return;
   }
   std::string message(connection_.GetCurrentLargestMessagePayload() * 2, 'a');
-  QuicStringPiece message_data(message);
+  quiche::QuicheStringPiece message_data(message);
   QuicMemSliceStorage storage(nullptr, 0, nullptr, 0);
   {
     QuicConnection::ScopedPacketFlusher flusher(&connection_);
@@ -8619,7 +8634,7 @@
               connection_.SendMessage(
                   1,
                   MakeSpan(connection_.helper()->GetStreamSendBufferAllocator(),
-                           QuicStringPiece(
+                           quiche::QuicheStringPiece(
                                message_data.data(),
                                connection_.GetCurrentLargestMessagePayload()),
                            &storage),
@@ -8640,7 +8655,7 @@
             connection_.SendMessage(
                 3,
                 MakeSpan(connection_.helper()->GetStreamSendBufferAllocator(),
-                         QuicStringPiece(
+                         quiche::QuicheStringPiece(
                              message_data.data(),
                              connection_.GetCurrentLargestMessagePayload() + 1),
                          &storage),
@@ -8764,7 +8779,7 @@
   } else {
     frame = QuicFrame(QuicStreamFrame(
         QuicUtils::GetCryptoStreamId(connection_.transport_version()), false,
-        0u, QuicStringPiece()));
+        0u, quiche::QuicheStringPiece()));
     EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
   }
   ProcessFramePacketWithAddresses(frame, kSelfAddress, kPeerAddress);
@@ -9085,7 +9100,7 @@
   } else {
     frame = QuicFrame(QuicStreamFrame(
         QuicUtils::GetCryptoStreamId(connection_.transport_version()), false,
-        0u, QuicStringPiece()));
+        0u, quiche::QuicheStringPiece()));
     EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AnyNumber());
   }
   ProcessFramePacketWithAddresses(frame, kSelfAddress, kPeerAddress);
diff --git a/quic/core/quic_control_frame_manager.cc b/quic/core/quic_control_frame_manager.cc
index 3eed5e8..de49366 100644
--- a/quic/core/quic_control_frame_manager.cc
+++ b/quic/core/quic_control_frame_manager.cc
@@ -11,6 +11,7 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_map_util.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
 
 namespace quic {
 
@@ -41,9 +42,10 @@
   if (control_frames_.size() > kMaxNumControlFrames) {
     session_->connection()->CloseConnection(
         QUIC_TOO_MANY_BUFFERED_CONTROL_FRAMES,
-        QuicStrCat("More than ", kMaxNumControlFrames,
-                   "buffered control frames, least_unacked: ", least_unacked_,
-                   ", least_unsent_: ", least_unsent_),
+        quiche::QuicheStrCat(
+            "More than ", kMaxNumControlFrames,
+            "buffered control frames, least_unacked: ", least_unacked_,
+            ", least_unsent_: ", least_unsent_),
         ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
     return;
   }
@@ -121,9 +123,10 @@
   if (control_frames_.size() > kMaxNumControlFrames) {
     session_->connection()->CloseConnection(
         QUIC_TOO_MANY_BUFFERED_CONTROL_FRAMES,
-        QuicStrCat("More than ", kMaxNumControlFrames,
-                   "buffered control frames, least_unacked: ", least_unacked_,
-                   ", least_unsent_: ", least_unsent_),
+        quiche::QuicheStrCat(
+            "More than ", kMaxNumControlFrames,
+            "buffered control frames, least_unacked: ", least_unacked_,
+            ", least_unsent_: ", least_unsent_),
         ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
     return;
   }
diff --git a/quic/core/quic_control_frame_manager.h b/quic/core/quic_control_frame_manager.h
index a4c2678..61dfba1 100644
--- a/quic/core/quic_control_frame_manager.h
+++ b/quic/core/quic_control_frame_manager.h
@@ -9,6 +9,7 @@
 
 #include "net/third_party/quiche/src/quic/core/frames/quic_frame.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_containers.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
 
 namespace quic {
 
diff --git a/quic/core/quic_crypto_client_handshaker.cc b/quic/core/quic_crypto_client_handshaker.cc
index eaeabfe..eed6993 100644
--- a/quic/core/quic_crypto_client_handshaker.cc
+++ b/quic/core/quic_crypto_client_handshaker.cc
@@ -13,7 +13,7 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_client_stats.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
 
 namespace quic {
 
@@ -250,8 +250,9 @@
   if (num_client_hellos_ >= QuicCryptoClientStream::kMaxClientHellos) {
     stream_->CloseConnectionWithDetails(
         QUIC_CRYPTO_TOO_MANY_REJECTS,
-        QuicStrCat("More than ", QuicCryptoClientStream::kMaxClientHellos,
-                   " rejects"));
+        quiche::QuicheStrCat("More than ",
+                             QuicCryptoClientStream::kMaxClientHellos,
+                             " rejects"));
     return;
   }
   num_client_hellos_++;
diff --git a/quic/core/quic_crypto_client_handshaker_test.cc b/quic/core/quic_crypto_client_handshaker_test.cc
index 43c7efa..30dcbfc 100644
--- a/quic/core/quic_crypto_client_handshaker_test.cc
+++ b/quic/core/quic_crypto_client_handshaker_test.cc
@@ -9,6 +9,7 @@
 #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 {
@@ -35,7 +36,7 @@
       const uint16_t /*port*/,
       const std::string& /*server_config*/,
       QuicTransportVersion /*transport_version*/,
-      QuicStringPiece /*chlo_hash*/,
+      quiche::QuicheStringPiece /*chlo_hash*/,
       const std::vector<std::string>& /*certs*/,
       const std::string& /*cert_sct*/,
       const std::string& /*signature*/,
@@ -73,7 +74,7 @@
                 const std::string& hostname,
                 const std::string& /*server_config*/,
                 QuicTransportVersion /*transport_version*/,
-                QuicStringPiece /*chlo_hash*/,
+                quiche::QuicheStringPiece /*chlo_hash*/,
                 std::unique_ptr<Callback> callback) override {
     QuicReferenceCountedPointer<ProofSource::Chain> chain =
         GetCertChain(server_address, hostname);
@@ -96,7 +97,7 @@
       const QuicSocketAddress& /*server_address*/,
       const std::string& /*hostname*/,
       uint16_t /*signature_algorit*/,
-      QuicStringPiece /*in*/,
+      quiche::QuicheStringPiece /*in*/,
       std::unique_ptr<SignatureCallback> callback) override {
     callback->Run(true, "Dummy signature");
   }
diff --git a/quic/core/quic_crypto_client_stream.cc b/quic/core/quic_crypto_client_stream.cc
index b30cd3a..e940635 100644
--- a/quic/core/quic_crypto_client_stream.cc
+++ b/quic/core/quic_crypto_client_stream.cc
@@ -18,7 +18,6 @@
 #include "net/third_party/quiche/src/quic/core/tls_client_handshaker.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
 
 namespace quic {
 
diff --git a/quic/core/quic_crypto_server_handshaker.cc b/quic/core/quic_crypto_server_handshaker.cc
index 755e35e..18e635b 100644
--- a/quic/core/quic_crypto_server_handshaker.cc
+++ b/quic/core/quic_crypto_server_handshaker.cc
@@ -9,7 +9,8 @@
 
 #include "third_party/boringssl/src/include/openssl/sha.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_arraysize.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_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 {
 
@@ -325,8 +326,8 @@
                 << message.DebugString();
   if (!QuicVersionUsesCryptoFrames(transport_version())) {
     const QuicData& data = message.GetSerialized();
-    stream_->WriteOrBufferData(QuicStringPiece(data.data(), data.length()),
-                               false, nullptr);
+    stream_->WriteOrBufferData(
+        quiche::QuicheStringPiece(data.data(), data.length()), false, nullptr);
   } else {
     SendHandshakeMessage(message);
   }
@@ -384,7 +385,7 @@
   SHA256(reinterpret_cast<const uint8_t*>(channel_id.data()), channel_id.size(),
          digest);
 
-  QuicTextUtils::Base64Encode(digest, QUIC_ARRAYSIZE(digest), output);
+  quiche::QuicheTextUtils::Base64Encode(digest, QUIC_ARRAYSIZE(digest), output);
   return true;
 }
 
@@ -430,7 +431,7 @@
 
   if (num_handshake_messages_ == 1) {
     // Client attempts zero RTT handshake by sending a non-inchoate CHLO.
-    QuicStringPiece public_value;
+    quiche::QuicheStringPiece public_value;
     zero_rtt_attempted_ = message.GetStringPiece(kPUBS, &public_value);
   }
 
diff --git a/quic/core/quic_crypto_server_stream.cc b/quic/core/quic_crypto_server_stream.cc
index bbc3b09..02088df 100644
--- a/quic/core/quic_crypto_server_stream.cc
+++ b/quic/core/quic_crypto_server_stream.cc
@@ -21,7 +21,6 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
 
 namespace quic {
 
diff --git a/quic/core/quic_crypto_server_stream_test.cc b/quic/core/quic_crypto_server_stream_test.cc
index 6de5433..741a8aa 100644
--- a/quic/core/quic_crypto_server_stream_test.cc
+++ b/quic/core/quic_crypto_server_stream_test.cc
@@ -32,6 +32,7 @@
 #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;
@@ -92,11 +93,12 @@
     EXPECT_CALL(*server_session_->helper(), CanAcceptClientHello(_, _, _, _, _))
         .Times(testing::AnyNumber());
     EXPECT_CALL(*server_session_, SelectAlpn(_))
-        .WillRepeatedly([this](const std::vector<QuicStringPiece>& alpns) {
-          return std::find(
-              alpns.cbegin(), alpns.cend(),
-              AlpnForVersion(server_session_->connection()->version()));
-        });
+        .WillRepeatedly(
+            [this](const std::vector<quiche::QuicheStringPiece>& alpns) {
+              return std::find(
+                  alpns.cbegin(), alpns.cend(),
+                  AlpnForVersion(server_session_->connection()->version()));
+            });
     crypto_test_utils::SetupCryptoServerConfigForTest(
         server_connection_->clock(), server_connection_->random_generator(),
         &server_crypto_config_);
diff --git a/quic/core/quic_crypto_stream.cc b/quic/core/quic_crypto_stream.cc
index 3bc94e8..b10ead7 100644
--- a/quic/core/quic_crypto_stream.cc
+++ b/quic/core/quic_crypto_stream.cc
@@ -14,7 +14,7 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
 
 namespace quic {
 
@@ -113,7 +113,8 @@
     EncryptionLevel level) {
   struct iovec iov;
   while (sequencer->GetReadableRegion(&iov)) {
-    QuicStringPiece data(static_cast<char*>(iov.iov_base), iov.iov_len);
+    quiche::QuicheStringPiece data(static_cast<char*>(iov.iov_base),
+                                   iov.iov_len);
     if (!crypto_message_parser()->ProcessInput(data, level)) {
       CloseConnectionWithDetails(crypto_message_parser()->error(),
                                  crypto_message_parser()->error_detail());
@@ -130,8 +131,8 @@
   }
 }
 
-bool QuicCryptoStream::ExportKeyingMaterial(QuicStringPiece label,
-                                            QuicStringPiece context,
+bool QuicCryptoStream::ExportKeyingMaterial(quiche::QuicheStringPiece label,
+                                            quiche::QuicheStringPiece context,
                                             size_t result_len,
                                             std::string* result) const {
   if (!handshake_confirmed()) {
@@ -145,7 +146,7 @@
 }
 
 void QuicCryptoStream::WriteCryptoData(EncryptionLevel level,
-                                       QuicStringPiece data) {
+                                       quiche::QuicheStringPiece 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 10b0b53..ccaa6a7 100644
--- a/quic/core/quic_crypto_stream.h
+++ b/quic/core/quic_crypto_stream.h
@@ -15,7 +15,7 @@
 #include "net/third_party/quiche/src/quic/core/quic_packets.h"
 #include "net/third_party/quiche/src/quic/core/quic_stream.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
 
 namespace quic {
 
@@ -60,13 +60,14 @@
   // 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(QuicStringPiece label,
-                            QuicStringPiece context,
+  bool ExportKeyingMaterial(quiche::QuicheStringPiece label,
+                            quiche::QuicheStringPiece context,
                             size_t result_len,
                             std::string* result) const;
 
   // Writes |data| to the QuicStream at level |level|.
-  virtual void WriteCryptoData(EncryptionLevel level, QuicStringPiece data);
+  virtual void WriteCryptoData(EncryptionLevel level,
+                               quiche::QuicheStringPiece data);
 
   // Returns true once an encrypter has been set for the connection.
   virtual bool encryption_established() const = 0;
diff --git a/quic/core/quic_data_reader.cc b/quic/core/quic_data_reader.cc
index 17fb6cd..306a8a9 100644
--- a/quic/core/quic_data_reader.cc
+++ b/quic/core/quic_data_reader.cc
@@ -8,12 +8,13 @@
 #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/quic/platform/api/quic_str_cat.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(QuicStringPiece data)
+QuicDataReader::QuicDataReader(quiche::QuicheStringPiece data)
     : QuicDataReader(data.data(), data.length(), quiche::NETWORK_BYTE_ORDER) {}
 
 QuicDataReader::QuicDataReader(const char* data, const size_t len)
@@ -108,7 +109,7 @@
   return true;
 }
 
-bool QuicDataReader::ReadStringPiece16(QuicStringPiece* result) {
+bool QuicDataReader::ReadStringPiece16(quiche::QuicheStringPiece* result) {
   // Read resultant length.
   uint16_t result_len;
   if (!ReadUInt16(&result_len)) {
@@ -119,7 +120,8 @@
   return ReadStringPiece(result, result_len);
 }
 
-bool QuicDataReader::ReadStringPiece(QuicStringPiece* result, size_t size) {
+bool QuicDataReader::ReadStringPiece(quiche::QuicheStringPiece* result,
+                                     size_t size) {
   // Make sure that we have enough data to read.
   if (!CanRead(size)) {
     OnFailure();
@@ -127,7 +129,7 @@
   }
 
   // Set result.
-  *result = QuicStringPiece(data_ + pos_, size);
+  *result = quiche::QuicheStringPiece(data_ + pos_, size);
 
   // Iterate.
   pos_ += size;
@@ -174,18 +176,18 @@
   return ReadBytes(tag, sizeof(*tag));
 }
 
-QuicStringPiece QuicDataReader::ReadRemainingPayload() {
-  QuicStringPiece payload = PeekRemainingPayload();
+quiche::QuicheStringPiece QuicDataReader::ReadRemainingPayload() {
+  quiche::QuicheStringPiece payload = PeekRemainingPayload();
   pos_ = len_;
   return payload;
 }
 
-QuicStringPiece QuicDataReader::PeekRemainingPayload() const {
-  return QuicStringPiece(data_ + pos_, len_ - pos_);
+quiche::QuicheStringPiece QuicDataReader::PeekRemainingPayload() const {
+  return quiche::QuicheStringPiece(data_ + pos_, len_ - pos_);
 }
 
-QuicStringPiece QuicDataReader::FullPayload() const {
-  return QuicStringPiece(data_, len_);
+quiche::QuicheStringPiece QuicDataReader::FullPayload() const {
+  return quiche::QuicheStringPiece(data_, len_);
 }
 
 bool QuicDataReader::ReadBytes(void* result, size_t size) {
@@ -343,7 +345,7 @@
 }
 
 std::string QuicDataReader::DebugString() const {
-  return QuicStrCat(" { length: ", len_, ", position: ", pos_, " }");
+  return quiche::QuicheStrCat(" { length: ", len_, ", position: ", pos_, " }");
 }
 
 #undef ENDPOINT  // undef for jumbo builds
diff --git a/quic/core/quic_data_reader.h b/quic/core/quic_data_reader.h
index acd30fd..40ad4fc 100644
--- a/quic/core/quic_data_reader.h
+++ b/quic/core/quic_data_reader.h
@@ -10,8 +10,8 @@
 
 #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_string_piece.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 {
 
@@ -33,7 +33,7 @@
  public:
   // Constructs a reader using NETWORK_BYTE_ORDER endianness.
   // Caller must provide an underlying buffer to work on.
-  explicit QuicDataReader(QuicStringPiece data);
+  explicit QuicDataReader(quiche::QuicheStringPiece 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);
@@ -72,13 +72,13 @@
   //
   // Forwards the internal iterator on success.
   // Returns true on success, false otherwise.
-  bool ReadStringPiece16(QuicStringPiece* result);
+  bool ReadStringPiece16(quiche::QuicheStringPiece* result);
 
   // Reads a given number of bytes into the given buffer. The buffer
   // must be of adequate size.
   // Forwards the internal iterator on success.
   // Returns true on success, false otherwise.
-  bool ReadStringPiece(QuicStringPiece* result, size_t len);
+  bool ReadStringPiece(quiche::QuicheStringPiece* result, size_t len);
 
   // Reads connection ID into the given output parameter.
   // Forwards the internal iterator on success.
@@ -96,29 +96,29 @@
   // endian.
   bool ReadTag(uint32_t* tag);
 
-  // Returns the remaining payload as a QuicStringPiece.
+  // Returns the remaining payload as a quiche::QuicheStringPiece.
   //
   // NOTE: Does not copy but rather references strings in the underlying buffer.
   // This should be kept in mind when handling memory management!
   //
   // Forwards the internal iterator.
-  QuicStringPiece ReadRemainingPayload();
+  quiche::QuicheStringPiece ReadRemainingPayload();
 
-  // Returns the remaining payload as a QuicStringPiece.
+  // Returns the remaining payload as a quiche::QuicheStringPiece.
   //
   // NOTE: Does not copy but rather references strings in the underlying buffer.
   // This should be kept in mind when handling memory management!
   //
   // DOES NOT forward the internal iterator.
-  QuicStringPiece PeekRemainingPayload() const;
+  quiche::QuicheStringPiece PeekRemainingPayload() const;
 
-  // Returns the entire payload as a QuicStringPiece.
+  // Returns the entire payload as a quiche::QuicheStringPiece.
   //
   // NOTE: Does not copy but rather references strings in the underlying buffer.
   // This should be kept in mind when handling memory management!
   //
   // DOES NOT forward the internal iterator.
-  QuicStringPiece FullPayload() const;
+  quiche::QuicheStringPiece FullPayload() const;
 
   // Reads a given number of bytes into the given buffer. The buffer
   // must be of adequate size.
diff --git a/quic/core/quic_data_writer.cc b/quic/core/quic_data_writer.cc
index d2d7113..28af68b 100644
--- a/quic/core/quic_data_writer.cc
+++ b/quic/core/quic_data_writer.cc
@@ -11,8 +11,9 @@
 #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/quic/platform/api/quic_str_cat.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 {
 
@@ -110,7 +111,7 @@
   return WriteBytes(&result, sizeof(result));
 }
 
-bool QuicDataWriter::WriteStringPiece16(QuicStringPiece val) {
+bool QuicDataWriter::WriteStringPiece16(quiche::QuicheStringPiece val) {
   if (val.size() > std::numeric_limits<uint16_t>::max()) {
     return false;
   }
@@ -120,7 +121,7 @@
   return WriteBytes(val.data(), val.size());
 }
 
-bool QuicDataWriter::WriteStringPiece(QuicStringPiece val) {
+bool QuicDataWriter::WriteStringPiece(quiche::QuicheStringPiece val) {
   return WriteBytes(val.data(), val.size());
 }
 
@@ -353,7 +354,7 @@
 }
 
 bool QuicDataWriter::WriteStringPieceVarInt62(
-    const QuicStringPiece& string_piece) {
+    const quiche::QuicheStringPiece& string_piece) {
   if (!WriteVarInt62(string_piece.size())) {
     return false;
   }
@@ -366,7 +367,8 @@
 }
 
 std::string QuicDataWriter::DebugString() const {
-  return QuicStrCat(" { capacity: ", capacity_, ", length: ", length_, " }");
+  return quiche::QuicheStrCat(" { capacity: ", capacity_, ", length: ", length_,
+                              " }");
 }
 
 }  // namespace quic
diff --git a/quic/core/quic_data_writer.h b/quic/core/quic_data_writer.h
index 8f1b21d..7d90f39 100644
--- a/quic/core/quic_data_writer.h
+++ b/quic/core/quic_data_writer.h
@@ -10,8 +10,8 @@
 
 #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_string_piece.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 {
 
@@ -80,7 +80,7 @@
 
   // Writes a string piece as a consecutive length/content pair. The
   // length is VarInt62 encoded.
-  bool WriteStringPieceVarInt62(const QuicStringPiece& string_piece);
+  bool WriteStringPieceVarInt62(const quiche::QuicheStringPiece& string_piece);
 
   // Utility function to return the number of bytes needed to encode
   // the given value using IETF VarInt62 encoding. Returns the number
@@ -96,8 +96,8 @@
   // clamped to the maximum representable (kUFloat16MaxValue). Values that can
   // not be represented directly are rounded down.
   bool WriteUFloat16(uint64_t value);
-  bool WriteStringPiece(QuicStringPiece val);
-  bool WriteStringPiece16(QuicStringPiece val);
+  bool WriteStringPiece(quiche::QuicheStringPiece val);
+  bool WriteStringPiece16(quiche::QuicheStringPiece val);
   bool WriteBytes(const void* data, size_t data_len);
   bool WriteRepeatedByte(uint8_t byte, size_t count);
   // Fills the remaining buffer with null characters.
diff --git a/quic/core/quic_data_writer_test.cc b/quic/core/quic_data_writer_test.cc
index 104df8d..653fbff 100644
--- a/quic/core/quic_data_writer_test.cc
+++ b/quic/core/quic_data_writer_test.cc
@@ -16,6 +16,8 @@
 #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_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 {
 namespace test {
@@ -33,7 +35,7 @@
 
 // Used by ::testing::PrintToStringParamName().
 std::string PrintToString(const TestParams& p) {
-  return QuicStrCat(
+  return quiche::QuicheStrCat(
       (p.endianness == quiche::NETWORK_BYTE_ORDER ? "Network" : "Host"),
       "ByteOrder");
 }
@@ -1172,8 +1174,9 @@
   bool ok;
   EXPECT_QUIC_BUG(
       ok = reader.ReadConnectionId(&connection_id, bad_connection_id_length),
-      QuicStrCat("Attempted to read connection ID with length too high ",
-                 static_cast<int>(bad_connection_id_length)));
+      quiche::QuicheStrCat(
+          "Attempted to read connection ID with length too high ",
+          static_cast<int>(bad_connection_id_length)));
   EXPECT_FALSE(ok);
 }
 
@@ -1255,22 +1258,24 @@
   test::CompareCharArraysWithHexError(
       "first read", first_read_buffer, sizeof(first_read_buffer),
       expected_first_read, sizeof(expected_first_read));
-  QuicStringPiece peeked_remaining_payload = reader.PeekRemainingPayload();
+  quiche::QuicheStringPiece peeked_remaining_payload =
+      reader.PeekRemainingPayload();
   test::CompareCharArraysWithHexError(
       "peeked_remaining_payload", peeked_remaining_payload.data(),
       peeked_remaining_payload.length(), expected_remaining,
       sizeof(expected_remaining));
-  QuicStringPiece full_payload = reader.FullPayload();
+  quiche::QuicheStringPiece full_payload = reader.FullPayload();
   test::CompareCharArraysWithHexError("full_payload", full_payload.data(),
                                       full_payload.length(), buffer,
                                       sizeof(buffer));
-  QuicStringPiece read_remaining_payload = reader.ReadRemainingPayload();
+  quiche::QuicheStringPiece read_remaining_payload =
+      reader.ReadRemainingPayload();
   test::CompareCharArraysWithHexError(
       "read_remaining_payload", read_remaining_payload.data(),
       read_remaining_payload.length(), expected_remaining,
       sizeof(expected_remaining));
   EXPECT_TRUE(reader.IsDoneReading());
-  QuicStringPiece full_payload2 = reader.FullPayload();
+  quiche::QuicheStringPiece full_payload2 = reader.FullPayload();
   test::CompareCharArraysWithHexError("full_payload2", full_payload2.data(),
                                       full_payload2.length(), buffer,
                                       sizeof(buffer));
diff --git a/quic/core/quic_dispatcher.cc b/quic/core/quic_dispatcher.cc
index 4c9dab8..9c71d41 100644
--- a/quic/core/quic_dispatcher.cc
+++ b/quic/core/quic_dispatcher.cc
@@ -21,8 +21,8 @@
 #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/quic/platform/api/quic_string_piece.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_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 {
 
@@ -199,7 +199,7 @@
   void OnChlo(QuicTransportVersion /*version*/,
               QuicConnectionId /*server_connection_id*/,
               const CryptoHandshakeMessage& chlo) override {
-    QuicStringPiece alpn_value;
+    quiche::QuicheStringPiece alpn_value;
     if (chlo.GetStringPiece(kALPN, &alpn_value)) {
       alpn_ = std::string(alpn_value);
     }
@@ -261,12 +261,12 @@
                                    const QuicReceivedPacket& packet) {
   QUIC_DVLOG(2) << "Dispatcher received encrypted " << packet.length()
                 << " bytes:" << std::endl
-                << QuicTextUtils::HexDump(
-                       QuicStringPiece(packet.data(), packet.length()));
+                << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
+                       packet.data(), packet.length()));
   ReceivedPacketInfo packet_info(self_address, peer_address, packet);
   std::string detailed_error;
   bool retry_token_present;
-  QuicStringPiece retry_token;
+  quiche::QuicheStringPiece 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 1d694e5..3c57ec5 100644
--- a/quic/core/quic_dispatcher.h
+++ b/quic/core/quic_dispatcher.h
@@ -25,6 +25,7 @@
 #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 {
@@ -141,7 +142,7 @@
   virtual std::unique_ptr<QuicSession> CreateQuicSession(
       QuicConnectionId server_connection_id,
       const QuicSocketAddress& peer_address,
-      QuicStringPiece alpn,
+      quiche::QuicheStringPiece 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 7ec844a..f70add6 100644
--- a/quic/core/quic_dispatcher_test.cc
+++ b/quic/core/quic_dispatcher_test.cc
@@ -24,7 +24,6 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_expect_bug.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
 #include "net/third_party/quiche/src/quic/test_tools/crypto_test_utils.h"
 #include "net/third_party/quiche/src/quic/test_tools/fake_proof_source.h"
@@ -35,6 +34,7 @@
 #include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
 #include "net/third_party/quiche/src/quic/test_tools/quic_time_wait_list_manager_peer.h"
 #include "net/third_party/quiche/src/quic/tools/quic_simple_crypto_server_stream_helper.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
 
 using testing::_;
 using testing::ByMove;
@@ -129,7 +129,7 @@
       CreateQuicSession,
       std::unique_ptr<QuicSession>(QuicConnectionId connection_id,
                                    const QuicSocketAddress& peer_address,
-                                   QuicStringPiece alpn,
+                                   quiche::QuicheStringPiece alpn,
                                    const quic::ParsedQuicVersion& version));
 
   MOCK_METHOD1(ShouldCreateOrBufferPacketForConnection,
@@ -373,8 +373,9 @@
   void VerifyVersionSupported(ParsedQuicVersion version) {
     QuicConnectionId connection_id = TestConnectionId(++connection_id_);
     QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
-    EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address,
-                                                QuicStringPiece("hq"), _))
+    EXPECT_CALL(*dispatcher_,
+                CreateQuicSession(connection_id, client_address,
+                                  quiche::QuicheStringPiece("hq"), _))
         .WillOnce(Return(ByMove(CreateSession(
             dispatcher_.get(), config_, connection_id, client_address,
             &mock_helper_, &mock_alarm_factory_, &crypto_config_,
@@ -395,8 +396,9 @@
   void VerifyVersionNotSupported(ParsedQuicVersion version) {
     QuicConnectionId connection_id = TestConnectionId(++connection_id_);
     QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
-    EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address,
-                                                QuicStringPiece("hq"), _))
+    EXPECT_CALL(*dispatcher_,
+                CreateQuicSession(connection_id, client_address,
+                                  quiche::QuicheStringPiece("hq"), _))
         .Times(0);
     ProcessPacket(client_address, connection_id, true, version, SerializeCHLO(),
                   true, CONNECTION_ID_PRESENT, PACKET_4BYTE_PACKET_NUMBER, 1);
@@ -426,7 +428,7 @@
 
   EXPECT_CALL(*dispatcher_,
               CreateQuicSession(TestConnectionId(1), client_address,
-                                QuicStringPiece(""), _))
+                                quiche::QuicheStringPiece(""), _))
       .WillOnce(Return(ByMove(CreateSession(
           dispatcher_.get(), config_, TestConnectionId(1), client_address,
           &mock_helper_, &mock_alarm_factory_, &crypto_config_,
@@ -449,7 +451,7 @@
 
   EXPECT_CALL(*dispatcher_,
               CreateQuicSession(TestConnectionId(1), client_address,
-                                QuicStringPiece("hq"), _))
+                                quiche::QuicheStringPiece("hq"), _))
       .WillOnce(Return(ByMove(CreateSession(
           dispatcher_.get(), config_, TestConnectionId(1), client_address,
           &mock_helper_, &mock_alarm_factory_, &crypto_config_,
@@ -466,7 +468,7 @@
 
   EXPECT_CALL(*dispatcher_,
               CreateQuicSession(TestConnectionId(2), client_address,
-                                QuicStringPiece("hq"), _))
+                                quiche::QuicheStringPiece("hq"), _))
       .WillOnce(Return(ByMove(CreateSession(
           dispatcher_.get(), config_, TestConnectionId(2), client_address,
           &mock_helper_, &mock_alarm_factory_, &crypto_config_,
@@ -496,7 +498,7 @@
 
   EXPECT_CALL(*dispatcher_,
               CreateQuicSession(TestConnectionId(1), client_address,
-                                QuicStringPiece("hq"), _))
+                                quiche::QuicheStringPiece("hq"), _))
       .WillOnce(Return(ByMove(CreateSession(
           dispatcher_.get(), config_, TestConnectionId(1), client_address,
           &mock_helper_, &mock_alarm_factory_, &crypto_config_,
@@ -609,8 +611,9 @@
 TEST_F(QuicDispatcherTest, Shutdown) {
   QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
 
-  EXPECT_CALL(*dispatcher_,
-              CreateQuicSession(_, client_address, QuicStringPiece("hq"), _))
+  EXPECT_CALL(
+      *dispatcher_,
+      CreateQuicSession(_, client_address, quiche::QuicheStringPiece("hq"), _))
       .WillOnce(Return(ByMove(CreateSession(
           dispatcher_.get(), config_, TestConnectionId(1), client_address,
           &mock_helper_, &mock_alarm_factory_, &crypto_config_,
@@ -638,8 +641,9 @@
   // Create a new session.
   QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
   QuicConnectionId connection_id = TestConnectionId(1);
-  EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address,
-                                              QuicStringPiece("hq"), _))
+  EXPECT_CALL(*dispatcher_,
+              CreateQuicSession(connection_id, client_address,
+                                quiche::QuicheStringPiece("hq"), _))
       .WillOnce(Return(ByMove(CreateSession(
           dispatcher_.get(), config_, connection_id, client_address,
           &mock_helper_, &mock_alarm_factory_, &crypto_config_,
@@ -680,7 +684,8 @@
   QuicConnectionId connection_id = TestConnectionId(1);
   // Dispatcher forwards all packets for this connection_id to the time wait
   // list manager.
-  EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, QuicStringPiece("hq"), _))
+  EXPECT_CALL(*dispatcher_,
+              CreateQuicSession(_, _, quiche::QuicheStringPiece("hq"), _))
       .Times(0);
   EXPECT_CALL(*time_wait_list_manager_,
               ProcessPacket(_, _, connection_id, _, _))
@@ -732,7 +737,7 @@
 
   EXPECT_CALL(*dispatcher_,
               CreateQuicSession(fixed_connection_id, client_address,
-                                QuicStringPiece("hq"), _))
+                                quiche::QuicheStringPiece("hq"), _))
       .WillOnce(Return(ByMove(CreateSession(
           dispatcher_.get(), config_, fixed_connection_id, client_address,
           &mock_helper_, &mock_alarm_factory_, &crypto_config_,
@@ -770,7 +775,7 @@
 
   EXPECT_CALL(*dispatcher_,
               CreateQuicSession(fixed_connection_id, client_address,
-                                QuicStringPiece("hq"), _))
+                                quiche::QuicheStringPiece("hq"), _))
       .WillOnce(Return(ByMove(CreateSession(
           dispatcher_.get(), config_, fixed_connection_id, client_address,
           &mock_helper_, &mock_alarm_factory_, &crypto_config_,
@@ -802,7 +807,7 @@
 
   EXPECT_CALL(*dispatcher_,
               CreateQuicSession(TestConnectionId(1), client_address,
-                                QuicStringPiece("hq"), _))
+                                quiche::QuicheStringPiece("hq"), _))
       .WillOnce(Return(ByMove(CreateSession(
           dispatcher_.get(), config_, TestConnectionId(1), client_address,
           &mock_helper_, &mock_alarm_factory_, &crypto_config_,
@@ -819,7 +824,7 @@
 
   EXPECT_CALL(*dispatcher_,
               CreateQuicSession(fixed_connection_id, client_address,
-                                QuicStringPiece("hq"), _))
+                                quiche::QuicheStringPiece("hq"), _))
       .WillOnce(Return(ByMove(CreateSession(
           dispatcher_.get(), config_, fixed_connection_id, client_address,
           &mock_helper_, &mock_alarm_factory_, &crypto_config_,
@@ -852,7 +857,7 @@
   // dispatcher_ should drop this packet.
   EXPECT_CALL(*dispatcher_,
               CreateQuicSession(TestConnectionId(1), client_address,
-                                QuicStringPiece("hq"), _))
+                                quiche::QuicheStringPiece("hq"), _))
       .Times(0);
   EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, _, _, _)).Times(0);
   EXPECT_CALL(*time_wait_list_manager_,
@@ -868,8 +873,9 @@
   QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
 
   // dispatcher_ should drop this packet.
-  EXPECT_CALL(*dispatcher_,
-              CreateQuicSession(_, client_address, QuicStringPiece("hq"), _))
+  EXPECT_CALL(
+      *dispatcher_,
+      CreateQuicSession(_, client_address, quiche::QuicheStringPiece("hq"), _))
       .Times(0);
   EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, _, _, _)).Times(0);
   EXPECT_CALL(*time_wait_list_manager_,
@@ -884,7 +890,7 @@
 
   EXPECT_CALL(*dispatcher_,
               CreateQuicSession(TestConnectionId(1), client_address,
-                                QuicStringPiece("hq"), _))
+                                quiche::QuicheStringPiece("hq"), _))
       .WillOnce(Return(ByMove(CreateSession(
           dispatcher_.get(), config_, TestConnectionId(1), client_address,
           &mock_helper_, &mock_alarm_factory_, &crypto_config_,
@@ -1310,7 +1316,8 @@
 
   QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
   QuicConnectionId connection_id = TestConnectionId(1);
-  EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, QuicStringPiece("hq"), _))
+  EXPECT_CALL(*dispatcher_,
+              CreateQuicSession(_, _, quiche::QuicheStringPiece("hq"), _))
       .Times(0);
   if (VersionHasIetfInvariantHeader(
           CurrentSupportedVersions()[0].transport_version)) {
@@ -1365,7 +1372,8 @@
     QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
 
     EXPECT_CALL(*dispatcher_,
-                CreateQuicSession(_, client_address, QuicStringPiece("hq"), _))
+                CreateQuicSession(_, client_address,
+                                  quiche::QuicheStringPiece("hq"), _))
         .WillOnce(Return(ByMove(CreateSession(
             dispatcher_.get(), config_, TestConnectionId(1), client_address,
             &helper_, &alarm_factory_, &crypto_config_,
@@ -1381,7 +1389,8 @@
     ProcessPacket(client_address, TestConnectionId(1), true, SerializeCHLO());
 
     EXPECT_CALL(*dispatcher_,
-                CreateQuicSession(_, client_address, QuicStringPiece("hq"), _))
+                CreateQuicSession(_, client_address,
+                                  quiche::QuicheStringPiece("hq"), _))
         .WillOnce(Return(ByMove(CreateSession(
             dispatcher_.get(), config_, TestConnectionId(2), client_address,
             &helper_, &alarm_factory_, &crypto_config_,
@@ -1676,8 +1685,9 @@
                                 ReceivedPacketInfoConnectionIdEquals(conn_id)));
   for (size_t i = 1; i <= kDefaultMaxUndecryptablePackets + 1; ++i) {
     ProcessPacket(client_address, conn_id, true,
-                  QuicStrCat("data packet ", i + 1), CONNECTION_ID_PRESENT,
-                  PACKET_4BYTE_PACKET_NUMBER, /*packet_number=*/i + 1);
+                  quiche::QuicheStrCat("data packet ", i + 1),
+                  CONNECTION_ID_PRESENT, PACKET_4BYTE_PACKET_NUMBER,
+                  /*packet_number=*/i + 1);
   }
   EXPECT_EQ(0u, dispatcher_->session_map().size())
       << "No session should be created before CHLO arrives.";
@@ -1686,8 +1696,8 @@
   data_connection_map_[conn_id].pop_back();
   // When CHLO arrives, a new session should be created, and all packets
   // buffered should be delivered to the session.
-  EXPECT_CALL(*dispatcher_,
-              CreateQuicSession(conn_id, client_address, QuicStringPiece(), _))
+  EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, client_address,
+                                              quiche::QuicheStringPiece(), _))
       .WillOnce(Return(ByMove(CreateSession(
           dispatcher_.get(), config_, conn_id, client_address, &mock_helper_,
           &mock_alarm_factory_, &crypto_config_,
@@ -1717,7 +1727,7 @@
                 ShouldCreateOrBufferPacketForConnection(
                     ReceivedPacketInfoConnectionIdEquals(conn_id)));
     ProcessPacket(client_address, conn_id, true,
-                  QuicStrCat("data packet on connection ", i),
+                  quiche::QuicheStrCat("data packet on connection ", i),
                   CONNECTION_ID_PRESENT, PACKET_4BYTE_PACKET_NUMBER,
                   /*packet_number=*/2);
   }
@@ -1740,7 +1750,7 @@
                       ReceivedPacketInfoConnectionIdEquals(conn_id)));
     }
     EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, client_address,
-                                                QuicStringPiece(), _))
+                                                quiche::QuicheStringPiece(), _))
         .WillOnce(Return(ByMove(CreateSession(
             dispatcher_.get(), config_, conn_id, client_address, &mock_helper_,
             &mock_alarm_factory_, &crypto_config_,
@@ -1766,8 +1776,8 @@
   QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
   EXPECT_CALL(*dispatcher_, ShouldCreateOrBufferPacketForConnection(
                                 ReceivedPacketInfoConnectionIdEquals(conn_id)));
-  EXPECT_CALL(*dispatcher_,
-              CreateQuicSession(conn_id, client_address, QuicStringPiece(), _))
+  EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, client_address,
+                                              quiche::QuicheStringPiece(), _))
       .WillOnce(Return(ByMove(CreateSession(
           dispatcher_.get(), config_, conn_id, client_address, &mock_helper_,
           &mock_alarm_factory_, &crypto_config_,
@@ -1783,14 +1793,15 @@
   InSequence s;
   QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
   QuicConnectionId conn_id = TestConnectionId(1);
-  ProcessPacket(client_address, conn_id, true, QuicStrCat("data packet ", 2),
-                CONNECTION_ID_PRESENT, PACKET_4BYTE_PACKET_NUMBER,
+  ProcessPacket(client_address, conn_id, true,
+                quiche::QuicheStrCat("data packet ", 2), CONNECTION_ID_PRESENT,
+                PACKET_4BYTE_PACKET_NUMBER,
                 /*packet_number=*/2);
 
   // When CHLO arrives, a new session should be created, and all packets
   // buffered should be delivered to the session.
-  EXPECT_CALL(*dispatcher_,
-              CreateQuicSession(conn_id, client_address, QuicStringPiece(), _))
+  EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, client_address,
+                                              quiche::QuicheStringPiece(), _))
       .Times(1)  // Only triggered by 1st CHLO.
       .WillOnce(Return(ByMove(CreateSession(
           dispatcher_.get(), config_, conn_id, client_address, &mock_helper_,
@@ -1818,8 +1829,9 @@
 
   QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
   QuicConnectionId conn_id = TestConnectionId(1);
-  ProcessPacket(client_address, conn_id, true, QuicStrCat("data packet ", 2),
-                CONNECTION_ID_PRESENT, PACKET_4BYTE_PACKET_NUMBER,
+  ProcessPacket(client_address, conn_id, true,
+                quiche::QuicheStrCat("data packet ", 2), CONNECTION_ID_PRESENT,
+                PACKET_4BYTE_PACKET_NUMBER,
                 /*packet_number=*/2);
 
   mock_helper_.AdvanceTime(
@@ -1853,7 +1865,7 @@
     if (conn_id <= kMaxNumSessionsToCreate) {
       EXPECT_CALL(*dispatcher_,
                   CreateQuicSession(TestConnectionId(conn_id), client_addr_,
-                                    QuicStringPiece(), _))
+                                    quiche::QuicheStringPiece(), _))
           .WillOnce(Return(ByMove(CreateSession(
               dispatcher_.get(), config_, TestConnectionId(conn_id),
               client_addr_, &mock_helper_, &mock_alarm_factory_,
@@ -1887,7 +1899,7 @@
        ++conn_id) {
     EXPECT_CALL(*dispatcher_,
                 CreateQuicSession(TestConnectionId(conn_id), client_addr_,
-                                  QuicStringPiece(), _))
+                                  quiche::QuicheStringPiece(), _))
         .WillOnce(Return(ByMove(CreateSession(
             dispatcher_.get(), config_, TestConnectionId(conn_id), client_addr_,
             &mock_helper_, &mock_alarm_factory_, &crypto_config_,
@@ -1901,7 +1913,7 @@
   }
   EXPECT_CALL(*dispatcher_,
               CreateQuicSession(TestConnectionId(kNumCHLOs), client_addr_,
-                                QuicStringPiece(), _))
+                                quiche::QuicheStringPiece(), _))
       .Times(0);
 
   while (store->HasChlosBuffered()) {
@@ -1921,7 +1933,7 @@
     if (conn_id <= kMaxNumSessionsToCreate) {
       EXPECT_CALL(*dispatcher_,
                   CreateQuicSession(TestConnectionId(conn_id), client_addr_,
-                                    QuicStringPiece(), _))
+                                    quiche::QuicheStringPiece(), _))
           .WillOnce(Return(ByMove(CreateSession(
               dispatcher_.get(), config_, TestConnectionId(conn_id),
               client_addr_, &mock_helper_, &mock_alarm_factory_,
@@ -1947,7 +1959,7 @@
 
   // Reset counter and process buffered CHLO.
   EXPECT_CALL(*dispatcher_, CreateQuicSession(last_connection, client_addr_,
-                                              QuicStringPiece(), _))
+                                              quiche::QuicheStringPiece(), _))
       .WillOnce(Return(ByMove(CreateSession(
           dispatcher_.get(), config_, last_connection, client_addr_,
           &mock_helper_, &mock_alarm_factory_, &crypto_config_,
@@ -1971,7 +1983,7 @@
     if (conn_id <= kMaxNumSessionsToCreate) {
       EXPECT_CALL(*dispatcher_,
                   CreateQuicSession(TestConnectionId(conn_id), client_addr_,
-                                    QuicStringPiece(), _))
+                                    quiche::QuicheStringPiece(), _))
           .WillOnce(Return(ByMove(CreateSession(
               dispatcher_.get(), config_, TestConnectionId(conn_id),
               client_addr_, &mock_helper_, &mock_alarm_factory_,
@@ -1998,7 +2010,7 @@
 
   // Reset counter and process buffered CHLO.
   EXPECT_CALL(*dispatcher_, CreateQuicSession(last_connection_id, client_addr_,
-                                              QuicStringPiece(), _))
+                                              quiche::QuicheStringPiece(), _))
       .WillOnce(Return(ByMove(CreateSession(
           dispatcher_.get(), config_, last_connection_id, client_addr_,
           &mock_helper_, &mock_alarm_factory_, &crypto_config_,
@@ -2034,7 +2046,7 @@
     if (conn_id <= kMaxNumSessionsToCreate + 1) {
       EXPECT_CALL(*dispatcher_,
                   CreateQuicSession(TestConnectionId(conn_id), client_addr_,
-                                    QuicStringPiece(), _))
+                                    quiche::QuicheStringPiece(), _))
           .WillOnce(Return(ByMove(CreateSession(
               dispatcher_.get(), config_, TestConnectionId(conn_id),
               client_addr_, &mock_helper_, &mock_alarm_factory_,
@@ -2076,7 +2088,7 @@
     if (conn_id <= kMaxNumSessionsToCreate) {
       EXPECT_CALL(*dispatcher_,
                   CreateQuicSession(TestConnectionId(conn_id), client_addr_,
-                                    QuicStringPiece(), version))
+                                    quiche::QuicheStringPiece(), version))
           .WillOnce(Return(ByMove(CreateSession(
               dispatcher_.get(), config_, TestConnectionId(conn_id),
               client_addr_, &mock_helper_, &mock_alarm_factory_,
@@ -2102,7 +2114,7 @@
         supported_versions[(conn_id - 1) % supported_versions.size()];
     EXPECT_CALL(*dispatcher_,
                 CreateQuicSession(TestConnectionId(conn_id), client_addr_,
-                                  QuicStringPiece(), version))
+                                  quiche::QuicheStringPiece(), version))
         .WillOnce(Return(ByMove(CreateSession(
             dispatcher_.get(), config_, TestConnectionId(conn_id), client_addr_,
             &mock_helper_, &mock_alarm_factory_, &crypto_config_,
diff --git a/quic/core/quic_flow_controller.cc b/quic/core/quic_flow_controller.cc
index 40f18a3..7175a47 100644
--- a/quic/core/quic_flow_controller.cc
+++ b/quic/core/quic_flow_controller.cc
@@ -14,7 +14,7 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
 
 namespace quic {
 
@@ -25,7 +25,7 @@
   if (is_connection_flow_controller_) {
     return "connection";
   }
-  return QuicStrCat("stream ", id_);
+  return quiche::QuicheStrCat("stream ", id_);
 }
 
 QuicFlowController::QuicFlowController(
@@ -99,8 +99,8 @@
     // This is an error on our side, close the connection as soon as possible.
     connection_->CloseConnection(
         QUIC_FLOW_CONTROL_SENT_TOO_MUCH_DATA,
-        QuicStrCat(send_window_offset_ - (bytes_sent_ + bytes_sent),
-                   "bytes over send window offset"),
+        quiche::QuicheStrCat(send_window_offset_ - (bytes_sent_ + bytes_sent),
+                             "bytes over send window offset"),
         ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
     return;
   }
diff --git a/quic/core/quic_flow_controller_test.cc b/quic/core/quic_flow_controller_test.cc
index e9854e9..8f4cdf7 100644
--- a/quic/core/quic_flow_controller_test.cc
+++ b/quic/core/quic_flow_controller_test.cc
@@ -8,12 +8,12 @@
 #include <utility>
 
 #include "net/third_party/quiche/src/quic/platform/api/quic_expect_bug.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
 #include "net/third_party/quiche/src/quic/test_tools/quic_connection_peer.h"
 #include "net/third_party/quiche/src/quic/test_tools/quic_flow_controller_peer.h"
 #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_str_cat.h"
 
 using testing::_;
 using testing::Invoke;
@@ -91,9 +91,9 @@
   // Try to send more bytes, violating flow control.
   EXPECT_CALL(*connection_,
               CloseConnection(QUIC_FLOW_CONTROL_SENT_TOO_MUCH_DATA, _, _));
-  EXPECT_QUIC_BUG(
-      flow_controller_->AddBytesSent(send_window_ * 10),
-      QuicStrCat("Trying to send an extra ", send_window_ * 10, " bytes"));
+  EXPECT_QUIC_BUG(flow_controller_->AddBytesSent(send_window_ * 10),
+                  quiche::QuicheStrCat("Trying to send an extra ",
+                                       send_window_ * 10, " bytes"));
   EXPECT_TRUE(flow_controller_->IsBlocked());
   EXPECT_EQ(0u, flow_controller_->SendWindowSize());
 }
diff --git a/quic/core/quic_framer.cc b/quic/core/quic_framer.cc
index 3235009..678796c 100644
--- a/quic/core/quic_framer.cc
+++ b/quic/core/quic_framer.cc
@@ -41,8 +41,9 @@
 #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_stack_trace.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_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 {
 
@@ -292,14 +293,14 @@
   return NUM_ENCRYPTION_LEVELS;
 }
 
-QuicStringPiece TruncateErrorString(QuicStringPiece error) {
+quiche::QuicheStringPiece TruncateErrorString(quiche::QuicheStringPiece error) {
   if (error.length() <= kMaxErrorStringLength) {
     return error;
   }
-  return QuicStringPiece(error.data(), kMaxErrorStringLength);
+  return quiche::QuicheStringPiece(error.data(), kMaxErrorStringLength);
 }
 
-size_t TruncatedErrorStringSize(const QuicStringPiece& error) {
+size_t TruncatedErrorStringSize(const quiche::QuicheStringPiece& error) {
   if (error.length() < kMaxErrorStringLength) {
     return error.length();
   }
@@ -384,8 +385,9 @@
     // the error value in the string.
     return initial_error_string;
   }
-  return QuicStrCat(std::to_string(static_cast<unsigned>(quic_error_code)), ":",
-                    initial_error_string);
+  return quiche::QuicheStrCat(
+      std::to_string(static_cast<unsigned>(quic_error_code)), ":",
+      initial_error_string);
 }
 
 }  // namespace
@@ -1516,7 +1518,7 @@
     return false;
   }
 
-  QuicStringPiece retry_token = reader->ReadRemainingPayload();
+  quiche::QuicheStringPiece retry_token = reader->ReadRemainingPayload();
   visitor_->OnRetryPacket(original_destination_connection_id,
                           header.source_connection_id, retry_token);
   return true;
@@ -1534,7 +1536,8 @@
     return;
   }
 
-  QuicStringPiece remaining_data = encrypted_reader.PeekRemainingPayload();
+  quiche::QuicheStringPiece remaining_data =
+      encrypted_reader.PeekRemainingPayload();
   DCHECK_EQ(remaining_data.length(), remaining_bytes_length);
 
   const char* coalesced_data =
@@ -1548,8 +1551,8 @@
     QUIC_PEER_BUG << ENDPOINT
                   << "Failed to parse received coalesced header of length "
                   << coalesced_data_length << ": "
-                  << QuicTextUtils::HexEncode(coalesced_data,
-                                              coalesced_data_length)
+                  << quiche::QuicheTextUtils::HexEncode(coalesced_data,
+                                                        coalesced_data_length)
                   << " previous header was " << header;
     return;
   }
@@ -1612,7 +1615,8 @@
       perspective_ == Perspective::IS_CLIENT) {
     // Peek possible stateless reset token. Will only be used on decryption
     // failure.
-    QuicStringPiece remaining = encrypted_reader->PeekRemainingPayload();
+    quiche::QuicheStringPiece 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,
@@ -1626,7 +1630,7 @@
     return false;
   }
 
-  QuicStringPiece associated_data;
+  quiche::QuicheStringPiece associated_data;
   std::vector<char> ad_storage;
   if (header->form == IETF_QUIC_SHORT_HEADER_PACKET ||
       header->long_packet_type != VERSION_NEGOTIATION) {
@@ -1652,7 +1656,8 @@
                                   &full_packet_number, &ad_storage)) {
         hp_removal_failed = true;
       }
-      associated_data = QuicStringPiece(ad_storage.data(), ad_storage.size());
+      associated_data =
+          quiche::QuicheStringPiece(ad_storage.data(), ad_storage.size());
     } else if (!ProcessAndCalculatePacketNumber(
                    encrypted_reader, header->packet_number_length,
                    base_packet_number, &full_packet_number)) {
@@ -1712,7 +1717,8 @@
     return false;
   }
 
-  QuicStringPiece encrypted = encrypted_reader->ReadRemainingPayload();
+  quiche::QuicheStringPiece encrypted =
+      encrypted_reader->ReadRemainingPayload();
   if (!version_.HasHeaderProtection()) {
     associated_data = GetAssociatedDataFromEncryptedPacket(
         version_.transport_version, packet,
@@ -1808,14 +1814,16 @@
     return false;
   }
 
-  QuicStringPiece encrypted = encrypted_reader->ReadRemainingPayload();
-  QuicStringPiece 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);
+  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);
 
   size_t decrypted_length = 0;
   EncryptionLevel decrypted_level;
@@ -1893,7 +1901,7 @@
   }
   // TODO(satyamshekhar): validate nonce to protect against DoS.
 
-  QuicStringPiece address;
+  quiche::QuicheStringPiece address;
   if (reset->GetStringPiece(kCADR, &address)) {
     QuicSocketAddressCoder address_coder;
     if (address_coder.Decode(address.data(), address.length())) {
@@ -1902,7 +1910,7 @@
     }
   }
 
-  QuicStringPiece endpoint_id;
+  quiche::QuicheStringPiece endpoint_id;
   if (perspective_ == Perspective::IS_CLIENT &&
       reset->GetStringPiece(kEPID, &endpoint_id)) {
     packet.endpoint_id = std::string(endpoint_id);
@@ -3324,8 +3332,8 @@
     return false;
   }
 
-  // TODO(ianswett): Don't use QuicStringPiece as an intermediary.
-  QuicStringPiece data;
+  // TODO(ianswett): Don't use quiche::QuicheStringPiece as an intermediary.
+  quiche::QuicheStringPiece data;
   if (has_data_length) {
     if (!reader->ReadStringPiece16(&data)) {
       set_detailed_error("Unable to read frame data.");
@@ -3387,8 +3395,8 @@
     frame->fin = false;
   }
 
-  // TODO(ianswett): Don't use QuicStringPiece as an intermediary.
-  QuicStringPiece data;
+  // TODO(ianswett): Don't use quiche::QuicheStringPiece as an intermediary.
+  quiche::QuicheStringPiece data;
   if (!reader->ReadStringPiece(&data, frame->data_length)) {
     set_detailed_error("Unable to read frame data.");
     return false;
@@ -3413,8 +3421,8 @@
   }
   frame->data_length = len;
 
-  // TODO(ianswett): Don't use QuicStringPiece as an intermediary.
-  QuicStringPiece data;
+  // TODO(ianswett): Don't use quiche::QuicheStringPiece as an intermediary.
+  quiche::QuicheStringPiece data;
   if (!reader->ReadStringPiece(&data, frame->data_length)) {
     set_detailed_error("Unable to read frame data.");
     return false;
@@ -3492,10 +3500,11 @@
     first_ack_block_underflow = true;
   }
   if (first_ack_block_underflow) {
-    set_detailed_error(QuicStrCat("Underflow with first ack block length ",
-                                  first_block_length, " largest acked is ",
-                                  largest_acked, ".")
-                           .c_str());
+    set_detailed_error(
+        quiche::QuicheStrCat("Underflow with first ack block length ",
+                             first_block_length, " largest acked is ",
+                             largest_acked, ".")
+            .c_str());
     return false;
   }
 
@@ -3528,8 +3537,9 @@
       }
       if (ack_block_underflow) {
         set_detailed_error(
-            QuicStrCat("Underflow with ack block length ", current_block_length,
-                       ", end of block is ", first_received - gap, ".")
+            quiche::QuicheStrCat("Underflow with ack block length ",
+                                 current_block_length, ", end of block is ",
+                                 first_received - gap, ".")
                 .c_str());
         return false;
       }
@@ -3577,10 +3587,11 @@
   }
 
   if (largest_acked.ToUint64() <= delta_from_largest_observed) {
-    set_detailed_error(QuicStrCat("delta_from_largest_observed too high: ",
-                                  delta_from_largest_observed,
-                                  ", largest_acked: ", largest_acked.ToUint64())
-                           .c_str());
+    set_detailed_error(
+        quiche::QuicheStrCat("delta_from_largest_observed too high: ",
+                             delta_from_largest_observed,
+                             ", largest_acked: ", largest_acked.ToUint64())
+            .c_str());
     return false;
   }
 
@@ -3605,9 +3616,9 @@
     }
     if (largest_acked.ToUint64() <= delta_from_largest_observed) {
       set_detailed_error(
-          QuicStrCat("delta_from_largest_observed too high: ",
-                     delta_from_largest_observed,
-                     ", largest_acked: ", largest_acked.ToUint64())
+          quiche::QuicheStrCat("delta_from_largest_observed too high: ",
+                               delta_from_largest_observed,
+                               ", largest_acked: ", largest_acked.ToUint64())
               .c_str());
       return false;
     }
@@ -3713,10 +3724,11 @@
   // error if the value is wrong.
   if (ack_block_value + first_sending_packet_number_.ToUint64() >
       largest_acked) {
-    set_detailed_error(QuicStrCat("Underflow with first ack block length ",
-                                  ack_block_value + 1, " largest acked is ",
-                                  largest_acked, ".")
-                           .c_str());
+    set_detailed_error(
+        quiche::QuicheStrCat("Underflow with first ack block length ",
+                             ack_block_value + 1, " largest acked is ",
+                             largest_acked, ".")
+            .c_str());
     return false;
   }
 
@@ -3746,8 +3758,9 @@
     // The test is written this way to detect wrap-arounds.
     if ((gap_block_value + 2) > block_low) {
       set_detailed_error(
-          QuicStrCat("Underflow with gap block length ", gap_block_value + 1,
-                     " previous ack block start is ", block_low, ".")
+          quiche::QuicheStrCat("Underflow with gap block length ",
+                               gap_block_value + 1,
+                               " previous ack block start is ", block_low, ".")
               .c_str());
       return false;
     }
@@ -3767,8 +3780,9 @@
     if (ack_block_value + first_sending_packet_number_.ToUint64() >
         (block_high - 1)) {
       set_detailed_error(
-          QuicStrCat("Underflow with ack block length ", ack_block_value + 1,
-                     " latest ack block end is ", block_high - 1, ".")
+          quiche::QuicheStrCat("Underflow with ack block length ",
+                               ack_block_value + 1, " latest ack block end is ",
+                               block_high - 1, ".")
               .c_str());
       return false;
     }
@@ -3859,7 +3873,7 @@
   // available in extracted_error_code.
   frame->extracted_error_code = frame->quic_error_code;
 
-  QuicStringPiece error_details;
+  quiche::QuicheStringPiece error_details;
   if (!reader->ReadStringPiece16(&error_details)) {
     set_detailed_error("Unable to read connection close error details.");
     return false;
@@ -3890,7 +3904,7 @@
   }
   frame->last_good_stream_id = static_cast<QuicStreamId>(stream_id);
 
-  QuicStringPiece reason_phrase;
+  quiche::QuicheStringPiece reason_phrase;
   if (!reader->ReadStringPiece16(&reason_phrase)) {
     set_detailed_error("Unable to read goaway reason.");
     return false;
@@ -3944,7 +3958,7 @@
                                      bool no_message_length,
                                      QuicMessageFrame* frame) {
   if (no_message_length) {
-    QuicStringPiece remaining(reader->ReadRemainingPayload());
+    quiche::QuicheStringPiece remaining(reader->ReadRemainingPayload());
     frame->data = remaining.data();
     frame->message_length = remaining.length();
     return true;
@@ -3956,7 +3970,7 @@
     return false;
   }
 
-  QuicStringPiece message_piece;
+  quiche::QuicheStringPiece message_piece;
   if (!reader->ReadStringPiece(&message_piece, message_length)) {
     set_detailed_error("Unable to read message data");
     return false;
@@ -3969,7 +3983,7 @@
 }
 
 // static
-QuicStringPiece QuicFramer::GetAssociatedDataFromEncryptedPacket(
+quiche::QuicheStringPiece QuicFramer::GetAssociatedDataFromEncryptedPacket(
     QuicTransportVersion version,
     const QuicEncryptedPacket& encrypted,
     QuicConnectionIdLength destination_connection_id_length,
@@ -3981,7 +3995,7 @@
     uint64_t retry_token_length,
     QuicVariableLengthIntegerLength length_length) {
   // TODO(ianswett): This is identical to QuicData::AssociatedData.
-  return QuicStringPiece(
+  return quiche::QuicheStringPiece(
       encrypted.data(),
       GetStartOfEncryptedData(version, destination_connection_id_length,
                               source_connection_id_length, includes_version,
@@ -4086,9 +4100,10 @@
   size_t output_length = 0;
   if (!encrypter_[level]->EncryptPacket(
           packet_number.ToUint64(),
-          QuicStringPiece(buffer, ad_len),  // Associated data
-          QuicStringPiece(buffer + ad_len, total_len - ad_len),  // Plaintext
-          buffer + ad_len,  // Destination buffer
+          quiche::QuicheStringPiece(buffer, ad_len),  // Associated data
+          quiche::QuicheStringPiece(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;
@@ -4127,7 +4142,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);
-  QuicStringPiece sample;
+  quiche::QuicheStringPiece sample;
   if (!sample_reader.Seek(sample_offset) ||
       !sample_reader.ReadStringPiece(&sample, kHPSampleLen)) {
     QUIC_BUG << "Not enough bytes to sample: sample_offset " << sample_offset
@@ -4214,11 +4229,11 @@
 
   // Read a sample from the ciphertext and compute the mask to use for header
   // protection.
-  QuicStringPiece remaining_packet = reader->PeekRemainingPayload();
+  quiche::QuicheStringPiece remaining_packet = reader->PeekRemainingPayload();
   QuicDataReader sample_reader(remaining_packet);
 
   // The sample starts 4 bytes after the start of the packet number.
-  QuicStringPiece pn;
+  quiche::QuicheStringPiece pn;
   if (!sample_reader.ReadStringPiece(&pn, 4)) {
     QUIC_DVLOG(1) << "Not enough data to sample";
     return false;
@@ -4286,7 +4301,7 @@
   }
 
   // Get the associated data, and apply the same unmasking operations to it.
-  QuicStringPiece ad = GetAssociatedDataFromEncryptedPacket(
+  quiche::QuicheStringPiece ad = GetAssociatedDataFromEncryptedPacket(
       version_.transport_version, packet,
       GetIncludedDestinationConnectionIdLength(*header),
       GetIncludedSourceConnectionIdLength(*header), header->version_flag,
@@ -4328,7 +4343,7 @@
     return 0;
   }
 
-  QuicStringPiece associated_data =
+  quiche::QuicheStringPiece associated_data =
       packet.AssociatedData(version_.transport_version);
   // Copy in the header, because the encrypter only populates the encrypted
   // plaintext content.
@@ -4375,8 +4390,8 @@
   return min_plaintext_size;
 }
 
-bool QuicFramer::DecryptPayload(QuicStringPiece encrypted,
-                                QuicStringPiece associated_data,
+bool QuicFramer::DecryptPayload(quiche::QuicheStringPiece encrypted,
+                                quiche::QuicheStringPiece associated_data,
                                 const QuicPacketHeader& header,
                                 char* decrypted_buffer,
                                 size_t buffer_length,
@@ -4946,8 +4961,8 @@
     return false;
   }
 
-  // TODO(ianswett): Don't use QuicStringPiece as an intermediary.
-  QuicStringPiece data;
+  // TODO(ianswett): Don't use quiche::QuicheStringPiece as an intermediary.
+  quiche::QuicheStringPiece data;
   if (!reader->ReadStringPiece(&data, length)) {
     set_detailed_error("Unable to read new token data.");
     return false;
@@ -5664,7 +5679,7 @@
     return false;
   }
 
-  QuicStringPiece phrase;
+  quiche::QuicheStringPiece phrase;
   if (!reader->ReadStringPiece(&phrase, static_cast<size_t>(phrase_length))) {
     set_detailed_error("Unable to read connection close error details.");
     return false;
@@ -6118,7 +6133,7 @@
     QuicConnectionId* destination_connection_id,
     QuicConnectionId* source_connection_id,
     bool* retry_token_present,
-    QuicStringPiece* retry_token,
+    quiche::QuicheStringPiece* retry_token,
     std::string* detailed_error) {
   QuicDataReader reader(packet.data(), packet.length());
   if (reader.IsDoneReading()) {
@@ -6288,7 +6303,7 @@
     QuicConnectionId* source_connection_id,
     QuicLongHeaderType* long_packet_type,
     QuicVariableLengthIntegerLength* retry_token_length_length,
-    QuicStringPiece* retry_token,
+    quiche::QuicheStringPiece* retry_token,
     std::string* detailed_error) {
   *version_present = false;
   *has_length_prefix = false;
@@ -6297,7 +6312,7 @@
   *source_connection_id = EmptyQuicConnectionId();
   *long_packet_type = INVALID_PACKET_TYPE;
   *retry_token_length_length = VARIABLE_LENGTH_INTEGER_LENGTH_0;
-  *retry_token = QuicStringPiece();
+  *retry_token = quiche::QuicheStringPiece();
   *detailed_error = "";
 
   if (!reader->ReadUInt8(first_byte)) {
@@ -6565,11 +6580,11 @@
 // the string is not found, or is not properly formed, it returns
 // ErrorCode::QUIC_IETF_GQUIC_ERROR_MISSING
 void MaybeExtractQuicErrorCode(QuicConnectionCloseFrame* frame) {
-  std::vector<QuicStringPiece> ed =
-      QuicTextUtils::Split(frame->error_details, ':');
+  std::vector<quiche::QuicheStringPiece> ed =
+      quiche::QuicheTextUtils::Split(frame->error_details, ':');
   uint64_t extracted_error_code;
-  if (ed.size() < 2 || !QuicTextUtils::IsAllDigits(ed[0]) ||
-      !QuicTextUtils::StringToUint64(ed[0], &extracted_error_code)) {
+  if (ed.size() < 2 || !quiche::QuicheTextUtils::IsAllDigits(ed[0]) ||
+      !quiche::QuicheTextUtils::StringToUint64(ed[0], &extracted_error_code)) {
     if (frame->close_type == IETF_QUIC_TRANSPORT_CONNECTION_CLOSE &&
         frame->transport_error_code == NO_IETF_QUIC_ERROR) {
       frame->extracted_error_code = QUIC_NO_ERROR;
@@ -6583,7 +6598,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 :
-  QuicStringPiece x = QuicStringPiece(frame->error_details);
+  quiche::QuicheStringPiece x = quiche::QuicheStringPiece(frame->error_details);
   x.remove_prefix(ed[0].length() + 1);
   frame->error_details = std::string(x);
   frame->extracted_error_code =
diff --git a/quic/core/quic_framer.h b/quic/core/quic_framer.h
index cd2e2c7..44e172b 100644
--- a/quic/core/quic_framer.h
+++ b/quic/core/quic_framer.h
@@ -17,7 +17,7 @@
 #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_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
 
 namespace quic {
 
@@ -97,7 +97,7 @@
   // parsed.
   virtual void OnRetryPacket(QuicConnectionId original_connection_id,
                              QuicConnectionId new_connection_id,
-                             QuicStringPiece retry_token) = 0;
+                             quiche::QuicheStringPiece retry_token) = 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
@@ -368,7 +368,7 @@
 
   // Returns the associated data from the encrypted packet |encrypted| as a
   // stringpiece.
-  static QuicStringPiece GetAssociatedDataFromEncryptedPacket(
+  static quiche::QuicheStringPiece GetAssociatedDataFromEncryptedPacket(
       QuicTransportVersion version,
       const QuicEncryptedPacket& encrypted,
       QuicConnectionIdLength destination_connection_id_length,
@@ -397,7 +397,7 @@
       QuicConnectionId* source_connection_id,
       QuicLongHeaderType* long_packet_type,
       QuicVariableLengthIntegerLength* retry_token_length_length,
-      QuicStringPiece* retry_token,
+      quiche::QuicheStringPiece* retry_token,
       std::string* detailed_error);
 
   // Parses the unencryoted fields in |packet| and stores them in the other
@@ -415,7 +415,7 @@
       QuicConnectionId* destination_connection_id,
       QuicConnectionId* source_connection_id,
       bool* retry_token_present,
-      QuicStringPiece* retry_token,
+      quiche::QuicheStringPiece* retry_token,
       std::string* detailed_error);
 
   // Serializes a packet containing |frames| into |buffer|.
@@ -780,8 +780,8 @@
                            bool no_message_length,
                            QuicMessageFrame* frame);
 
-  bool DecryptPayload(QuicStringPiece encrypted,
-                      QuicStringPiece associated_data,
+  bool DecryptPayload(quiche::QuicheStringPiece encrypted,
+                      quiche::QuicheStringPiece 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 a810d7b..ab254a2 100644
--- a/quic/core/quic_framer_test.cc
+++ b/quic/core/quic_framer_test.cc
@@ -28,10 +28,11 @@
 #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_test.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
 #include "net/third_party/quiche/src/quic/test_tools/quic_framer_peer.h"
 #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_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
 
 using testing::_;
 using testing::Return;
@@ -91,15 +92,17 @@
 class TestEncrypter : public QuicEncrypter {
  public:
   ~TestEncrypter() override {}
-  bool SetKey(QuicStringPiece /*key*/) override { return true; }
-  bool SetNoncePrefix(QuicStringPiece /*nonce_prefix*/) override {
+  bool SetKey(quiche::QuicheStringPiece /*key*/) override { return true; }
+  bool SetNoncePrefix(quiche::QuicheStringPiece /*nonce_prefix*/) override {
     return true;
   }
-  bool SetIV(QuicStringPiece /*iv*/) override { return true; }
-  bool SetHeaderProtectionKey(QuicStringPiece /*key*/) override { return true; }
+  bool SetIV(quiche::QuicheStringPiece /*iv*/) override { return true; }
+  bool SetHeaderProtectionKey(quiche::QuicheStringPiece /*key*/) override {
+    return true;
+  }
   bool EncryptPacket(uint64_t packet_number,
-                     QuicStringPiece associated_data,
-                     QuicStringPiece plaintext,
+                     quiche::QuicheStringPiece associated_data,
+                     quiche::QuicheStringPiece plaintext,
                      char* output,
                      size_t* output_length,
                      size_t /*max_output_length*/) override {
@@ -111,7 +114,7 @@
     return true;
   }
   std::string GenerateHeaderProtectionMask(
-      QuicStringPiece /*sample*/) override {
+      quiche::QuicheStringPiece /*sample*/) override {
     return std::string(5, 0);
   }
   size_t GetKeySize() const override { return 0; }
@@ -123,8 +126,12 @@
   size_t GetCiphertextSize(size_t plaintext_size) const override {
     return plaintext_size;
   }
-  QuicStringPiece GetKey() const override { return QuicStringPiece(); }
-  QuicStringPiece GetNoncePrefix() const override { return QuicStringPiece(); }
+  quiche::QuicheStringPiece GetKey() const override {
+    return quiche::QuicheStringPiece();
+  }
+  quiche::QuicheStringPiece GetNoncePrefix() const override {
+    return quiche::QuicheStringPiece();
+  }
 
   QuicPacketNumber packet_number_;
   std::string associated_data_;
@@ -134,13 +141,15 @@
 class TestDecrypter : public QuicDecrypter {
  public:
   ~TestDecrypter() override {}
-  bool SetKey(QuicStringPiece /*key*/) override { return true; }
-  bool SetNoncePrefix(QuicStringPiece /*nonce_prefix*/) override {
+  bool SetKey(quiche::QuicheStringPiece /*key*/) override { return true; }
+  bool SetNoncePrefix(quiche::QuicheStringPiece /*nonce_prefix*/) override {
     return true;
   }
-  bool SetIV(QuicStringPiece /*iv*/) override { return true; }
-  bool SetHeaderProtectionKey(QuicStringPiece /*key*/) override { return true; }
-  bool SetPreliminaryKey(QuicStringPiece /*key*/) override {
+  bool SetIV(quiche::QuicheStringPiece /*iv*/) override { return true; }
+  bool SetHeaderProtectionKey(quiche::QuicheStringPiece /*key*/) override {
+    return true;
+  }
+  bool SetPreliminaryKey(quiche::QuicheStringPiece /*key*/) override {
     QUIC_BUG << "should not be called";
     return false;
   }
@@ -148,8 +157,8 @@
     return true;
   }
   bool DecryptPacket(uint64_t packet_number,
-                     QuicStringPiece associated_data,
-                     QuicStringPiece ciphertext,
+                     quiche::QuicheStringPiece associated_data,
+                     quiche::QuicheStringPiece ciphertext,
                      char* output,
                      size_t* output_length,
                      size_t /*max_output_length*/) override {
@@ -167,8 +176,12 @@
   size_t GetKeySize() const override { return 0; }
   size_t GetNoncePrefixSize() const override { return 0; }
   size_t GetIVSize() const override { return 0; }
-  QuicStringPiece GetKey() const override { return QuicStringPiece(); }
-  QuicStringPiece GetNoncePrefix() const override { return QuicStringPiece(); }
+  quiche::QuicheStringPiece GetKey() const override {
+    return quiche::QuicheStringPiece();
+  }
+  quiche::QuicheStringPiece GetNoncePrefix() const override {
+    return quiche::QuicheStringPiece();
+  }
   // Use a distinct value starting with 0xFFFFFF, which is never used by TLS.
   uint32_t cipher_id() const override { return 0xFFFFFFF2; }
   QuicPacketNumber packet_number_;
@@ -211,7 +224,7 @@
 
   void OnRetryPacket(QuicConnectionId original_connection_id,
                      QuicConnectionId new_connection_id,
-                     QuicStringPiece retry_token) override {
+                     quiche::QuicheStringPiece retry_token) override {
     retry_original_connection_id_ =
         std::make_unique<QuicConnectionId>(original_connection_id);
     retry_new_connection_id_ =
@@ -662,7 +675,7 @@
                       << " actual: " << decrypter_->packet_number_;
       return false;
     }
-    QuicStringPiece associated_data =
+    quiche::QuicheStringPiece associated_data =
         QuicFramer::GetAssociatedDataFromEncryptedPacket(
             framer_.transport_version(), encrypted,
             destination_connection_id_length, source_connection_id_length,
@@ -671,12 +684,13 @@
             retry_token_length, length_length);
     if (associated_data != decrypter_->associated_data_) {
       QUIC_LOG(ERROR) << "Decrypted incorrect associated data.  expected "
-                      << QuicTextUtils::HexEncode(associated_data)
+                      << quiche::QuicheTextUtils::HexEncode(associated_data)
                       << " actual: "
-                      << QuicTextUtils::HexEncode(decrypter_->associated_data_);
+                      << quiche::QuicheTextUtils::HexEncode(
+                             decrypter_->associated_data_);
       return false;
     }
-    QuicStringPiece ciphertext(
+    quiche::QuicheStringPiece ciphertext(
         encrypted.AsStringPiece().substr(GetStartOfEncryptedData(
             framer_.transport_version(), destination_connection_id_length,
             source_connection_id_length, includes_version,
@@ -684,10 +698,12 @@
             retry_token_length_length, retry_token_length, length_length)));
     if (ciphertext != decrypter_->ciphertext_) {
       QUIC_LOG(ERROR) << "Decrypted incorrect ciphertext data.  expected "
-                      << QuicTextUtils::HexEncode(ciphertext) << " actual: "
-                      << QuicTextUtils::HexEncode(decrypter_->ciphertext_)
+                      << quiche::QuicheTextUtils::HexEncode(ciphertext)
+                      << " actual: "
+                      << quiche::QuicheTextUtils::HexEncode(
+                             decrypter_->ciphertext_)
                       << " associated data: "
-                      << QuicTextUtils::HexEncode(associated_data);
+                      << quiche::QuicheTextUtils::HexEncode(associated_data);
       return false;
     }
     return true;
@@ -1022,7 +1038,7 @@
   QuicVersionLabel version_label;
   std::string detailed_error;
   bool retry_token_present, use_length_prefix;
-  QuicStringPiece retry_token;
+  quiche::QuicheStringPiece retry_token;
   ParsedQuicVersion parsed_version = UnsupportedQuicVersion();
   const QuicErrorCode error_code = QuicFramer::ParsePublicHeaderDispatcher(
       *encrypted, kQuicDefaultConnectionIdLength, &format, &long_packet_type,
@@ -1087,7 +1103,7 @@
   QuicVersionLabel version_label;
   std::string detailed_error;
   bool retry_token_present, use_length_prefix;
-  QuicStringPiece retry_token;
+  quiche::QuicheStringPiece retry_token;
   ParsedQuicVersion parsed_version = UnsupportedQuicVersion();
   const QuicErrorCode error_code = QuicFramer::ParsePublicHeaderDispatcher(
       *encrypted, kQuicDefaultConnectionIdLength, &format, &long_packet_type,
@@ -1167,7 +1183,7 @@
   QuicVersionLabel version_label = 0;
   std::string detailed_error = "";
   bool retry_token_present, use_length_prefix;
-  QuicStringPiece retry_token;
+  quiche::QuicheStringPiece retry_token;
   ParsedQuicVersion parsed_version = UnsupportedQuicVersion();
   const QuicErrorCode error_code = QuicFramer::ParsePublicHeaderDispatcher(
       encrypted, kQuicDefaultConnectionIdLength, &format, &long_packet_type,
@@ -1257,7 +1273,7 @@
   QuicLongHeaderType long_packet_type = INVALID_PACKET_TYPE;
   QuicVariableLengthIntegerLength retry_token_length_length =
       VARIABLE_LENGTH_INTEGER_LENGTH_4;
-  QuicStringPiece retry_token;
+  quiche::QuicheStringPiece retry_token;
   std::string detailed_error = "foobar";
 
   QuicDataReader reader(AsChars(p), p_length);
@@ -1280,7 +1296,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(QuicStringPiece(), retry_token);
+  EXPECT_EQ(quiche::QuicheStringPiece(), retry_token);
   if (VersionHasIetfInvariantHeader(framer_.transport_version())) {
     EXPECT_EQ(IETF_QUIC_LONG_HEADER_PACKET, format);
     EXPECT_EQ(HANDSHAKE, long_packet_type);
@@ -1327,7 +1343,7 @@
   QuicLongHeaderType long_packet_type = INVALID_PACKET_TYPE;
   QuicVariableLengthIntegerLength retry_token_length_length =
       VARIABLE_LENGTH_INTEGER_LENGTH_4;
-  QuicStringPiece retry_token;
+  quiche::QuicheStringPiece retry_token;
   std::string detailed_error = "foobar";
 
   QuicDataReader reader(AsChars(p), p_length);
@@ -1347,7 +1363,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(QuicStringPiece(), retry_token);
+  EXPECT_EQ(quiche::QuicheStringPiece(), retry_token);
   EXPECT_EQ(IETF_QUIC_LONG_HEADER_PACKET, format);
 }
 
@@ -3994,7 +4010,7 @@
                                                              : packet),
       QUIC_ARRAYSIZE(packet), false);
   EXPECT_FALSE(framer_.ProcessPacket(encrypted));
-  EXPECT_TRUE(QuicTextUtils::StartsWith(
+  EXPECT_TRUE(quiche::QuicheTextUtils::StartsWith(
       framer_.detailed_error(), "delta_from_largest_observed too high"));
 }
 
@@ -4068,7 +4084,7 @@
                                                              : packet),
       QUIC_ARRAYSIZE(packet), false);
   EXPECT_FALSE(framer_.ProcessPacket(encrypted));
-  EXPECT_TRUE(QuicTextUtils::StartsWith(
+  EXPECT_TRUE(quiche::QuicheTextUtils::StartsWith(
       framer_.detailed_error(), "delta_from_largest_observed too high"));
 }
 
@@ -5806,7 +5822,7 @@
   header.version_flag = false;
   header.packet_number = kPacketNumber;
   QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset,
-                               QuicStringPiece("hello world!"));
+                               quiche::QuicheStringPiece("hello world!"));
   QuicPaddingFrame padding_frame(2);
   QuicFrames frames = {QuicFrame(padding_frame), QuicFrame(stream_frame),
                        QuicFrame(padding_frame)};
@@ -6149,7 +6165,7 @@
   }
 
   QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset,
-                               QuicStringPiece("hello world!"));
+                               quiche::QuicheStringPiece("hello world!"));
 
   QuicFrames frames = {QuicFrame(stream_frame)};
 
@@ -6248,7 +6264,7 @@
   }
 
   QuicStreamFrame stream_frame(kStreamId, true, kStreamOffset,
-                               QuicStringPiece("hello world!"));
+                               quiche::QuicheStringPiece("hello world!"));
   QuicFrames frames = {QuicFrame(stream_frame)};
 
   // clang-format off
@@ -6381,7 +6397,7 @@
   SimpleDataProducer data_producer;
   framer_.set_data_producer(&data_producer);
 
-  QuicStringPiece crypto_frame_contents("hello world!");
+  quiche::QuicheStringPiece crypto_frame_contents("hello world!");
   QuicCryptoFrame crypto_frame(ENCRYPTION_INITIAL, kStreamOffset,
                                crypto_frame_contents.length());
   data_producer.SaveCryptoData(ENCRYPTION_INITIAL, kStreamOffset,
@@ -13249,7 +13265,7 @@
   QuicConnectionId destination_connection_id = TestConnectionId(0x33);
   QuicConnectionId source_connection_id = TestConnectionId(0x34);
   bool retry_token_present = true;
-  QuicStringPiece retry_token;
+  quiche::QuicheStringPiece retry_token;
   std::string detailed_error = "foobar";
 
   QuicErrorCode parse_result = QuicFramer::ParsePublicHeaderDispatcher(
@@ -13266,7 +13282,7 @@
   EXPECT_EQ(probe_payload_connection_id, destination_connection_id);
   EXPECT_EQ(EmptyQuicConnectionId(), source_connection_id);
   EXPECT_FALSE(retry_token_present);
-  EXPECT_EQ(QuicStringPiece(), retry_token);
+  EXPECT_EQ(quiche::QuicheStringPiece(), retry_token);
   EXPECT_EQ("", detailed_error);
 }
 
@@ -13401,7 +13417,7 @@
   QuicConnectionId destination_connection_id = TestConnectionId(1);
   QuicConnectionId source_connection_id = TestConnectionId(2);
   bool retry_token_present = true;
-  QuicStringPiece retry_token;
+  quiche::QuicheStringPiece retry_token;
   std::string detailed_error = "foobar";
   QuicErrorCode header_parse_result = QuicFramer::ParsePublicHeaderDispatcher(
       encrypted, kQuicDefaultConnectionIdLength, &format, &long_packet_type,
@@ -13480,7 +13496,7 @@
   QuicConnectionId destination_connection_id = TestConnectionId(1);
   QuicConnectionId source_connection_id = TestConnectionId(2);
   bool retry_token_present = true;
-  QuicStringPiece retry_token;
+  quiche::QuicheStringPiece 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_ietf_framer_test.cc b/quic/core/quic_ietf_framer_test.cc
new file mode 100644
index 0000000..3dd7a82
--- /dev/null
+++ b/quic/core/quic_ietf_framer_test.cc
@@ -0,0 +1,1503 @@
+// Copyright (c) 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// gunit tests for the IETF-format framer --- generally does a simple test
+// for each framer; we generate the template object (eg
+// QuicIetfStreamFrame) with the correct stuff in it, ask that a frame
+// be serialized (call AppendIetf<mumble>) then deserialized (call
+// ProcessIetf<mumble>) and then check that the gazintas and gazoutas
+// are the same.
+//
+// We do minimal checking of the serialized frame
+//
+// We do look at various different values (resulting in different
+// length varints, etc)
+
+#include "net/third_party/quiche/src/quic/core/quic_framer.h"
+
+#include <algorithm>
+#include <cstdint>
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+#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"
+#include "net/third_party/quiche/src/quic/core/crypto/quic_encrypter.h"
+#include "net/third_party/quiche/src/quic/core/quic_data_reader.h"
+#include "net/third_party/quiche/src/quic/core/quic_data_writer.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_arraysize.h"
+#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
+#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
+#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
+#include "net/third_party/quiche/src/quic/test_tools/quic_framer_peer.h"
+#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_string_piece.h"
+
+namespace quic {
+namespace test {
+namespace {
+
+const size_t kNormalPacketBufferSize = 1400;
+// Several different stream ids, should be encoded
+// in 8, 4, 2, and 1 byte, respectively. Last one
+// checks that value==0 works.
+// All stream IDs end in 0x0, so the client/server- initiated
+// and Uni/Bi-directional bits are available to alter, as any
+// given test may wish.
+const QuicIetfStreamId kStreamId8 = UINT64_C(0x3EDCBA9876543210);
+const QuicIetfStreamId kStreamId4 = UINT64_C(0x36543210);
+const QuicIetfStreamId kStreamId2 = UINT64_C(0x3210);
+const QuicIetfStreamId kStreamId1 = UINT64_C(0x10);
+const QuicIetfStreamId kStreamId0 = UINT64_C(0x00);
+
+// Ditto for the offsets.
+const QuicIetfStreamOffset kOffset8 = UINT64_C(0x3210BA9876543210);
+const QuicIetfStreamOffset kOffset4 = UINT64_C(0x32109876);
+const QuicIetfStreamOffset kOffset2 = UINT64_C(0x3456);
+const QuicIetfStreamOffset kOffset1 = UINT64_C(0x3f);
+const QuicIetfStreamOffset kOffset0 = UINT64_C(0x00);
+
+// Structures used to create various ack frames.
+
+// Defines an ack frame to feed through the framer/deframer.
+struct ack_frame {
+  uint64_t delay_time;
+  bool is_ack_ecn;
+  QuicPacketCount ect_0_count;
+  QuicPacketCount ect_1_count;
+  QuicPacketCount ecn_ce_count;
+  const std::vector<QuicAckBlock>& ranges;
+  uint64_t expected_frame_type;
+};
+
+class TestQuicVisitor : public QuicFramerVisitorInterface {
+ public:
+  TestQuicVisitor() {}
+
+  ~TestQuicVisitor() override {}
+
+  void OnError(QuicFramer* f) override {
+    QUIC_DLOG(INFO) << "QuicIetfFramer Error: "
+                    << QuicErrorCodeToString(f->error()) << " (" << f->error()
+                    << ")";
+  }
+
+  void OnPacket() override {}
+
+  void OnPublicResetPacket(const QuicPublicResetPacket& /*packet*/) override {}
+
+  void OnVersionNegotiationPacket(
+      const QuicVersionNegotiationPacket& /*packet*/) override {}
+
+  void OnRetryPacket(QuicConnectionId /*original_connection_id*/,
+                     QuicConnectionId /*new_connection_id*/,
+                     quiche::QuicheStringPiece /*retry_token*/) override {}
+
+  bool OnProtocolVersionMismatch(
+      ParsedQuicVersion /*received_version*/) override {
+    return false;
+  }
+
+  bool OnUnauthenticatedPublicHeader(
+      const QuicPacketHeader& /*header*/) override {
+    return true;
+  }
+
+  bool OnUnauthenticatedHeader(const QuicPacketHeader& /*header*/) override {
+    return true;
+  }
+
+  void OnDecryptedPacket(EncryptionLevel /*level*/) override {}
+
+  bool OnPacketHeader(const QuicPacketHeader& /*header*/) override {
+    return true;
+  }
+
+  void OnCoalescedPacket(const QuicEncryptedPacket& /*packet*/) override {}
+
+  void OnUndecryptablePacket(const QuicEncryptedPacket& /*packet*/,
+                             EncryptionLevel /*decryption_level*/,
+                             bool /*has_decryption_key*/) override {}
+
+  bool OnStreamFrame(const QuicStreamFrame& /*frame*/) override { return true; }
+
+  bool OnCryptoFrame(const QuicCryptoFrame& /*frame*/) override { return true; }
+
+  bool OnAckFrameStart(QuicPacketNumber /*largest_acked*/,
+                       QuicTime::Delta /*ack_delay_time*/) override {
+    return true;
+  }
+
+  bool OnAckRange(QuicPacketNumber /*start*/,
+                  QuicPacketNumber /*end*/) override {
+    return true;
+  }
+
+  bool OnAckTimestamp(QuicPacketNumber /*packet_number*/,
+                      QuicTime /*timestamp*/) override {
+    return true;
+  }
+
+  bool OnAckFrameEnd(QuicPacketNumber /*start*/) override { return true; }
+
+  bool OnStopWaitingFrame(const QuicStopWaitingFrame& /*frame*/) override {
+    return true;
+  }
+
+  bool OnPaddingFrame(const QuicPaddingFrame& /*frame*/) override {
+    return true;
+  }
+
+  bool OnPingFrame(const QuicPingFrame& /*frame*/) override { return true; }
+
+  bool OnMessageFrame(const QuicMessageFrame& /*frame*/) override {
+    return true;
+  }
+
+  void OnPacketComplete() override {}
+
+  bool OnRstStreamFrame(const QuicRstStreamFrame& /*frame*/) override {
+    return true;
+  }
+
+  bool OnConnectionCloseFrame(
+      const QuicConnectionCloseFrame& /*frame*/) override {
+    return true;
+  }
+
+  bool OnStopSendingFrame(const QuicStopSendingFrame& /*frame*/) override {
+    return true;
+  }
+
+  bool OnPathChallengeFrame(const QuicPathChallengeFrame& /*frame*/) override {
+    return true;
+  }
+  bool OnPathResponseFrame(const QuicPathResponseFrame& /*frame*/) override {
+    return true;
+  }
+
+  bool OnGoAwayFrame(const QuicGoAwayFrame& /*frame*/) override { return true; }
+
+  bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& /*frame*/) override {
+    return true;
+  }
+
+  bool OnBlockedFrame(const QuicBlockedFrame& /*frame*/) override {
+    return true;
+  }
+
+  bool OnNewConnectionIdFrame(
+      const QuicNewConnectionIdFrame& /*frame*/) override {
+    return true;
+  }
+
+  bool OnRetireConnectionIdFrame(
+      const QuicRetireConnectionIdFrame& /*frame*/) override {
+    return true;
+  }
+
+  bool OnNewTokenFrame(const QuicNewTokenFrame& /*frame*/) override {
+    return true;
+  }
+
+  bool IsValidStatelessResetToken(QuicUint128 /*token*/) const override {
+    return true;
+  }
+
+  void OnAuthenticatedIetfStatelessResetPacket(
+      const QuicIetfStatelessResetPacket& /*packet*/) override {}
+
+  bool OnMaxStreamsFrame(const QuicMaxStreamsFrame& /*frame*/) override {
+    return true;
+  }
+
+  bool OnStreamsBlockedFrame(
+      const QuicStreamsBlockedFrame& /*frame*/) override {
+    return true;
+  }
+};
+
+class QuicIetfFramerTest : public QuicTestWithParam<ParsedQuicVersion> {
+ public:
+  QuicIetfFramerTest()
+      : start_(QuicTime::Zero() + QuicTime::Delta::FromMicroseconds(0x10)),
+        framer_(AllSupportedVersions(),
+                start_,
+                Perspective::IS_SERVER,
+                kQuicDefaultConnectionIdLength) {
+    framer_.set_visitor(&visitor_);
+  }
+
+  // Utility functions to do actual framing/deframing.
+  void TryStreamFrame(char* packet_buffer,
+                      size_t packet_buffer_size,
+                      const char* xmit_packet_data,
+                      size_t xmit_packet_data_size,
+                      QuicIetfStreamId stream_id,
+                      QuicIetfStreamOffset offset,
+                      bool fin_bit,
+                      bool last_frame_bit,
+                      QuicIetfFrameType frame_type) {
+    // initialize a writer so that the serialized packet is placed in
+    // packet_buffer.
+    QuicDataWriter writer(packet_buffer_size, packet_buffer,
+                          quiche::NETWORK_BYTE_ORDER);  // do not really care
+                                                        // about endianness.
+    // set up to define the source frame we wish to send.
+    QuicStreamFrame source_stream_frame(
+        stream_id, fin_bit, offset, xmit_packet_data, xmit_packet_data_size);
+
+    // Write the frame to the packet buffer.
+    EXPECT_TRUE(QuicFramerPeer::AppendIetfStreamFrame(
+        &framer_, source_stream_frame, last_frame_bit, &writer));
+    // Better have something in the packet buffer.
+    EXPECT_NE(0u, writer.length());
+    // Now set up a reader to read in the frame.
+    QuicDataReader reader(packet_buffer, writer.length(),
+                          quiche::NETWORK_BYTE_ORDER);
+
+    // A StreamFrame to hold the results... we know the frame type,
+    // put it into the QuicIetfStreamFrame
+    QuicStreamFrame sink_stream_frame;
+    if (xmit_packet_data_size) {
+      EXPECT_EQ(sink_stream_frame.data_buffer, nullptr);
+      EXPECT_EQ(sink_stream_frame.data_length, 0u);
+    }
+
+    EXPECT_TRUE(QuicFramerPeer::ProcessIetfStreamFrame(
+        &framer_, &reader, frame_type, &sink_stream_frame));
+
+    // Now check that the streamid, fin-bit, offset, and
+    // data len all match the input.
+    EXPECT_EQ(sink_stream_frame.stream_id, source_stream_frame.stream_id);
+    EXPECT_EQ(sink_stream_frame.fin, source_stream_frame.fin);
+    EXPECT_EQ(sink_stream_frame.data_length, source_stream_frame.data_length);
+    if (frame_type & IETF_STREAM_FRAME_OFF_BIT) {
+      // There was an offset in the frame, see if xmit and rcv vales equal.
+      EXPECT_EQ(sink_stream_frame.offset, source_stream_frame.offset);
+    } else {
+      // Offset not in frame, so it better come out 0.
+      EXPECT_EQ(sink_stream_frame.offset, 0u);
+    }
+    if (xmit_packet_data_size) {
+      ASSERT_NE(sink_stream_frame.data_buffer, nullptr);
+      ASSERT_NE(source_stream_frame.data_buffer, nullptr);
+      EXPECT_EQ(strcmp(sink_stream_frame.data_buffer,
+                       source_stream_frame.data_buffer),
+                0);
+    } else {
+      // No data in the frame.
+      EXPECT_EQ(source_stream_frame.data_length, 0u);
+      EXPECT_EQ(sink_stream_frame.data_length, 0u);
+    }
+  }
+
+  // Overall ack frame encode/decode/compare function
+  //  Encodes an ack frame as specified at |*frame|
+  //  Then decodes the frame,
+  //  Then compares the two
+  // Does some basic checking:
+  //   - did the writer write something?
+  //   - did the reader read the entire packet?
+  //   - did the things the reader read match what the writer wrote?
+  // Returns true if it all worked false if not.
+  bool TryAckFrame(char* packet_buffer,
+                   size_t /*packet_buffer_size*/,
+                   struct ack_frame* frame) {
+    QuicAckFrame transmit_frame = InitAckFrame(frame->ranges);
+    if (frame->is_ack_ecn) {
+      transmit_frame.ecn_counters_populated = true;
+      transmit_frame.ect_0_count = frame->ect_0_count;
+      transmit_frame.ect_1_count = frame->ect_1_count;
+      transmit_frame.ecn_ce_count = frame->ecn_ce_count;
+    }
+    transmit_frame.ack_delay_time =
+        QuicTime::Delta::FromMicroseconds(frame->delay_time);
+    size_t expected_size =
+        QuicFramerPeer::GetIetfAckFrameSize(&framer_, transmit_frame);
+
+    // Make a writer so that the serialized packet is placed in
+    // packet_buffer.
+    QuicDataWriter writer(expected_size, packet_buffer,
+                          quiche::NETWORK_BYTE_ORDER);
+
+    // Write the frame to the packet buffer.
+    EXPECT_TRUE(QuicFramerPeer::AppendIetfAckFrameAndTypeByte(
+        &framer_, transmit_frame, &writer));
+
+    size_t expected_frame_length = QuicFramerPeer::ComputeFrameLength(
+        &framer_, QuicFrame(&transmit_frame), false,
+        static_cast<QuicPacketNumberLength>(123456u));
+
+    // Encoded length should match what ComputeFrameLength returns
+    EXPECT_EQ(expected_frame_length, writer.length());
+    // and what is in the buffer should be the expected size.
+    EXPECT_EQ(expected_size, writer.length()) << "Frame is " << transmit_frame;
+    // Now set up a reader to read in the frame.
+    QuicDataReader reader(packet_buffer, writer.length(),
+                          quiche::NETWORK_BYTE_ORDER);
+
+    // read in the frame type
+    uint8_t received_frame_type;
+    EXPECT_TRUE(reader.ReadUInt8(&received_frame_type));
+    EXPECT_EQ(frame->expected_frame_type, received_frame_type);
+
+    // an AckFrame to hold the results
+    QuicAckFrame receive_frame;
+
+    EXPECT_TRUE(QuicFramerPeer::ProcessIetfAckFrame(
+        &framer_, &reader, received_frame_type, &receive_frame));
+
+    if (frame->is_ack_ecn &&
+        (frame->ect_0_count || frame->ect_1_count || frame->ecn_ce_count)) {
+      EXPECT_TRUE(receive_frame.ecn_counters_populated);
+      EXPECT_EQ(receive_frame.ect_0_count, frame->ect_0_count);
+      EXPECT_EQ(receive_frame.ect_1_count, frame->ect_1_count);
+      EXPECT_EQ(receive_frame.ecn_ce_count, frame->ecn_ce_count);
+    } else {
+      EXPECT_FALSE(receive_frame.ecn_counters_populated);
+      EXPECT_EQ(receive_frame.ect_0_count, 0u);
+      EXPECT_EQ(receive_frame.ect_1_count, 0u);
+      EXPECT_EQ(receive_frame.ecn_ce_count, 0u);
+    }
+
+    // Now check that the received frame matches the sent frame.
+    EXPECT_EQ(transmit_frame.largest_acked, receive_frame.largest_acked);
+    // The ~0x7 needs some explaining.  The ack frame format down shifts the
+    // delay time by 3 (divide by 8) to allow for greater ranges in delay time.
+    // Therefore, if we give the framer a delay time that is not an
+    // even multiple of 8, the value that the deframer produces will
+    // not be the same as what the framer got. The downshift on
+    // framing and upshift on deframing results in clearing the 3
+    // low-order bits ... The masking basically does the same thing,
+    // so the compare works properly.
+    return true;
+  }
+
+  // encode, decode, and check a Path Challenge frame.
+  bool TryPathChallengeFrame(char* packet_buffer,
+                             size_t packet_buffer_size,
+                             const QuicPathFrameBuffer& data) {
+    // Make a writer so that the serialized packet is placed in
+    // packet_buffer.
+    QuicDataWriter writer(packet_buffer_size, packet_buffer,
+                          quiche::NETWORK_BYTE_ORDER);
+
+    QuicPathChallengeFrame transmit_frame(0, data);
+
+    // write the frame to the packet buffer.
+    EXPECT_TRUE(QuicFramerPeer::AppendPathChallengeFrame(
+        &framer_, transmit_frame, &writer));
+
+    // Check for correct length in the packet buffer.
+    EXPECT_EQ(kQuicPathChallengeFrameSize, writer.length());
+
+    // now set up a reader to read in the frame.
+    QuicDataReader reader(packet_buffer, writer.length(),
+                          quiche::NETWORK_BYTE_ORDER);
+
+    QuicPathChallengeFrame receive_frame;
+
+    EXPECT_TRUE(QuicFramerPeer::ProcessPathChallengeFrame(&framer_, &reader,
+                                                          &receive_frame));
+
+    // Now check that the received frame matches the sent frame.
+    EXPECT_EQ(
+        0, memcmp(transmit_frame.data_buffer.data(),
+                  receive_frame.data_buffer.data(), kQuicPathFrameBufferSize));
+    return true;
+  }
+
+  // encode, decode, and check a Path Response frame.
+  bool TryPathResponseFrame(char* packet_buffer,
+                            size_t packet_buffer_size,
+                            const QuicPathFrameBuffer& data) {
+    // Make a writer so that the serialized packet is placed in
+    // packet_buffer.
+    QuicDataWriter writer(packet_buffer_size, packet_buffer,
+                          quiche::NETWORK_BYTE_ORDER);
+
+    QuicPathResponseFrame transmit_frame(0, data);
+
+    // Write the frame to the packet buffer.
+    EXPECT_TRUE(QuicFramerPeer::AppendPathResponseFrame(
+        &framer_, transmit_frame, &writer));
+
+    // Check for correct length in the packet buffer.
+    EXPECT_EQ(kQuicPathResponseFrameSize, writer.length());
+
+    // Set up a reader to read in the frame.
+    QuicDataReader reader(packet_buffer, writer.length(),
+                          quiche::NETWORK_BYTE_ORDER);
+
+    QuicPathResponseFrame receive_frame;
+
+    EXPECT_TRUE(QuicFramerPeer::ProcessPathResponseFrame(&framer_, &reader,
+                                                         &receive_frame));
+
+    // Now check that the received frame matches the sent frame.
+    EXPECT_EQ(
+        0, memcmp(transmit_frame.data_buffer.data(),
+                  receive_frame.data_buffer.data(), kQuicPathFrameBufferSize));
+    return true;
+  }
+
+  // Test the Serialization/deserialization of a Reset Stream Frame.
+  void TryResetFrame(char* packet_buffer,
+                     size_t packet_buffer_size,
+                     QuicStreamId stream_id,
+                     uint16_t error_code,
+                     QuicStreamOffset final_offset) {
+    // Initialize a writer so that the serialized packet is placed in
+    // packet_buffer.
+    QuicDataWriter writer(packet_buffer_size, packet_buffer,
+                          quiche::NETWORK_BYTE_ORDER);
+
+    QuicRstStreamFrame transmit_frame(static_cast<QuicControlFrameId>(1),
+                                      stream_id, error_code, final_offset);
+
+    // Write the frame to the packet buffer.
+    EXPECT_TRUE(QuicFramerPeer::AppendIetfResetStreamFrame(
+        &framer_, transmit_frame, &writer));
+    // Check that the size of the serialzed frame is in the allowed range (3 to
+    // 24 bytes, inclusive).
+    EXPECT_LT(2u, writer.length());
+    EXPECT_GT(25u, writer.length());
+    // Now set up a reader to read in the thing in.
+    QuicDataReader reader(packet_buffer, writer.length(),
+                          quiche::NETWORK_BYTE_ORDER);
+
+    // A QuicRstStreamFrame to hold the results
+    QuicRstStreamFrame receive_frame;
+    EXPECT_TRUE(QuicFramerPeer::ProcessIetfResetStreamFrame(&framer_, &reader,
+                                                            &receive_frame));
+
+    // Now check that the received values match the input.
+    EXPECT_EQ(receive_frame.stream_id, transmit_frame.stream_id);
+    EXPECT_EQ(receive_frame.ietf_error_code, transmit_frame.ietf_error_code);
+    EXPECT_EQ(receive_frame.byte_offset, transmit_frame.byte_offset);
+  }
+
+  void TryMaxStreamsFrame(QuicStreamCount stream_count,
+                          bool unidirectional,
+                          bool stream_id_server_initiated) {
+    char packet_buffer[kNormalPacketBufferSize];
+    memset(packet_buffer, 0, sizeof(packet_buffer));
+
+    Perspective old_perspective = framer_.perspective();
+    // Set up the writer and transmit QuicMaxStreamsFrame
+    QuicDataWriter writer(sizeof(packet_buffer), packet_buffer,
+                          quiche::NETWORK_BYTE_ORDER);
+
+    // Set the perspective of the sender. If the stream id is supposed to
+    // be server-initiated, then the sender of the MAX_STREAMS should be
+    // a client, and vice versa. Do this prior to constructing the frame or
+    // generating the packet, so that any internal dependencies are satisfied.
+    QuicFramerPeer::SetPerspective(&framer_, (stream_id_server_initiated)
+                                                 ? Perspective::IS_CLIENT
+                                                 : Perspective::IS_SERVER);
+    QuicMaxStreamsFrame transmit_frame(0, stream_count, unidirectional);
+
+    // Add the frame.
+    EXPECT_TRUE(QuicFramerPeer::AppendMaxStreamsFrame(&framer_, transmit_frame,
+                                                      &writer));
+
+    // Check that buffer length is in the expected range
+    EXPECT_LE(1u, writer.length());
+    EXPECT_GE(8u, writer.length());
+
+    // Set the perspective for the receiver.
+    QuicFramerPeer::SetPerspective(&framer_, (stream_id_server_initiated)
+                                                 ? Perspective::IS_SERVER
+                                                 : Perspective::IS_CLIENT);
+
+    // Set up reader and empty receive QuicPaddingFrame.
+    QuicDataReader reader(packet_buffer, writer.length(),
+                          quiche::NETWORK_BYTE_ORDER);
+    QuicMaxStreamsFrame receive_frame;
+
+    // Deframe it
+    EXPECT_TRUE(QuicFramerPeer::ProcessMaxStreamsFrame(
+        &framer_, &reader, &receive_frame,
+        (unidirectional) ? IETF_MAX_STREAMS_UNIDIRECTIONAL
+                         : IETF_MAX_STREAMS_BIDIRECTIONAL))
+        << " Error: " << framer_.detailed_error();
+
+    // Now check that received and sent data are equivalent
+    EXPECT_EQ(stream_count, receive_frame.stream_count);
+    EXPECT_EQ(transmit_frame.stream_count, receive_frame.stream_count);
+    QuicFramerPeer::SetPerspective(&framer_, old_perspective);
+  }
+
+  void TryStreamsBlockedFrame(QuicStreamCount stream_count,
+                              bool unidirectional,
+                              bool stream_id_server_initiated) {
+    char packet_buffer[kNormalPacketBufferSize];
+    memset(packet_buffer, 0, sizeof(packet_buffer));
+
+    Perspective old_perspective = framer_.perspective();
+    // Set up the writer and transmit QuicStreamsBlockedFrame
+    QuicDataWriter writer(sizeof(packet_buffer), packet_buffer,
+                          quiche::NETWORK_BYTE_ORDER);
+
+    // Set the perspective of the sender. If the stream id is supposed to
+    // be server-initiated, then the sender of the STREAMS_BLOCKED should be
+    // a client, and vice versa. Do this prior to constructing the frame or
+    // generating the packet, so that any internal dependencies are satisfied.
+    QuicFramerPeer::SetPerspective(&framer_, (stream_id_server_initiated)
+                                                 ? Perspective::IS_SERVER
+                                                 : Perspective::IS_CLIENT);
+    QuicStreamsBlockedFrame transmit_frame(0, stream_count, unidirectional);
+
+    // Add the frame.
+    EXPECT_TRUE(QuicFramerPeer::AppendStreamsBlockedFrame(
+        &framer_, transmit_frame, &writer));
+
+    // Check that buffer length is in the expected range
+    EXPECT_LE(1u, writer.length());
+    EXPECT_GE(8u, writer.length());
+
+    // Set the perspective for the receiver.
+    QuicFramerPeer::SetPerspective(&framer_, (stream_id_server_initiated)
+                                                 ? Perspective::IS_CLIENT
+                                                 : Perspective::IS_SERVER);
+
+    // Set up reader and empty receive QuicPaddingFrame.
+    QuicDataReader reader(packet_buffer, writer.length(),
+                          quiche::NETWORK_BYTE_ORDER);
+    QuicStreamsBlockedFrame receive_frame;
+
+    // Deframe it
+    EXPECT_TRUE(QuicFramerPeer::ProcessStreamsBlockedFrame(
+        &framer_, &reader, &receive_frame,
+        (unidirectional) ? IETF_STREAMS_BLOCKED_UNIDIRECTIONAL
+                         : IETF_STREAMS_BLOCKED_BIDIRECTIONAL));
+
+    // Now check that received and sent data are equivalent
+    EXPECT_EQ(stream_count, receive_frame.stream_count);
+    EXPECT_EQ(transmit_frame.stream_count, receive_frame.stream_count);
+    QuicFramerPeer::SetPerspective(&framer_, old_perspective);
+  }
+
+  QuicTime start_;
+  QuicFramer framer_;
+  test::TestQuicVisitor visitor_;
+};
+
+struct stream_frame_variant {
+  QuicIetfStreamId stream_id;
+  QuicIetfStreamOffset offset;
+  bool fin_bit;
+  bool last_frame_bit;
+  uint8_t frame_type;
+} stream_frame_to_test[] = {
+#define IETF_STREAM0 (((uint8_t)IETF_STREAM))
+
+#define IETF_STREAM1 (((uint8_t)IETF_STREAM) | IETF_STREAM_FRAME_FIN_BIT)
+
+#define IETF_STREAM2 (((uint8_t)IETF_STREAM) | IETF_STREAM_FRAME_LEN_BIT)
+
+#define IETF_STREAM3                                    \
+  (((uint8_t)IETF_STREAM) | IETF_STREAM_FRAME_LEN_BIT | \
+   IETF_STREAM_FRAME_FIN_BIT)
+
+#define IETF_STREAM4 (((uint8_t)IETF_STREAM) | IETF_STREAM_FRAME_OFF_BIT)
+
+#define IETF_STREAM5                                    \
+  (((uint8_t)IETF_STREAM) | IETF_STREAM_FRAME_OFF_BIT | \
+   IETF_STREAM_FRAME_FIN_BIT)
+
+#define IETF_STREAM6                                    \
+  (((uint8_t)IETF_STREAM) | IETF_STREAM_FRAME_OFF_BIT | \
+   IETF_STREAM_FRAME_LEN_BIT)
+
+#define IETF_STREAM7                                    \
+  (((uint8_t)IETF_STREAM) | IETF_STREAM_FRAME_OFF_BIT | \
+   IETF_STREAM_FRAME_LEN_BIT | IETF_STREAM_FRAME_FIN_BIT)
+
+    {kStreamId8, kOffset8, true, false, IETF_STREAM7},
+    {kStreamId8, kOffset8, false, false, IETF_STREAM6},
+    {kStreamId8, kOffset4, true, false, IETF_STREAM7},
+    {kStreamId8, kOffset4, false, false, IETF_STREAM6},
+    {kStreamId8, kOffset2, true, false, IETF_STREAM7},
+    {kStreamId8, kOffset2, false, false, IETF_STREAM6},
+    {kStreamId8, kOffset1, true, false, IETF_STREAM7},
+    {kStreamId8, kOffset1, false, false, IETF_STREAM6},
+    {kStreamId8, kOffset0, true, false, IETF_STREAM3},
+    {kStreamId8, kOffset0, false, false, IETF_STREAM2},
+    {kStreamId4, kOffset8, true, false, IETF_STREAM7},
+    {kStreamId4, kOffset8, false, false, IETF_STREAM6},
+    {kStreamId4, kOffset4, true, false, IETF_STREAM7},
+    {kStreamId4, kOffset4, false, false, IETF_STREAM6},
+    {kStreamId4, kOffset2, true, false, IETF_STREAM7},
+    {kStreamId4, kOffset2, false, false, IETF_STREAM6},
+    {kStreamId4, kOffset1, true, false, IETF_STREAM7},
+    {kStreamId4, kOffset1, false, false, IETF_STREAM6},
+    {kStreamId4, kOffset0, true, false, IETF_STREAM3},
+    {kStreamId4, kOffset0, false, false, IETF_STREAM2},
+    {kStreamId2, kOffset8, true, false, IETF_STREAM7},
+    {kStreamId2, kOffset8, false, false, IETF_STREAM6},
+    {kStreamId2, kOffset4, true, false, IETF_STREAM7},
+    {kStreamId2, kOffset4, false, false, IETF_STREAM6},
+    {kStreamId2, kOffset2, true, false, IETF_STREAM7},
+    {kStreamId2, kOffset2, false, false, IETF_STREAM6},
+    {kStreamId2, kOffset1, true, false, IETF_STREAM7},
+    {kStreamId2, kOffset1, false, false, IETF_STREAM6},
+    {kStreamId2, kOffset0, true, false, IETF_STREAM3},
+    {kStreamId2, kOffset0, false, false, IETF_STREAM2},
+    {kStreamId1, kOffset8, true, false, IETF_STREAM7},
+    {kStreamId1, kOffset8, false, false, IETF_STREAM6},
+    {kStreamId1, kOffset4, true, false, IETF_STREAM7},
+    {kStreamId1, kOffset4, false, false, IETF_STREAM6},
+    {kStreamId1, kOffset2, true, false, IETF_STREAM7},
+    {kStreamId1, kOffset2, false, false, IETF_STREAM6},
+    {kStreamId1, kOffset1, true, false, IETF_STREAM7},
+    {kStreamId1, kOffset1, false, false, IETF_STREAM6},
+    {kStreamId1, kOffset0, true, false, IETF_STREAM3},
+    {kStreamId1, kOffset0, false, false, IETF_STREAM2},
+    {kStreamId0, kOffset8, true, false, IETF_STREAM7},
+    {kStreamId0, kOffset8, false, false, IETF_STREAM6},
+    {kStreamId0, kOffset4, true, false, IETF_STREAM7},
+    {kStreamId0, kOffset4, false, false, IETF_STREAM6},
+    {kStreamId0, kOffset2, true, false, IETF_STREAM7},
+    {kStreamId0, kOffset2, false, false, IETF_STREAM6},
+    {kStreamId0, kOffset1, true, false, IETF_STREAM7},
+    {kStreamId0, kOffset1, false, false, IETF_STREAM6},
+    {kStreamId0, kOffset0, true, false, IETF_STREAM3},
+    {kStreamId0, kOffset0, false, false, IETF_STREAM2},
+
+    {kStreamId8, kOffset8, true, true, IETF_STREAM5},
+    {kStreamId8, kOffset8, false, true, IETF_STREAM4},
+    {kStreamId8, kOffset4, true, true, IETF_STREAM5},
+    {kStreamId8, kOffset4, false, true, IETF_STREAM4},
+    {kStreamId8, kOffset2, true, true, IETF_STREAM5},
+    {kStreamId8, kOffset2, false, true, IETF_STREAM4},
+    {kStreamId8, kOffset1, true, true, IETF_STREAM5},
+    {kStreamId8, kOffset1, false, true, IETF_STREAM4},
+    {kStreamId8, kOffset0, true, true, IETF_STREAM1},
+    {kStreamId8, kOffset0, false, true, IETF_STREAM0},
+    {kStreamId4, kOffset8, true, true, IETF_STREAM5},
+    {kStreamId4, kOffset8, false, true, IETF_STREAM4},
+    {kStreamId4, kOffset4, true, true, IETF_STREAM5},
+    {kStreamId4, kOffset4, false, true, IETF_STREAM4},
+    {kStreamId4, kOffset2, true, true, IETF_STREAM5},
+    {kStreamId4, kOffset2, false, true, IETF_STREAM4},
+    {kStreamId4, kOffset1, true, true, IETF_STREAM5},
+    {kStreamId4, kOffset1, false, true, IETF_STREAM4},
+    {kStreamId4, kOffset0, true, true, IETF_STREAM1},
+    {kStreamId4, kOffset0, false, true, IETF_STREAM0},
+    {kStreamId2, kOffset8, true, true, IETF_STREAM5},
+    {kStreamId2, kOffset8, false, true, IETF_STREAM4},
+    {kStreamId2, kOffset4, true, true, IETF_STREAM5},
+    {kStreamId2, kOffset4, false, true, IETF_STREAM4},
+    {kStreamId2, kOffset2, true, true, IETF_STREAM5},
+    {kStreamId2, kOffset2, false, true, IETF_STREAM4},
+    {kStreamId2, kOffset1, true, true, IETF_STREAM5},
+    {kStreamId2, kOffset1, false, true, IETF_STREAM4},
+    {kStreamId2, kOffset0, true, true, IETF_STREAM1},
+    {kStreamId2, kOffset0, false, true, IETF_STREAM0},
+    {kStreamId1, kOffset8, true, true, IETF_STREAM5},
+    {kStreamId1, kOffset8, false, true, IETF_STREAM4},
+    {kStreamId1, kOffset4, true, true, IETF_STREAM5},
+    {kStreamId1, kOffset4, false, true, IETF_STREAM4},
+    {kStreamId1, kOffset2, true, true, IETF_STREAM5},
+    {kStreamId1, kOffset2, false, true, IETF_STREAM4},
+    {kStreamId1, kOffset1, true, true, IETF_STREAM5},
+    {kStreamId1, kOffset1, false, true, IETF_STREAM4},
+    {kStreamId1, kOffset0, true, true, IETF_STREAM1},
+    {kStreamId1, kOffset0, false, true, IETF_STREAM0},
+    {kStreamId0, kOffset8, true, true, IETF_STREAM5},
+    {kStreamId0, kOffset8, false, true, IETF_STREAM4},
+    {kStreamId0, kOffset4, true, true, IETF_STREAM5},
+    {kStreamId0, kOffset4, false, true, IETF_STREAM4},
+    {kStreamId0, kOffset2, true, true, IETF_STREAM5},
+    {kStreamId0, kOffset2, false, true, IETF_STREAM4},
+    {kStreamId0, kOffset1, true, true, IETF_STREAM5},
+    {kStreamId0, kOffset1, false, true, IETF_STREAM4},
+    {kStreamId0, kOffset0, true, true, IETF_STREAM1},
+    {kStreamId0, kOffset0, false, true, IETF_STREAM0},
+};
+
+TEST_F(QuicIetfFramerTest, StreamFrame) {
+  char packet_buffer[kNormalPacketBufferSize];
+  const char* transmit_packet_data =
+      "this is a test of some packet data, "
+      "can do a simple strcmp to see if the "
+      "input and output are the same!";
+
+  size_t transmit_packet_data_len = strlen(transmit_packet_data) + 1;
+  for (size_t i = 0; i < QUIC_ARRAYSIZE(stream_frame_to_test); ++i) {
+    SCOPED_TRACE(i);
+    struct stream_frame_variant* variant = &stream_frame_to_test[i];
+    TryStreamFrame(packet_buffer, sizeof(packet_buffer), transmit_packet_data,
+                   transmit_packet_data_len, variant->stream_id,
+                   variant->offset, variant->fin_bit, variant->last_frame_bit,
+                   static_cast<QuicIetfFrameType>(variant->frame_type));
+  }
+}
+// As the previous test, but with no data.
+TEST_F(QuicIetfFramerTest, ZeroLengthStreamFrame) {
+  char packet_buffer[kNormalPacketBufferSize];
+
+  for (size_t i = 0; i < QUIC_ARRAYSIZE(stream_frame_to_test); ++i) {
+    SCOPED_TRACE(i);
+    struct stream_frame_variant* variant = &stream_frame_to_test[i];
+    TryStreamFrame(packet_buffer, sizeof(packet_buffer),
+                   /* xmit_packet_data = */ NULL,
+                   /* xmit_packet_data_size = */ 0, variant->stream_id,
+                   variant->offset, variant->fin_bit, variant->last_frame_bit,
+                   static_cast<QuicIetfFrameType>(variant->frame_type));
+  }
+}
+
+TEST_F(QuicIetfFramerTest, CryptoFrame) {
+  SimpleDataProducer data_producer;
+  framer_.set_data_producer(&data_producer);
+  char packet_buffer[kNormalPacketBufferSize];
+
+  quiche::QuicheStringPiece frame_data("This is a CRYPTO frame.");
+
+  QuicStreamOffset offsets[] = {kOffset8, kOffset4, kOffset2, kOffset1,
+                                kOffset0};
+  for (QuicStreamOffset offset : offsets) {
+    QuicCryptoFrame frame(ENCRYPTION_INITIAL, offset, frame_data.length());
+    data_producer.SaveCryptoData(ENCRYPTION_INITIAL, offset, frame_data);
+
+    QuicDataWriter writer(QUIC_ARRAYSIZE(packet_buffer), packet_buffer,
+                          quiche::NETWORK_BYTE_ORDER);
+
+    // Write the frame.
+    EXPECT_TRUE(QuicFramerPeer::AppendCryptoFrame(&framer_, frame, &writer));
+    EXPECT_NE(0u, writer.length());
+    // Read it back.
+    QuicDataReader reader(packet_buffer, writer.length(),
+                          quiche::NETWORK_BYTE_ORDER);
+    QuicCryptoFrame read_frame;
+    EXPECT_TRUE(
+        QuicFramerPeer::ProcessCryptoFrame(&framer_, &reader, &read_frame));
+
+    // Check that the frames match:
+    quiche::QuicheStringPiece read_data(read_frame.data_buffer,
+                                        read_frame.data_length);
+    EXPECT_EQ(read_frame.data_length, frame.data_length);
+    EXPECT_EQ(read_frame.offset, frame.offset);
+    EXPECT_EQ(read_data, frame_data);
+  }
+}
+
+TEST_F(QuicIetfFramerTest, ConnectionClose) {
+  char packet_buffer[kNormalPacketBufferSize];
+
+  // initialize a writer so that the serialized packet is placed in
+  // packet_buffer.
+  QuicDataWriter writer(sizeof(packet_buffer), packet_buffer,
+                        quiche::NETWORK_BYTE_ORDER);
+
+  std::string test_string = "Ich Bin Ein Jelly Donut?";
+  QuicConnectionCloseFrame sent_frame(QUIC_VERSION_99, QUIC_NO_ERROR,
+                                      test_string,
+                                      /*transport_close_frame_type=*/123);
+
+  // write the frame to the packet buffer.
+  EXPECT_TRUE(QuicFramerPeer::AppendIetfConnectionCloseFrame(
+      &framer_, sent_frame, &writer));
+
+  // better have something in the packet buffer.
+  EXPECT_NE(0u, writer.length());
+
+  // now set up a reader to read in the frame.
+  QuicDataReader reader(packet_buffer, writer.length(),
+                        quiche::NETWORK_BYTE_ORDER);
+
+  // a QuicConnectionCloseFrame to hold the results.
+  QuicConnectionCloseFrame sink_frame;
+
+  EXPECT_TRUE(QuicFramerPeer::ProcessIetfConnectionCloseFrame(
+      &framer_, &reader, IETF_QUIC_TRANSPORT_CONNECTION_CLOSE, &sink_frame));
+
+  // Now check that received == sent
+  EXPECT_EQ(sent_frame.quic_error_code, sink_frame.quic_error_code);
+  EXPECT_THAT(sink_frame.quic_error_code, IsQuicNoError());
+  EXPECT_EQ(sink_frame.error_details, test_string);
+  EXPECT_EQ(sink_frame.close_type, sent_frame.close_type);
+  EXPECT_EQ(sent_frame.close_type, IETF_QUIC_TRANSPORT_CONNECTION_CLOSE);
+}
+
+TEST_F(QuicIetfFramerTest, ApplicationClose) {
+  char packet_buffer[kNormalPacketBufferSize];
+
+  // initialize a writer so that the serialized packet is placed in
+  // packet_buffer.
+  QuicDataWriter writer(sizeof(packet_buffer), packet_buffer,
+                        quiche::NETWORK_BYTE_ORDER);
+
+  std::string test_string = "Ich Bin Ein Jelly Donut?";
+  QuicConnectionCloseFrame sent_frame(QUIC_VERSION_99, QUIC_LAST_ERROR,
+                                      test_string,
+                                      /*transport_close_frame_type=*/0);
+
+  // write the frame to the packet buffer.
+  EXPECT_TRUE(QuicFramerPeer::AppendIetfConnectionCloseFrame(
+      &framer_, sent_frame, &writer));
+
+  // better have something in the packet buffer.
+  EXPECT_NE(0u, writer.length());
+
+  // now set up a reader to read in the frame.
+  QuicDataReader reader(packet_buffer, writer.length(),
+                        quiche::NETWORK_BYTE_ORDER);
+
+  // a QuicConnectionCloseFrame to hold the results.
+  QuicConnectionCloseFrame sink_frame;
+
+  EXPECT_TRUE(QuicFramerPeer::ProcessIetfConnectionCloseFrame(
+      &framer_, &reader, IETF_QUIC_APPLICATION_CONNECTION_CLOSE, &sink_frame));
+
+  // Now check that received == sent
+  EXPECT_EQ(sink_frame.quic_error_code, QUIC_LAST_ERROR);
+  EXPECT_EQ(sent_frame.quic_error_code, sink_frame.quic_error_code);
+  EXPECT_EQ(sink_frame.error_details, test_string);
+  EXPECT_EQ(sent_frame.close_type, IETF_QUIC_APPLICATION_CONNECTION_CLOSE);
+  EXPECT_EQ(sent_frame.close_type, sink_frame.close_type);
+}
+
+// Testing for the IETF ACK framer.
+// clang-format off
+struct ack_frame ack_frame_variants[] = {
+    {90000,
+     false,
+     0,
+     0,
+     0,
+     {{QuicPacketNumber(1000), QuicPacketNumber(2001)}},
+     IETF_ACK},
+    {0,
+     false,
+     0,
+     0,
+     0,
+     {{QuicPacketNumber(1000), QuicPacketNumber(2001)}},
+     IETF_ACK},
+    {1,
+     false,
+     0,
+     0,
+     0,
+     {{QuicPacketNumber(1), QuicPacketNumber(2)},
+      {QuicPacketNumber(5), QuicPacketNumber(6)}},
+     IETF_ACK},
+    {63,
+     false,
+     0,
+     0,
+     0,
+     {{QuicPacketNumber(1), QuicPacketNumber(2)},
+      {QuicPacketNumber(5), QuicPacketNumber(6)}},
+     IETF_ACK},
+    {64,
+     false,
+     0,
+     0,
+     0,
+     {{QuicPacketNumber(1), QuicPacketNumber(2)},
+      {QuicPacketNumber(3), QuicPacketNumber(4)},
+      {QuicPacketNumber(5), QuicPacketNumber(6)},
+      {QuicPacketNumber(7), QuicPacketNumber(8)},
+      {QuicPacketNumber(9), QuicPacketNumber(10)},
+      {QuicPacketNumber(11), QuicPacketNumber(12)}},
+     IETF_ACK},
+    {10000,
+     false,
+     0,
+     0,
+     0,
+     {{QuicPacketNumber(1), QuicPacketNumber(2)},
+      {QuicPacketNumber(3), QuicPacketNumber(4)},
+      {QuicPacketNumber(5), QuicPacketNumber(6)},
+      {QuicPacketNumber(7), QuicPacketNumber(8)},
+      {QuicPacketNumber(9), QuicPacketNumber(10)},
+      {QuicPacketNumber(11), QuicPacketNumber(12)}},
+     IETF_ACK},
+    {100000000,
+     false,
+     0,
+     0,
+     0,
+     {{QuicPacketNumber(1), QuicPacketNumber(2)},
+      {QuicPacketNumber(3), QuicPacketNumber(4)},
+      {QuicPacketNumber(5), QuicPacketNumber(6)},
+      {QuicPacketNumber(7), QuicPacketNumber(8)},
+      {QuicPacketNumber(9), QuicPacketNumber(10)},
+      {QuicPacketNumber(11), QuicPacketNumber(12)}},
+     IETF_ACK},
+    {0,
+     false,
+     0,
+     0,
+     0,
+     {{QuicPacketNumber(1), QuicPacketNumber(65)}},
+     IETF_ACK},
+    {9223372036854775807,
+     false,
+     0,
+     0,
+     0,
+     {{QuicPacketNumber(1), QuicPacketNumber(11)},
+      {QuicPacketNumber(74), QuicPacketNumber(138)}},
+     IETF_ACK},
+    // This ack is for packets 60 & 125. There are 64 packets in the gap.
+    // The encoded value is gap_size - 1, or 63. Crosses a VarInt62 encoding
+    // boundary...
+    {1,
+     false,
+     0,
+     0,
+     0,
+     {{QuicPacketNumber(60), QuicPacketNumber(61)},
+      {QuicPacketNumber(125), QuicPacketNumber(126)}},
+     IETF_ACK},
+    {2,
+     false,
+     0,
+     0,
+     0,
+     {{QuicPacketNumber(1), QuicPacketNumber(65)},
+      {QuicPacketNumber(129), QuicPacketNumber(130)}},
+     IETF_ACK},
+    {3,
+     false,
+     0,
+     0,
+     0,
+     {{QuicPacketNumber(1), QuicPacketNumber(65)},
+      {QuicPacketNumber(129), QuicPacketNumber(195)}},
+     IETF_ACK},
+    {4,
+     false,
+     0,
+     0,
+     0,
+     {{QuicPacketNumber(1), QuicPacketNumber(65)},
+      {QuicPacketNumber(129), QuicPacketNumber(194)}},
+     IETF_ACK},
+    {5,
+     false,
+     0,
+     0,
+     0,
+     {{QuicPacketNumber(1), QuicPacketNumber(65)},
+      {QuicPacketNumber(129), QuicPacketNumber(193)}},
+     IETF_ACK},
+    {6,
+     false,
+     0,
+     0,
+     0,
+     {{QuicPacketNumber(1), QuicPacketNumber(65)},
+      {QuicPacketNumber(129), QuicPacketNumber(192)}},
+     IETF_ACK},
+    // declare some ack_ecn frames to try.
+    {6,
+     false,
+     100,
+     200,
+     300,
+     {{QuicPacketNumber(1), QuicPacketNumber(65)},
+      {QuicPacketNumber(129), QuicPacketNumber(192)}},
+     IETF_ACK},
+    {6,
+     true,
+     100,
+     200,
+     300,
+     {{QuicPacketNumber(1), QuicPacketNumber(65)},
+      {QuicPacketNumber(129), QuicPacketNumber(192)}},
+     IETF_ACK_ECN},
+    {6,
+     true,
+     100,
+     0,
+     0,
+     {{QuicPacketNumber(1), QuicPacketNumber(65)},
+      {QuicPacketNumber(129), QuicPacketNumber(192)}},
+     IETF_ACK_ECN},
+    {6,
+     true,
+     0,
+     200,
+     0,
+     {{QuicPacketNumber(1), QuicPacketNumber(65)},
+      {QuicPacketNumber(129), QuicPacketNumber(192)}},
+     IETF_ACK_ECN},
+    {6,
+     true,
+     0,
+     0,
+     300,
+     {{QuicPacketNumber(1), QuicPacketNumber(65)},
+      {QuicPacketNumber(129), QuicPacketNumber(192)}},
+     IETF_ACK_ECN},
+    {6,
+     true,
+     0,
+     0,
+     0,
+     {{QuicPacketNumber(1), QuicPacketNumber(65)},
+      {QuicPacketNumber(129), QuicPacketNumber(192)}},
+     IETF_ACK},
+};
+// clang-format on
+
+TEST_F(QuicIetfFramerTest, AckFrame) {
+  char packet_buffer[kNormalPacketBufferSize];
+  for (auto ack_frame_variant : ack_frame_variants) {
+    EXPECT_TRUE(
+        TryAckFrame(packet_buffer, sizeof(packet_buffer), &ack_frame_variant));
+  }
+}
+
+// Test the case of having a QuicAckFrame with no ranges in it.  By
+// examination of the Google Quic Ack code and tests, this case should
+// be handled as an ack with no "ranges after the first"; the
+// AckBlockCount should be 0 and the FirstAckBlock should be
+// |LargestAcked| - 1 (number of packets preceding the LargestAcked.
+TEST_F(QuicIetfFramerTest, AckFrameNoRanges) {
+  char packet_buffer[kNormalPacketBufferSize];
+
+  // Make a writer so that the serialized packet is placed in
+  // packet_buffer.
+  QuicDataWriter writer(sizeof(packet_buffer), packet_buffer,
+                        quiche::NETWORK_BYTE_ORDER);
+
+  QuicAckFrame transmit_frame;
+  transmit_frame.largest_acked = QuicPacketNumber(1);
+  transmit_frame.ack_delay_time = QuicTime::Delta::FromMicroseconds(0);
+
+  size_t expected_size =
+      QuicFramerPeer::GetIetfAckFrameSize(&framer_, transmit_frame);
+  // Write the frame to the packet buffer.
+  EXPECT_TRUE(QuicFramerPeer::AppendIetfAckFrameAndTypeByte(
+      &framer_, transmit_frame, &writer));
+
+  uint8_t packet[] = {
+      0x02,  // type, IETF_ACK
+      0x01,  // largest_acked,
+      0x00,  // delay
+      0x00,  // count of additional ack blocks
+      0x00,  // size of first ack block (packets preceding largest_acked)
+  };
+  EXPECT_EQ(expected_size, sizeof(packet));
+  EXPECT_EQ(sizeof(packet), writer.length());
+  EXPECT_EQ(0, memcmp(packet, packet_buffer, writer.length()));
+
+  // Now set up a reader to read in the frame.
+  QuicDataReader reader(packet_buffer, writer.length(),
+                        quiche::NETWORK_BYTE_ORDER);
+
+  // an AckFrame to hold the results
+  QuicAckFrame receive_frame;
+
+  // read in the frame type
+  uint8_t received_frame_type;
+  EXPECT_TRUE(reader.ReadUInt8(&received_frame_type));
+  EXPECT_EQ(received_frame_type, IETF_ACK);
+
+  EXPECT_TRUE(QuicFramerPeer::ProcessIetfAckFrame(&framer_, &reader, IETF_ACK,
+                                                  &receive_frame));
+
+  // Now check that the received frame matches the sent frame.
+  EXPECT_EQ(transmit_frame.largest_acked, receive_frame.largest_acked);
+}
+
+TEST_F(QuicIetfFramerTest, PathChallengeFrame) {
+  // Double-braces needed on some platforms due to
+  // https://bugs.llvm.org/show_bug.cgi?id=21629
+  QuicPathFrameBuffer buffer0 = {{0, 0, 0, 0, 0, 0, 0, 0}};
+  QuicPathFrameBuffer buffer1 = {
+      {0x80, 0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe5, 0xf7}};
+  char packet_buffer[kNormalPacketBufferSize];
+  EXPECT_TRUE(
+      TryPathChallengeFrame(packet_buffer, sizeof(packet_buffer), buffer0));
+  EXPECT_TRUE(
+      TryPathChallengeFrame(packet_buffer, sizeof(packet_buffer), buffer1));
+}
+
+TEST_F(QuicIetfFramerTest, PathResponseFrame) {
+  // Double-braces needed on some platforms due to
+  // https://bugs.llvm.org/show_bug.cgi?id=21629
+  QuicPathFrameBuffer buffer0 = {{0, 0, 0, 0, 0, 0, 0, 0}};
+  QuicPathFrameBuffer buffer1 = {
+      {0x80, 0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe5, 0xf7}};
+  char packet_buffer[kNormalPacketBufferSize];
+  EXPECT_TRUE(
+      TryPathResponseFrame(packet_buffer, sizeof(packet_buffer), buffer0));
+  EXPECT_TRUE(
+      TryPathResponseFrame(packet_buffer, sizeof(packet_buffer), buffer1));
+}
+
+TEST_F(QuicIetfFramerTest, ResetStreamFrame) {
+  char packet_buffer[kNormalPacketBufferSize];
+  struct resets {
+    QuicStreamId stream_id;
+    uint16_t error_code;
+    QuicStreamOffset final_offset;
+  } reset_frames[] = {
+      {0, 55, 0},
+      {0x10, 73, 0x300},
+  };
+  for (auto reset : reset_frames) {
+    TryResetFrame(packet_buffer, sizeof(packet_buffer), reset.stream_id,
+                  reset.error_code, reset.final_offset);
+  }
+}
+
+TEST_F(QuicIetfFramerTest, StopSendingFrame) {
+  char packet_buffer[kNormalPacketBufferSize];
+
+  // Make a writer so that the serialized packet is placed in
+  // packet_buffer.
+  QuicDataWriter writer(sizeof(packet_buffer), packet_buffer,
+                        quiche::NETWORK_BYTE_ORDER);
+
+  QuicStopSendingFrame transmit_frame;
+  transmit_frame.stream_id = 12345;
+  transmit_frame.application_error_code = 543;
+
+  // Write the frame to the packet buffer.
+  EXPECT_TRUE(QuicFramerPeer::AppendStopSendingFrame(&framer_, transmit_frame,
+                                                     &writer));
+  // Check that the number of bytes in the buffer is in the
+  // allowed range.
+  EXPECT_LE(3u, writer.length());
+  EXPECT_GE(10u, writer.length());
+
+  QuicDataReader reader(packet_buffer, writer.length(),
+                        quiche::NETWORK_BYTE_ORDER);
+
+  // A frame to hold the results
+  QuicStopSendingFrame receive_frame;
+
+  EXPECT_TRUE(QuicFramerPeer::ProcessStopSendingFrame(&framer_, &reader,
+                                                      &receive_frame));
+
+  // Verify that the transmitted and received values are the same.
+  EXPECT_EQ(receive_frame.stream_id, 12345u);
+  EXPECT_EQ(receive_frame.application_error_code, 543u);
+  EXPECT_EQ(receive_frame.stream_id, transmit_frame.stream_id);
+  EXPECT_EQ(receive_frame.application_error_code,
+            transmit_frame.application_error_code);
+}
+
+TEST_F(QuicIetfFramerTest, MaxDataFrame) {
+  char packet_buffer[kNormalPacketBufferSize];
+  QuicStreamOffset window_sizes[] = {0,       1,        2,        5,       10,
+                                     20,      50,       100,      200,     500,
+                                     1000000, kOffset8, kOffset4, kOffset2};
+  for (QuicStreamOffset window_size : window_sizes) {
+    memset(packet_buffer, 0, sizeof(packet_buffer));
+
+    // Set up the writer and transmit QuicWindowUpdateFrame
+    QuicDataWriter writer(sizeof(packet_buffer), packet_buffer,
+                          quiche::NETWORK_BYTE_ORDER);
+    QuicWindowUpdateFrame transmit_frame(0, 99, window_size);
+
+    // Add the frame.
+    EXPECT_TRUE(
+        QuicFramerPeer::AppendMaxDataFrame(&framer_, transmit_frame, &writer));
+
+    // Check that the number of bytes in the buffer is in the expected range.
+    EXPECT_LE(1u, writer.length());
+    EXPECT_GE(8u, writer.length());
+
+    // Set up reader and an empty QuicWindowUpdateFrame
+    QuicDataReader reader(packet_buffer, writer.length(),
+                          quiche::NETWORK_BYTE_ORDER);
+    QuicWindowUpdateFrame receive_frame;
+
+    // Deframe it
+    EXPECT_TRUE(
+        QuicFramerPeer::ProcessMaxDataFrame(&framer_, &reader, &receive_frame));
+
+    // Now check that the received data equals the sent data.
+    EXPECT_EQ(transmit_frame.max_data, window_size);
+    EXPECT_EQ(transmit_frame.max_data, receive_frame.max_data);
+    EXPECT_EQ(QuicUtils::GetInvalidStreamId(framer_.transport_version()),
+              receive_frame.stream_id);
+  }
+}
+
+TEST_F(QuicIetfFramerTest, MaxStreamDataFrame) {
+  char packet_buffer[kNormalPacketBufferSize];
+  QuicStreamOffset window_sizes[] = {0,       1,        2,        5,       10,
+                                     20,      50,       100,      200,     500,
+                                     1000000, kOffset8, kOffset4, kOffset2};
+  QuicIetfStreamId stream_ids[] = {kStreamId4, kStreamId2, kStreamId1,
+                                   kStreamId0};
+
+  for (QuicIetfStreamId stream_id : stream_ids) {
+    for (QuicStreamOffset window_size : window_sizes) {
+      memset(packet_buffer, 0, sizeof(packet_buffer));
+
+      // Set up the writer and transmit QuicWindowUpdateFrame
+      QuicDataWriter writer(sizeof(packet_buffer), packet_buffer,
+                            quiche::NETWORK_BYTE_ORDER);
+      QuicWindowUpdateFrame transmit_frame(0, stream_id, window_size);
+
+      // Add the frame.
+      EXPECT_TRUE(QuicFramerPeer::AppendMaxStreamDataFrame(
+          &framer_, transmit_frame, &writer));
+
+      // Check that number of bytes in the buffer is in the expected range.
+      EXPECT_LE(2u, writer.length());
+      EXPECT_GE(16u, writer.length());
+
+      // Set up reader and empty receive QuicPaddingFrame.
+      QuicDataReader reader(packet_buffer, writer.length(),
+                            quiche::NETWORK_BYTE_ORDER);
+      QuicWindowUpdateFrame receive_frame;
+
+      // Deframe it
+      EXPECT_TRUE(QuicFramerPeer::ProcessMaxStreamDataFrame(&framer_, &reader,
+                                                            &receive_frame));
+
+      // Now check that received data and sent data are equal.
+      EXPECT_EQ(transmit_frame.max_data, window_size);
+      EXPECT_EQ(transmit_frame.max_data, receive_frame.max_data);
+      EXPECT_EQ(stream_id, receive_frame.stream_id);
+      EXPECT_EQ(transmit_frame.stream_id, receive_frame.stream_id);
+    }
+  }
+}
+
+TEST_F(QuicIetfFramerTest, MaxStreamsFrame) {
+  QuicStreamCount stream_counts[] = {0x3fffffff, 0x3fff, 0x3f, 0x1};
+
+  for (QuicStreamCount stream_count : stream_counts) {
+    // Cover all four combinations of uni/bi-directional and
+    // server-/client- initiation.
+    TryMaxStreamsFrame(stream_count, /*unidirectional=*/true,
+                       /*stream_id_server_initiated=*/true);
+    TryMaxStreamsFrame(stream_count, /*unidirectional=*/true,
+                       /*stream_id_server_initiated=*/false);
+    TryMaxStreamsFrame(stream_count, /*unidirectional=*/false,
+                       /*stream_id_server_initiated=*/true);
+    TryMaxStreamsFrame(stream_count, /*unidirectional=*/false,
+                       /*stream_id_server_initiated=*/false);
+  }
+}
+
+TEST_F(QuicIetfFramerTest, BlockedFrame) {
+  char packet_buffer[kNormalPacketBufferSize];
+  QuicStreamOffset offsets[] = {kOffset8, kOffset4, kOffset2, kOffset1,
+                                kOffset0};
+
+  for (QuicStreamOffset offset : offsets) {
+    memset(packet_buffer, 0, sizeof(packet_buffer));
+
+    // Set up the writer and transmit QuicBlockedFrame
+    QuicDataWriter writer(sizeof(packet_buffer), packet_buffer,
+                          quiche::NETWORK_BYTE_ORDER);
+    QuicBlockedFrame transmit_frame(
+        0, QuicUtils::GetInvalidStreamId(framer_.transport_version()), offset);
+
+    // Add the frame.
+    EXPECT_TRUE(QuicFramerPeer::AppendIetfBlockedFrame(&framer_, transmit_frame,
+                                                       &writer));
+
+    // Check that buffer length is in the expected range
+    EXPECT_LE(1u, writer.length());
+    EXPECT_GE(8u, writer.length());
+
+    // Set up reader and empty receive QuicFrame.
+    QuicDataReader reader(packet_buffer, writer.length(),
+                          quiche::NETWORK_BYTE_ORDER);
+    QuicBlockedFrame receive_frame;
+
+    // Deframe it
+    EXPECT_TRUE(QuicFramerPeer::ProcessIetfBlockedFrame(&framer_, &reader,
+                                                        &receive_frame));
+
+    // Check that received and sent data are equivalent
+    EXPECT_EQ(QuicUtils::GetInvalidStreamId(framer_.transport_version()),
+              receive_frame.stream_id);
+    EXPECT_EQ(offset, receive_frame.offset);
+    EXPECT_EQ(transmit_frame.offset, receive_frame.offset);
+  }
+}
+
+TEST_F(QuicIetfFramerTest, StreamBlockedFrame) {
+  char packet_buffer[kNormalPacketBufferSize];
+  QuicStreamOffset offsets[] = {0,       1,        2,        5,       10,
+                                20,      50,       100,      200,     500,
+                                1000000, kOffset8, kOffset4, kOffset2};
+  QuicIetfStreamId stream_ids[] = {kStreamId4, kStreamId2, kStreamId1,
+                                   kStreamId0};
+
+  for (QuicIetfStreamId stream_id : stream_ids) {
+    for (QuicStreamOffset offset : offsets) {
+      memset(packet_buffer, 0, sizeof(packet_buffer));
+
+      // Set up the writer and transmit QuicWindowUpdateFrame
+      QuicDataWriter writer(sizeof(packet_buffer), packet_buffer,
+                            quiche::NETWORK_BYTE_ORDER);
+      QuicBlockedFrame transmit_frame(0, stream_id, offset);
+
+      // Add the frame.
+      EXPECT_TRUE(QuicFramerPeer::AppendStreamBlockedFrame(
+          &framer_, transmit_frame, &writer));
+
+      // Check that number of bytes in the buffer is in the expected range.
+      EXPECT_LE(2u, writer.length());
+      EXPECT_GE(16u, writer.length());
+
+      // Set up reader and empty receive QuicPaddingFrame.
+      QuicDataReader reader(packet_buffer, writer.length(),
+                            quiche::NETWORK_BYTE_ORDER);
+      QuicBlockedFrame receive_frame;
+
+      // Deframe it
+      EXPECT_TRUE(QuicFramerPeer::ProcessStreamBlockedFrame(&framer_, &reader,
+                                                            &receive_frame));
+
+      // Now check that received == sent
+      EXPECT_EQ(transmit_frame.offset, offset);
+      EXPECT_EQ(transmit_frame.offset, receive_frame.offset);
+      EXPECT_EQ(stream_id, receive_frame.stream_id);
+      EXPECT_EQ(transmit_frame.stream_id, receive_frame.stream_id);
+    }
+  }
+}
+
+TEST_F(QuicIetfFramerTest, StreamsBlockedFrame) {
+  QuicStreamCount stream_counts[] = {0x3fffffff, 0x3fff, 0x3f, 0x1};
+
+  for (QuicStreamCount stream_count : stream_counts) {
+    TryStreamsBlockedFrame(stream_count,
+                           /*unidirectional=*/false,
+                           /*stream_id_server_initiated=*/false);
+    TryStreamsBlockedFrame(stream_count,
+                           /*unidirectional=*/false,
+                           /*stream_id_server_initiated=*/true);
+    TryStreamsBlockedFrame(stream_count,
+                           /*unidirectional=*/true,
+                           /*stream_id_server_initiated=*/false);
+    TryStreamsBlockedFrame(stream_count,
+                           /*unidirectional=*/true,
+                           /*stream_id_server_initiated=*/true);
+  }
+}
+
+TEST_F(QuicIetfFramerTest, NewConnectionIdFrame) {
+  char packet_buffer[kNormalPacketBufferSize];
+
+  QuicNewConnectionIdFrame transmit_frame;
+  transmit_frame.connection_id = TestConnectionId(UINT64_C(0x0edcba9876543201));
+  transmit_frame.sequence_number = 0x01020304;
+  transmit_frame.retire_prior_to = 0x00020304;
+  // The token is defined as a uint128 -- a 16-byte integer.
+  // The value is set in this manner because we want each
+  // byte to have a specific value so that the binary
+  // packet check (below) is good. If we used integer
+  // operations (eg. "token = 0x12345...") then the bytes
+  // would be set in host order.
+  unsigned char token_bytes[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
+                                 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
+                                 0x0c, 0x0d, 0x0e, 0x0f};
+  memcpy(&transmit_frame.stateless_reset_token, token_bytes,
+         sizeof(transmit_frame.stateless_reset_token));
+
+  memset(packet_buffer, 0, sizeof(packet_buffer));
+
+  // Set up the writer and transmit a QuicNewConnectionIdFrame
+  QuicDataWriter writer(sizeof(packet_buffer), packet_buffer,
+                        quiche::NETWORK_BYTE_ORDER);
+
+  // Add the frame.
+  EXPECT_TRUE(QuicFramerPeer::AppendNewConnectionIdFrame(
+      &framer_, transmit_frame, &writer));
+  // clang-format off
+  uint8_t packet[] = {
+    // sequence number, 0x80 for varint62 encoding
+    0x80 + 0x01, 0x02, 0x03, 0x04,
+    // retire_prior_to, 0x80 for varint62 encoding
+    0x80 + 0x00, 0x02, 0x03, 0x04,
+    // new connection id length, is not varint62 encoded.
+    0x08,
+    // new connection id, is not varint62 encoded.
+    0x0E, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x01,
+    // the reset token:
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
+  };
+  // clang-format on
+
+  // Check that buffer length is correct
+  EXPECT_EQ(sizeof(packet), writer.length());
+  EXPECT_EQ(0, memcmp(packet_buffer, packet, sizeof(packet)));
+
+  // Set up reader and empty receive QuicPaddingFrame.
+  QuicDataReader reader(packet_buffer, writer.length(),
+                        quiche::NETWORK_BYTE_ORDER);
+  QuicNewConnectionIdFrame receive_frame;
+
+  // Deframe it
+  EXPECT_TRUE(QuicFramerPeer::ProcessNewConnectionIdFrame(&framer_, &reader,
+                                                          &receive_frame));
+
+  // Now check that received == sent
+  EXPECT_EQ(transmit_frame.connection_id, receive_frame.connection_id);
+  EXPECT_EQ(transmit_frame.sequence_number, receive_frame.sequence_number);
+  EXPECT_EQ(transmit_frame.retire_prior_to, receive_frame.retire_prior_to);
+  EXPECT_EQ(transmit_frame.stateless_reset_token,
+            receive_frame.stateless_reset_token);
+}
+
+TEST_F(QuicIetfFramerTest, RetireConnectionIdFrame) {
+  char packet_buffer[kNormalPacketBufferSize];
+
+  QuicRetireConnectionIdFrame transmit_frame;
+  transmit_frame.sequence_number = 0x01020304;
+
+  memset(packet_buffer, 0, sizeof(packet_buffer));
+
+  // Set up the writer and transmit QuicRetireConnectionIdFrame
+  QuicDataWriter writer(sizeof(packet_buffer), packet_buffer,
+                        quiche::NETWORK_BYTE_ORDER);
+
+  // Add the frame.
+  EXPECT_TRUE(QuicFramerPeer::AppendRetireConnectionIdFrame(
+      &framer_, transmit_frame, &writer));
+  // Check that buffer length is correct
+  EXPECT_EQ(4u, writer.length());
+  // clang-format off
+  uint8_t packet[] = {
+    // sequence number, 0x80 for varint62 encoding
+    0x80 + 0x01, 0x02, 0x03, 0x04,
+  };
+
+  // clang-format on
+  EXPECT_EQ(0, memcmp(packet_buffer, packet, sizeof(packet)));
+
+  // Set up reader and empty receive QuicPaddingFrame.
+  QuicDataReader reader(packet_buffer, writer.length(),
+                        quiche::NETWORK_BYTE_ORDER);
+  QuicRetireConnectionIdFrame receive_frame;
+
+  // Deframe it
+  EXPECT_TRUE(QuicFramerPeer::ProcessRetireConnectionIdFrame(&framer_, &reader,
+                                                             &receive_frame));
+
+  // Now check that received == sent
+  EXPECT_EQ(transmit_frame.sequence_number, receive_frame.sequence_number);
+}
+
+}  // namespace
+}  // namespace test
+}  // namespace quic
diff --git a/quic/core/quic_packet_creator.cc b/quic/core/quic_packet_creator.cc
index b223205..3b1a77a 100644
--- a/quic/core/quic_packet_creator.cc
+++ b/quic/core/quic_packet_creator.cc
@@ -27,9 +27,9 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_server_stats.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_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 {
 namespace {
@@ -1047,16 +1047,16 @@
   return VARIABLE_LENGTH_INTEGER_LENGTH_0;
 }
 
-QuicStringPiece QuicPacketCreator::GetRetryToken() const {
+quiche::QuicheStringPiece QuicPacketCreator::GetRetryToken() const {
   if (QuicVersionHasLongHeaderLengths(framer_->transport_version()) &&
       HasIetfLongHeader() &&
       EncryptionlevelToLongHeaderType(packet_.encryption_level) == INITIAL) {
     return retry_token_;
   }
-  return QuicStringPiece();
+  return quiche::QuicheStringPiece();
 }
 
-void QuicPacketCreator::SetRetryToken(QuicStringPiece retry_token) {
+void QuicPacketCreator::SetRetryToken(quiche::QuicheStringPiece retry_token) {
   retry_token_ = std::string(retry_token);
 }
 
@@ -1436,8 +1436,8 @@
       (packet_.encryption_level == ENCRYPTION_INITIAL ||
        packet_.encryption_level == ENCRYPTION_HANDSHAKE)) {
     const std::string error_details =
-        QuicStrCat("Cannot send stream data with level: ",
-                   EncryptionLevelToString(packet_.encryption_level));
+        quiche::QuicheStrCat("Cannot send stream data with level: ",
+                             EncryptionLevelToString(packet_.encryption_level));
     QUIC_BUG << error_details;
     delegate_->OnUnrecoverableError(
         QUIC_ATTEMPT_TO_SEND_UNENCRYPTED_STREAM_DATA, error_details);
diff --git a/quic/core/quic_packet_creator.h b/quic/core/quic_packet_creator.h
index eb7b627..96cd5bf 100644
--- a/quic/core/quic_packet_creator.h
+++ b/quic/core/quic_packet_creator.h
@@ -26,6 +26,7 @@
 #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 {
 namespace test {
@@ -286,7 +287,7 @@
   void AddPendingPadding(QuicByteCount size);
 
   // Sets the retry token to be sent over the wire in IETF Initial packets.
-  void SetRetryToken(QuicStringPiece retry_token);
+  void SetRetryToken(quiche::QuicheStringPiece retry_token);
 
   // Consumes retransmittable control |frame|. Returns true if the frame is
   // successfully consumed. Returns false otherwise.
@@ -510,7 +511,7 @@
 
   // Returns the retry token to send over the wire, only sent in
   // v99 IETF Initial packets.
-  QuicStringPiece GetRetryToken() const;
+  quiche::QuicheStringPiece 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 6ca369c..56c62cb 100644
--- a/quic/core/quic_packet_creator_test.cc
+++ b/quic/core/quic_packet_creator_test.cc
@@ -25,13 +25,14 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_ptr_util.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
 #include "net/third_party/quiche/src/quic/test_tools/quic_framer_peer.h"
 #include "net/third_party/quiche/src/quic/test_tools/quic_packet_creator_peer.h"
 #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/quic/test_tools/simple_quic_framer.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::DoAll;
@@ -64,8 +65,9 @@
 
 // Used by ::testing::PrintToStringParamName().
 std::string PrintToString(const TestParams& p) {
-  return QuicStrCat(ParsedQuicVersionToString(p.version), "_",
-                    (p.version_serialization ? "Include" : "No"), "Version");
+  return quiche::QuicheStrCat(ParsedQuicVersionToString(p.version), "_",
+                              (p.version_serialization ? "Include" : "No"),
+                              "Version");
 }
 
 // Constructs various test permutations.
@@ -234,7 +236,8 @@
       producer_.WriteStreamData(stream_id, frame.stream_frame.offset,
                                 frame.stream_frame.data_length, &writer);
     }
-    EXPECT_EQ(data, QuicStringPiece(buf, frame.stream_frame.data_length));
+    EXPECT_EQ(data,
+              quiche::QuicheStringPiece(buf, frame.stream_frame.data_length));
     EXPECT_EQ(offset, frame.stream_frame.offset);
     EXPECT_EQ(fin, frame.stream_frame.fin);
   }
@@ -311,11 +314,11 @@
     QuicStreamId stream_id = QuicUtils::GetFirstBidirectionalStreamId(
         client_framer_.transport_version(), Perspective::IS_CLIENT);
     if (level != ENCRYPTION_INITIAL && level != ENCRYPTION_HANDSHAKE) {
-      frames_.push_back(
-          QuicFrame(QuicStreamFrame(stream_id, false, 0u, QuicStringPiece())));
+      frames_.push_back(QuicFrame(
+          QuicStreamFrame(stream_id, false, 0u, quiche::QuicheStringPiece())));
       if (!GetQuicRestartFlag(quic_coalesce_stream_frames_2)) {
-        frames_.push_back(
-            QuicFrame(QuicStreamFrame(stream_id, true, 0u, QuicStringPiece())));
+        frames_.push_back(QuicFrame(
+            QuicStreamFrame(stream_id, true, 0u, quiche::QuicheStringPiece())));
       }
     }
     SerializedPacket serialized = SerializeAllFrames(frames_);
@@ -1337,7 +1340,7 @@
   if (!QuicVersionUsesCryptoFrames(client_framer_.transport_version())) {
     QuicStreamFrame stream_frame(
         QuicUtils::GetCryptoStreamId(client_framer_.transport_version()),
-        /*fin=*/false, 0u, QuicStringPiece());
+        /*fin=*/false, 0u, quiche::QuicheStringPiece());
     frames_.push_back(QuicFrame(stream_frame));
   } else {
     producer_.SaveCryptoData(ENCRYPTION_INITIAL, 0, data);
@@ -1375,7 +1378,7 @@
   if (!QuicVersionUsesCryptoFrames(client_framer_.transport_version())) {
     QuicStreamFrame stream_frame(
         QuicUtils::GetCryptoStreamId(client_framer_.transport_version()),
-        /*fin=*/false, 0u, QuicStringPiece());
+        /*fin=*/false, 0u, quiche::QuicheStringPiece());
     frames_.push_back(QuicFrame(stream_frame));
   } else {
     producer_.SaveCryptoData(ENCRYPTION_INITIAL, 0, data);
@@ -1595,7 +1598,7 @@
   creator_.set_encryption_level(ENCRYPTION_INITIAL);
   EXPECT_CALL(delegate_, OnUnrecoverableError(_, _));
   QuicStreamFrame stream_frame(GetNthClientInitiatedStreamId(0),
-                               /*fin=*/false, 0u, QuicStringPiece());
+                               /*fin=*/false, 0u, quiche::QuicheStringPiece());
   EXPECT_QUIC_BUG(
       creator_.AddFrame(QuicFrame(stream_frame), NOT_RETRANSMISSION),
       "Cannot send stream data with level: ENCRYPTION_INITIAL");
@@ -1610,7 +1613,7 @@
   creator_.set_encryption_level(ENCRYPTION_HANDSHAKE);
   EXPECT_CALL(delegate_, OnUnrecoverableError(_, _));
   QuicStreamFrame stream_frame(GetNthClientInitiatedStreamId(0),
-                               /*fin=*/false, 0u, QuicStringPiece());
+                               /*fin=*/false, 0u, quiche::QuicheStringPiece());
   EXPECT_QUIC_BUG(
       creator_.AddFrame(QuicFrame(stream_frame), NOT_RETRANSMISSION),
       "Cannot send stream data with level: ENCRYPTION_HANDSHAKE");
@@ -1637,8 +1640,9 @@
   message_data = framer.ConstructHandshakeMessage(message);
 
   struct iovec iov;
-  MakeIOVector(QuicStringPiece(message_data->data(), message_data->length()),
-               &iov);
+  MakeIOVector(
+      quiche::QuicheStringPiece(message_data->data(), message_data->length()),
+      &iov);
   QuicFrame frame;
   EXPECT_CALL(delegate_, OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, _));
   EXPECT_QUIC_BUG(
@@ -1715,7 +1719,7 @@
       .WillRepeatedly(
           Invoke(this, &QuicPacketCreatorTest::SaveSerializedPacket));
   // Send stream frame of size kStreamFramePayloadSize.
-  MakeIOVector(QuicStringPiece(buf, kStreamFramePayloadSize), &iov_);
+  MakeIOVector(quiche::QuicheStringPiece(buf, kStreamFramePayloadSize), &iov_);
   creator_.ConsumeDataToFillCurrentPacket(stream_id, &iov_, 1u, iov_.iov_len,
                                           0u, 0u, false, false,
                                           NOT_RETRANSMISSION, &frame);
@@ -1723,7 +1727,8 @@
   // 1 byte padding is sent.
   EXPECT_EQ(pending_padding_bytes - 1, creator_.pending_padding_bytes());
   // Send stream frame of size kStreamFramePayloadSize + 1.
-  MakeIOVector(QuicStringPiece(buf, kStreamFramePayloadSize + 1), &iov_);
+  MakeIOVector(quiche::QuicheStringPiece(buf, kStreamFramePayloadSize + 1),
+               &iov_);
   creator_.ConsumeDataToFillCurrentPacket(stream_id, &iov_, 1u, iov_.iov_len,
                                           0u, kStreamFramePayloadSize, false,
                                           false, NOT_RETRANSMISSION, &frame);
@@ -1829,7 +1834,7 @@
     return;
   }
   std::string message_data(kDefaultMaxPacketSize, 'a');
-  QuicStringPiece message_buffer(message_data);
+  quiche::QuicheStringPiece message_buffer(message_data);
   QuicMemSliceStorage storage(nullptr, 0, nullptr, 0);
   // Test all possible encryption levels of message frames.
   for (EncryptionLevel level :
@@ -1840,9 +1845,10 @@
          message_size <= creator_.GetCurrentLargestMessagePayload();
          ++message_size) {
       QuicMessageFrame* frame = new QuicMessageFrame(
-          0, MakeSpan(&allocator_,
-                      QuicStringPiece(message_buffer.data(), message_size),
-                      &storage));
+          0, MakeSpan(
+                 &allocator_,
+                 quiche::QuicheStringPiece(message_buffer.data(), message_size),
+                 &storage));
       EXPECT_TRUE(creator_.AddFrame(QuicFrame(frame), NOT_RETRANSMISSION));
       EXPECT_TRUE(creator_.HasPendingFrames());
 
@@ -1895,7 +1901,8 @@
   QuicStreamId stream_id = QuicUtils::GetFirstBidirectionalStreamId(
       client_framer_.transport_version(), Perspective::IS_CLIENT);
   QuicFrame stream_frame(QuicStreamFrame(stream_id,
-                                         /*fin=*/false, 0u, QuicStringPiece()));
+                                         /*fin=*/false, 0u,
+                                         quiche::QuicheStringPiece()));
   ASSERT_TRUE(QuicUtils::IsRetransmittableFrame(stream_frame.type));
 
   QuicFrame padding_frame{QuicPaddingFrame()};
@@ -1936,7 +1943,7 @@
   if (!QuicVersionUsesCryptoFrames(client_framer_.transport_version())) {
     QuicStreamFrame stream_frame(
         QuicUtils::GetCryptoStreamId(client_framer_.transport_version()),
-        /*fin=*/false, 0u, QuicStringPiece());
+        /*fin=*/false, 0u, quiche::QuicheStringPiece());
     frames_.push_back(QuicFrame(stream_frame));
   } else {
     producer_.SaveCryptoData(ENCRYPTION_INITIAL, 0, data);
@@ -2105,8 +2112,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, QuicStringPiece())));
+      frames_.push_back(QuicFrame(
+          QuicStreamFrame(1, false, 0u, quiche::QuicheStringPiece())));
     }
     SerializedPacket serialized = SerializeAllFrames(frames_);
     EXPECT_EQ(level, serialized.encryption_level);
@@ -2365,7 +2372,7 @@
   }
 
   size_t ConsumeCryptoData(EncryptionLevel level,
-                           QuicStringPiece data,
+                           quiche::QuicheStringPiece data,
                            QuicStreamOffset offset) {
     producer_->SaveCryptoData(level, offset, data);
     if (!has_ack() && delegate_->ShouldGeneratePacket(NO_RETRANSMITTABLE_DATA,
@@ -3495,7 +3502,7 @@
        ConnectionCloseFrameLargerThanPacketSize) {
   delegate_.SetCanWriteAnything();
   char buf[2000] = {};
-  QuicStringPiece error_details(buf, 2000);
+  quiche::QuicheStringPiece error_details(buf, 2000);
   const QuicErrorCode kQuicErrorCode = QUIC_PACKET_WRITE_ERROR;
 
   QuicConnectionCloseFrame* frame = new QuicConnectionCloseFrame(
@@ -3535,7 +3542,7 @@
   EXPECT_CALL(delegate_, OnSerializedPacket(_))
       .WillOnce(
           Invoke(this, &QuicPacketCreatorMultiplePacketsTest::SavePacket));
-  MakeIOVector(QuicStringPiece(buf, kStreamFramePayloadSize), &iov_);
+  MakeIOVector(quiche::QuicheStringPiece(buf, kStreamFramePayloadSize), &iov_);
   QuicConsumedData consumed = creator_.ConsumeData(
       kDataStreamId, &iov_, 1u, iov_.iov_len, 0, FIN_AND_PADDING);
   creator_.Flush();
@@ -3578,7 +3585,7 @@
   EXPECT_CALL(delegate_, OnSerializedPacket(_))
       .WillRepeatedly(
           Invoke(this, &QuicPacketCreatorMultiplePacketsTest::SavePacket));
-  MakeIOVector(QuicStringPiece(buf, kStreamFramePayloadSize), &iov_);
+  MakeIOVector(quiche::QuicheStringPiece(buf, kStreamFramePayloadSize), &iov_);
   QuicConsumedData consumed = creator_.ConsumeData(
       kDataStreamId, &iov_, 1u, iov_.iov_len, 0, FIN_AND_PADDING);
   creator_.Flush();
@@ -3633,11 +3640,11 @@
   EXPECT_CALL(delegate_, OnSerializedPacket(_))
       .WillRepeatedly(
           Invoke(this, &QuicPacketCreatorMultiplePacketsTest::SavePacket));
-  MakeIOVector(QuicStringPiece(buf, kStreamFramePayloadSize), &iov_);
+  MakeIOVector(quiche::QuicheStringPiece(buf, kStreamFramePayloadSize), &iov_);
   QuicConsumedData consumed = creator_.ConsumeData(
       kDataStreamId1, &iov_, 1u, iov_.iov_len, 0, FIN_AND_PADDING);
   EXPECT_EQ(kStreamFramePayloadSize, consumed.bytes_consumed);
-  MakeIOVector(QuicStringPiece(buf, kStreamFramePayloadSize), &iov_);
+  MakeIOVector(quiche::QuicheStringPiece(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 87b310e..41ada82 100644
--- a/quic/core/quic_packets.cc
+++ b/quic/core/quic_packets.cc
@@ -12,10 +12,10 @@
 #include "net/third_party/quiche/src/quic/core/quic_versions.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_string_utils.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_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(QuicStringPiece()),
+      retry_token(quiche::QuicheStringPiece()),
       length_length(VARIABLE_LENGTH_INTEGER_LENGTH_0),
       remaining_packet_length(0) {}
 
@@ -259,8 +259,8 @@
   }
   if (header.nonce != nullptr) {
     os << ", diversification_nonce: "
-       << QuicTextUtils::HexEncode(
-              QuicStringPiece(header.nonce->data(), header.nonce->size()));
+       << quiche::QuicheTextUtils::HexEncode(quiche::QuicheStringPiece(
+              header.nonce->data(), header.nonce->size()));
   }
   os << ", packet_number: " << header.packet_number << " }\n";
   return os;
@@ -272,7 +272,7 @@
 QuicData::QuicData(const char* buffer, size_t length, bool owns_buffer)
     : buffer_(buffer), length_(length), owns_buffer_(owns_buffer) {}
 
-QuicData::QuicData(QuicStringPiece packet_data)
+QuicData::QuicData(quiche::QuicheStringPiece packet_data)
     : buffer_(packet_data.data()),
       length_(packet_data.length()),
       owns_buffer_(false) {}
@@ -331,7 +331,7 @@
                                          bool owns_buffer)
     : QuicData(buffer, length, owns_buffer) {}
 
-QuicEncryptedPacket::QuicEncryptedPacket(QuicStringPiece data)
+QuicEncryptedPacket::QuicEncryptedPacket(quiche::QuicheStringPiece data)
     : QuicData(data) {}
 
 std::unique_ptr<QuicEncryptedPacket> QuicEncryptedPacket::Clone() const {
@@ -422,8 +422,9 @@
   return os;
 }
 
-QuicStringPiece QuicPacket::AssociatedData(QuicTransportVersion version) const {
-  return QuicStringPiece(
+quiche::QuicheStringPiece QuicPacket::AssociatedData(
+    QuicTransportVersion version) const {
+  return quiche::QuicheStringPiece(
       data(),
       GetStartOfEncryptedData(version, destination_connection_id_length_,
                               source_connection_id_length_, includes_version_,
@@ -432,13 +433,14 @@
                               retry_token_length_, length_length_));
 }
 
-QuicStringPiece QuicPacket::Plaintext(QuicTransportVersion version) const {
+quiche::QuicheStringPiece 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 QuicStringPiece(data() + start_of_encrypted_data,
-                         length() - start_of_encrypted_data);
+  return quiche::QuicheStringPiece(data() + start_of_encrypted_data,
+                                   length() - start_of_encrypted_data);
 }
 
 SerializedPacket::SerializedPacket(QuicPacketNumber packet_number,
@@ -551,11 +553,11 @@
 ReceivedPacketInfo::~ReceivedPacketInfo() {}
 
 std::string ReceivedPacketInfo::ToString() const {
-  std::string output =
-      QuicStrCat("{ self_address: ", self_address.ToString(),
-                 ", peer_address: ", peer_address.ToString(),
-                 ", packet_length: ", packet.length(),
-                 ", header_format: ", form, ", version_flag: ", version_flag);
+  std::string output = quiche::QuicheStrCat(
+      "{ self_address: ", self_address.ToString(),
+      ", peer_address: ", peer_address.ToString(),
+      ", packet_length: ", packet.length(), ", header_format: ", form,
+      ", version_flag: ", version_flag);
   if (version_flag) {
     QuicStrAppend(&output, ", version: ", ParsedQuicVersionToString(version));
   }
diff --git a/quic/core/quic_packets.h b/quic/core/quic_packets.h
index 93417ac..9e97fa9 100644
--- a/quic/core/quic_packets.h
+++ b/quic/core/quic_packets.h
@@ -24,8 +24,8 @@
 #include "net/third_party/quiche/src/quic/core/quic_versions.h"
 #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_string_piece.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 {
 
@@ -158,7 +158,7 @@
   // carried only by v99 IETF Initial packets.
   QuicVariableLengthIntegerLength retry_token_length_length;
   // Retry token, carried only by v99 IETF Initial packets.
-  QuicStringPiece retry_token;
+  quiche::QuicheStringPiece retry_token;
   // Length of the length variable length integer field,
   // carried only by v99 IETF Initial, 0-RTT and Handshake packets.
   QuicVariableLengthIntegerLength length_length;
@@ -209,14 +209,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 QuicStringPiece. Does not own the buffer.
-  QuicData(QuicStringPiece data);
+  // Creates a QuicData from a quiche::QuicheStringPiece. Does not own the
+  // buffer.
+  QuicData(quiche::QuicheStringPiece data);
   QuicData(const QuicData&) = delete;
   QuicData& operator=(const QuicData&) = delete;
   virtual ~QuicData();
 
-  QuicStringPiece AsStringPiece() const {
-    return QuicStringPiece(data(), length());
+  quiche::QuicheStringPiece AsStringPiece() const {
+    return quiche::QuicheStringPiece(data(), length());
   }
 
   const char* data() const { return buffer_; }
@@ -249,8 +250,8 @@
   QuicPacket(const QuicPacket&) = delete;
   QuicPacket& operator=(const QuicPacket&) = delete;
 
-  QuicStringPiece AssociatedData(QuicTransportVersion version) const;
-  QuicStringPiece Plaintext(QuicTransportVersion version) const;
+  quiche::QuicheStringPiece AssociatedData(QuicTransportVersion version) const;
+  quiche::QuicheStringPiece Plaintext(QuicTransportVersion version) const;
 
   char* mutable_data() { return buffer_; }
 
@@ -274,9 +275,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 QuicStringPiece.
+  // Creates a QuicEncryptedPacket from a quiche::QuicheStringPiece.
   // Does not own the buffer.
-  QuicEncryptedPacket(QuicStringPiece data);
+  QuicEncryptedPacket(quiche::QuicheStringPiece 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 625ba99..fd130fa 100644
--- a/quic/core/quic_sent_packet_manager_test.cc
+++ b/quic/core/quic_sent_packet_manager_test.cc
@@ -9,11 +9,11 @@
 
 #include "net/third_party/quiche/src/quic/platform/api/quic_arraysize.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
 #include "net/third_party/quiche/src/quic/test_tools/quic_config_peer.h"
 #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_string_piece.h"
 
 using testing::_;
 using testing::AnyNumber;
@@ -61,7 +61,7 @@
                      kDefaultLength, HAS_RETRANSMITTABLE_DATA));
     SerializedPacket packet(CreatePacket(packet_number, false));
     packet.retransmittable_frames.push_back(
-        QuicFrame(QuicStreamFrame(1, false, 0, QuicStringPiece())));
+        QuicFrame(QuicStreamFrame(1, false, 0, quiche::QuicheStringPiece())));
     packet.has_crypto_handshake = IS_HANDSHAKE;
     manager_.OnPacketSent(&packet, clock_.Now(), HANDSHAKE_RETRANSMISSION,
                           HAS_RETRANSMITTABLE_DATA);
@@ -244,8 +244,8 @@
                             PACKET_4BYTE_PACKET_NUMBER, nullptr, kDefaultLength,
                             false, false);
     if (retransmittable) {
-      packet.retransmittable_frames.push_back(
-          QuicFrame(QuicStreamFrame(kStreamId, false, 0, QuicStringPiece())));
+      packet.retransmittable_frames.push_back(QuicFrame(
+          QuicStreamFrame(kStreamId, false, 0, quiche::QuicheStringPiece())));
     }
     return packet;
   }
@@ -291,7 +291,7 @@
                      kDefaultLength, HAS_RETRANSMITTABLE_DATA));
     SerializedPacket packet(CreatePacket(packet_number, false));
     packet.retransmittable_frames.push_back(
-        QuicFrame(QuicStreamFrame(1, false, 0, QuicStringPiece())));
+        QuicFrame(QuicStreamFrame(1, false, 0, quiche::QuicheStringPiece())));
     packet.has_crypto_handshake = IS_HANDSHAKE;
     manager_.OnPacketSent(&packet, clock_.Now(), NOT_RETRANSMISSION,
                           HAS_RETRANSMITTABLE_DATA);
@@ -3167,7 +3167,7 @@
 TEST_F(QuicSentPacketManagerTest, RtoNotInFlightPacket) {
   QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2);
   // Send SHLO.
-  QuicStreamFrame crypto_frame(1, false, 0, QuicStringPiece());
+  QuicStreamFrame crypto_frame(1, false, 0, quiche::QuicheStringPiece());
   SendCryptoPacket(1);
   // Send data packet.
   SendDataPacket(2, ENCRYPTION_FORWARD_SECURE);
diff --git a/quic/core/quic_server_id.cc b/quic/core/quic_server_id.cc
index 6a4e56f..653152d 100644
--- a/quic/core/quic_server_id.cc
+++ b/quic/core/quic_server_id.cc
@@ -8,7 +8,6 @@
 #include <tuple>
 
 #include "net/third_party/quiche/src/quic/platform/api/quic_estimate_memory_usage.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
 
 namespace quic {
 
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc
index 60fea01..9a0bae6 100644
--- a/quic/core/quic_session.cc
+++ b/quic/core/quic_session.cc
@@ -22,7 +22,8 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_ptr_util.h"
 #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/quic/platform/api/quic_str_cat.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;
 
@@ -367,7 +368,7 @@
   goaway_received_ = true;
 }
 
-void QuicSession::OnMessageReceived(QuicStringPiece message) {
+void QuicSession::OnMessageReceived(quiche::QuicheStringPiece message) {
   QUIC_DVLOG(1) << ENDPOINT << "Received message, length: " << message.length()
                 << ", " << message;
 }
@@ -1573,8 +1574,8 @@
   if (!stream_id_manager_.MaybeIncreaseLargestPeerStreamId(stream_id)) {
     connection()->CloseConnection(
         QUIC_TOO_MANY_AVAILABLE_STREAMS,
-        QuicStrCat(stream_id, " exceeds available streams ",
-                   stream_id_manager_.MaxAvailableStreams()),
+        quiche::QuicheStrCat(stream_id, " exceeds available streams ",
+                             stream_id_manager_.MaxAvailableStreams()),
         ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
     return false;
   }
@@ -2145,13 +2146,13 @@
   return stream_id_manager_.max_open_incoming_streams();
 }
 
-std::vector<QuicStringPiece>::const_iterator QuicSession::SelectAlpn(
-    const std::vector<QuicStringPiece>& alpns) const {
+std::vector<quiche::QuicheStringPiece>::const_iterator QuicSession::SelectAlpn(
+    const std::vector<quiche::QuicheStringPiece>& alpns) const {
   const std::string alpn = AlpnForVersion(connection()->version());
   return std::find(alpns.cbegin(), alpns.cend(), alpn);
 }
 
-void QuicSession::OnAlpnSelected(QuicStringPiece alpn) {
+void QuicSession::OnAlpnSelected(quiche::QuicheStringPiece 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 eb9cdfe..f526a62 100644
--- a/quic/core/quic_session.h
+++ b/quic/core/quic_session.h
@@ -31,6 +31,7 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_containers.h"
 #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_string_piece.h"
 
 namespace quic {
 
@@ -104,7 +105,7 @@
   void OnCryptoFrame(const QuicCryptoFrame& frame) override;
   void OnRstStream(const QuicRstStreamFrame& frame) override;
   void OnGoAway(const QuicGoAwayFrame& frame) override;
-  void OnMessageReceived(QuicStringPiece message) override;
+  void OnMessageReceived(quiche::QuicheStringPiece message) override;
   void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) override;
   void OnBlockedFrame(const QuicBlockedFrame& frame) override;
   void OnConnectionClosed(const QuicConnectionCloseFrame& frame,
@@ -491,12 +492,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<QuicStringPiece>::const_iterator SelectAlpn(
-      const std::vector<QuicStringPiece>& alpns) const;
+  virtual std::vector<quiche::QuicheStringPiece>::const_iterator SelectAlpn(
+      const std::vector<quiche::QuicheStringPiece>& alpns) const;
 
   // Called when the ALPN of the connection is established for a connection that
   // uses TLS handshake.
-  virtual void OnAlpnSelected(QuicStringPiece alpn);
+  virtual void OnAlpnSelected(quiche::QuicheStringPiece alpn);
 
  protected:
   using StreamMap = QuicSmallMap<QuicStreamId, std::unique_ptr<QuicStream>, 10>;
diff --git a/quic/core/quic_session_test.cc b/quic/core/quic_session_test.cc
index 5c04379..ee3695a 100644
--- a/quic/core/quic_session_test.cc
+++ b/quic/core/quic_session_test.cc
@@ -25,8 +25,6 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_map_util.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_mem_slice_storage.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_ptr_util.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_test_mem_slice_vector.h"
 #include "net/third_party/quiche/src/quic/test_tools/mock_quic_session_visitor.h"
@@ -38,6 +36,8 @@
 #include "net/third_party/quiche/src/quic/test_tools/quic_stream_peer.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_str_cat.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
 
 using spdy::kV3HighestPriority;
 using spdy::SpdyPriority;
@@ -858,8 +858,8 @@
   EXPECT_CALL(*connection_, SendControlFrame(_));
   EXPECT_CALL(*connection_, OnStreamReset(closed_stream_id, _));
   stream2->Reset(QUIC_BAD_APPLICATION_PAYLOAD);
-  std::string msg =
-      QuicStrCat("Marking unknown stream ", closed_stream_id, " blocked.");
+  std::string msg = quiche::QuicheStrCat("Marking unknown stream ",
+                                         closed_stream_id, " blocked.");
   EXPECT_QUIC_BUG(session_.MarkConnectionLevelWriteBlocked(closed_stream_id),
                   msg);
 }
@@ -1449,7 +1449,8 @@
                                    /*is_static*/ true, BIDIRECTIONAL);
   QuicSessionPeer::ActivateStream(&session_, std::move(fake_headers_stream));
   // Send two bytes of payload.
-  QuicStreamFrame data1(headers_stream_id, true, 0, QuicStringPiece("HT"));
+  QuicStreamFrame data1(headers_stream_id, true, 0,
+                        quiche::QuicheStringPiece("HT"));
   EXPECT_CALL(*connection_,
               CloseConnection(
                   QUIC_INVALID_STREAM_ID, "Attempt to close a static stream",
@@ -1482,7 +1483,7 @@
   // Send two bytes of payload.
   QuicStreamFrame data1(
       QuicUtils::GetInvalidStreamId(connection_->transport_version()), true, 0,
-      QuicStringPiece("HT"));
+      quiche::QuicheStringPiece("HT"));
   EXPECT_CALL(*connection_,
               CloseConnection(
                   QUIC_INVALID_STREAM_ID, "Received data for an invalid stream",
@@ -1672,7 +1673,8 @@
   // account the total number of bytes sent by the peer.
   const QuicStreamOffset kByteOffset = 5678;
   std::string body = "hello";
-  QuicStreamFrame frame(stream->id(), true, kByteOffset, QuicStringPiece(body));
+  QuicStreamFrame frame(stream->id(), true, kByteOffset,
+                        quiche::QuicheStringPiece(body));
   session_.OnStreamFrame(frame);
 
   QuicStreamOffset total_stream_bytes_sent_by_peer =
@@ -1775,7 +1777,8 @@
   EXPECT_CALL(*connection_, SendControlFrame(_));
   EXPECT_CALL(*connection_, OnStreamReset(stream->id(), _));
   stream->Reset(QUIC_STREAM_CANCELLED);
-  QuicStreamFrame frame(stream->id(), true, kLargeOffset, QuicStringPiece());
+  QuicStreamFrame frame(stream->id(), true, kLargeOffset,
+                        quiche::QuicheStringPiece());
   session_.OnStreamFrame(frame);
 
   // Check that RST results in connection close.
@@ -1802,7 +1805,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, QuicStringPiece("HT"));
+    QuicStreamFrame data1(i, false, 0, quiche::QuicheStringPiece("HT"));
     session_.OnStreamFrame(data1);
     // EXPECT_EQ(1u, session_.GetNumOpenStreams());
     if (VersionHasIetfQuicFrames(transport_version())) {
@@ -1833,7 +1836,8 @@
         .Times(1);
   }
   // Create one more data streams to exceed limit of open stream.
-  QuicStreamFrame data1(kFinalStreamId, false, 0, QuicStringPiece("HT"));
+  QuicStreamFrame data1(kFinalStreamId, false, 0,
+                        quiche::QuicheStringPiece("HT"));
   session_.OnStreamFrame(data1);
 }
 
@@ -1843,7 +1847,7 @@
   // protocol point of view).
   TestStream* stream = session_.CreateOutgoingBidirectionalStream();
   QuicStreamId stream_id = stream->id();
-  QuicStreamFrame data1(stream_id, true, 0, QuicStringPiece("HT"));
+  QuicStreamFrame data1(stream_id, true, 0, quiche::QuicheStringPiece("HT"));
   session_.OnStreamFrame(data1);
   EXPECT_CALL(session_, OnCanCreateNewOutgoingStream(false)).Times(1);
   session_.StreamDraining(stream_id);
@@ -1854,11 +1858,11 @@
 
   QuicStreamId stream_id = QuicUtils::GetFirstUnidirectionalStreamId(
       transport_version(), Perspective::IS_CLIENT);
-  QuicStreamFrame data1(stream_id, true, 10, QuicStringPiece("HT"));
+  QuicStreamFrame data1(stream_id, true, 10, quiche::QuicheStringPiece("HT"));
   session_.OnStreamFrame(data1);
   EXPECT_EQ(1, session_.num_incoming_streams_created());
 
-  QuicStreamFrame data2(stream_id, false, 0, QuicStringPiece("HT"));
+  QuicStreamFrame data2(stream_id, false, 0, quiche::QuicheStringPiece("HT"));
   session_.OnStreamFrame(data2);
   EXPECT_EQ(1, session_.num_incoming_streams_created());
 }
@@ -1871,12 +1875,12 @@
 
   QuicStreamId stream_id = QuicUtils::GetFirstUnidirectionalStreamId(
       transport_version(), Perspective::IS_CLIENT);
-  QuicStreamFrame data1(stream_id, true, 10, QuicStringPiece("HT"));
+  QuicStreamFrame data1(stream_id, true, 10, quiche::QuicheStringPiece("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, QuicStringPiece("HT"));
+  QuicStreamFrame data2(stream_id, false, 0, quiche::QuicheStringPiece("HT"));
   session_.OnStreamFrame(data2);
   EXPECT_FALSE(QuicSessionPeer::GetPendingStream(&session_, stream_id));
   EXPECT_EQ(1, session_.num_incoming_streams_created());
@@ -1890,7 +1894,7 @@
 
   QuicStreamId stream_id = QuicUtils::GetFirstUnidirectionalStreamId(
       transport_version(), Perspective::IS_CLIENT);
-  QuicStreamFrame data1(stream_id, true, 10, QuicStringPiece("HT"));
+  QuicStreamFrame data1(stream_id, true, 10, quiche::QuicheStringPiece("HT"));
   session_.OnStreamFrame(data1);
   EXPECT_TRUE(QuicSessionPeer::GetPendingStream(&session_, stream_id));
   EXPECT_EQ(0, session_.num_incoming_streams_created());
@@ -1903,7 +1907,7 @@
   EXPECT_EQ(0, session_.num_incoming_streams_created());
   EXPECT_EQ(0u, session_.GetNumOpenIncomingStreams());
 
-  QuicStreamFrame data2(stream_id, false, 0, QuicStringPiece("HT"));
+  QuicStreamFrame data2(stream_id, false, 0, quiche::QuicheStringPiece("HT"));
   session_.OnStreamFrame(data2);
   EXPECT_FALSE(QuicSessionPeer::GetPendingStream(&session_, stream_id));
   EXPECT_EQ(0, session_.num_incoming_streams_created());
@@ -1934,7 +1938,7 @@
   session_.set_uses_pending_streams(true);
   QuicStreamId stream_id = QuicUtils::GetFirstUnidirectionalStreamId(
       transport_version(), Perspective::IS_CLIENT);
-  QuicStreamFrame data1(stream_id, true, 10, QuicStringPiece("HT"));
+  QuicStreamFrame data1(stream_id, true, 10, quiche::QuicheStringPiece("HT"));
   session_.OnStreamFrame(data1);
   EXPECT_TRUE(QuicSessionPeer::GetPendingStream(&session_, stream_id));
   EXPECT_EQ(0, session_.num_incoming_streams_created());
@@ -1974,7 +1978,7 @@
       GetNthClientInitiatedBidirectionalId(2 * kMaxStreams + 1);
   for (QuicStreamId i = kFirstStreamId; i < kFinalStreamId;
        i += QuicUtils::StreamIdDelta(connection_->transport_version())) {
-    QuicStreamFrame data1(i, true, 0, QuicStringPiece("HT"));
+    QuicStreamFrame data1(i, true, 0, quiche::QuicheStringPiece("HT"));
     session_.OnStreamFrame(data1);
     EXPECT_EQ(1u, session_.GetNumOpenIncomingStreams());
     session_.StreamDraining(i);
@@ -2039,7 +2043,7 @@
   QuicStreamPeer::CloseReadSide(stream);
 
   // Receive a stream data frame with FIN.
-  QuicStreamFrame frame(stream_id, true, 0, QuicStringPiece());
+  QuicStreamFrame frame(stream_id, true, 0, quiche::QuicheStringPiece());
   session_.OnStreamFrame(frame);
   EXPECT_TRUE(stream->fin_received());
 
@@ -2346,7 +2350,7 @@
   session_.GetMutableCryptoStream()->OnHandshakeMessage(handshake_message);
   EXPECT_TRUE(session_.IsCryptoHandshakeConfirmed());
 
-  QuicStringPiece message;
+  quiche::QuicheStringPiece message;
   EXPECT_CALL(*connection_, SendMessage(1, _, false))
       .WillOnce(Return(MESSAGE_STATUS_SUCCESS));
   EXPECT_EQ(MessageResult(MESSAGE_STATUS_SUCCESS, 1),
diff --git a/quic/core/quic_stream.cc b/quic/core/quic_stream.cc
index 1c70f48..a440a13 100644
--- a/quic/core/quic_stream.cc
+++ b/quic/core/quic_stream.cc
@@ -15,7 +15,8 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.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;
 
@@ -179,7 +180,7 @@
   if (frame.offset + frame.data_length > sequencer_.close_offset()) {
     CloseConnectionWithDetails(
         QUIC_STREAM_DATA_BEYOND_CLOSE_OFFSET,
-        QuicStrCat(
+        quiche::QuicheStrCat(
             "Stream ", id_,
             " received data with offset: ", frame.offset + frame.data_length,
             ", which is beyond close offset: ", sequencer()->close_offset()));
@@ -228,10 +229,10 @@
       frame.byte_offset != sequencer()->close_offset()) {
     CloseConnectionWithDetails(
         QUIC_STREAM_MULTIPLE_OFFSET,
-        QuicStrCat("Stream ", id_,
-                   " received new final offset: ", frame.byte_offset,
-                   ", which is different from close offset: ",
-                   sequencer()->close_offset()));
+        quiche::QuicheStrCat("Stream ", id_,
+                             " received new final offset: ", frame.byte_offset,
+                             ", which is different from close offset: ",
+                             sequencer()->close_offset()));
     return;
   }
 
@@ -415,16 +416,17 @@
                   << sequencer_.DebugString();
     CloseConnectionWithDetails(
         QUIC_STREAM_LENGTH_OVERFLOW,
-        QuicStrCat("Peer sends more data than allowed on stream ", id_,
-                   ". frame: offset = ", frame.offset, ", length = ",
-                   frame.data_length, ". ", sequencer_.DebugString()));
+        quiche::QuicheStrCat("Peer sends more data than allowed on stream ",
+                             id_, ". frame: offset = ", frame.offset,
+                             ", length = ", frame.data_length, ". ",
+                             sequencer_.DebugString()));
     return;
   }
 
   if (frame.offset + frame.data_length > sequencer_.close_offset()) {
     CloseConnectionWithDetails(
         QUIC_STREAM_DATA_BEYOND_CLOSE_OFFSET,
-        QuicStrCat(
+        quiche::QuicheStrCat(
             "Stream ", id_,
             " received data with offset: ", frame.offset + frame.data_length,
             ", which is beyond close offset: ", sequencer_.close_offset()));
@@ -491,10 +493,10 @@
       frame.byte_offset != sequencer()->close_offset()) {
     CloseConnectionWithDetails(
         QUIC_STREAM_MULTIPLE_OFFSET,
-        QuicStrCat("Stream ", id_,
-                   " received new final offset: ", frame.byte_offset,
-                   ", which is different from close offset: ",
-                   sequencer_.close_offset()));
+        quiche::QuicheStrCat("Stream ", id_,
+                             " received new final offset: ", frame.byte_offset,
+                             ", which is different from close offset: ",
+                             sequencer_.close_offset()));
     return;
   }
 
@@ -564,7 +566,7 @@
 }
 
 void QuicStream::WriteOrBufferData(
-    QuicStringPiece data,
+    quiche::QuicheStringPiece data,
     bool fin,
     QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) {
   if (data.empty() && !fin) {
@@ -599,7 +601,7 @@
       QUIC_BUG << "Write too many data via stream " << id_;
       CloseConnectionWithDetails(
           QUIC_STREAM_LENGTH_OVERFLOW,
-          QuicStrCat("Write too many data via stream ", id_));
+          quiche::QuicheStrCat("Write too many data via stream ", id_));
       return;
     }
     send_buffer_.SaveStreamData(&iov, 1, 0, data.length());
@@ -694,7 +696,7 @@
         QUIC_BUG << "Write too many data via stream " << id_;
         CloseConnectionWithDetails(
             QUIC_STREAM_LENGTH_OVERFLOW,
-            QuicStrCat("Write too many data via stream ", id_));
+            quiche::QuicheStrCat("Write too many data via stream ", id_));
         return consumed_data;
       }
       OnDataBuffered(offset, consumed_data.bytes_consumed, nullptr);
diff --git a/quic/core/quic_stream.h b/quic/core/quic_stream.h
index c936bc7..42bdb5c 100644
--- a/quic/core/quic_stream.h
+++ b/quic/core/quic_stream.h
@@ -32,7 +32,7 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_mem_slice_span.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_optional.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_reference_counted.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.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 {
@@ -269,7 +269,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(
-      QuicStringPiece data,
+      quiche::QuicheStringPiece data,
       bool fin,
       QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener);
 
diff --git a/quic/core/quic_stream_id_manager.cc b/quic/core/quic_stream_id_manager.cc
index 0d570d2..aa5cabf 100644
--- a/quic/core/quic_stream_id_manager.cc
+++ b/quic/core/quic_stream_id_manager.cc
@@ -12,7 +12,7 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
 
 namespace quic {
 
@@ -260,10 +260,10 @@
                     << "Failed to create a new incoming stream with id:"
                     << stream_id << ", reaching MAX_STREAMS limit: "
                     << incoming_advertised_max_streams_ << ".";
-    delegate_->OnError(
-        QUIC_INVALID_STREAM_ID,
-        QuicStrCat("Stream id ", stream_id, " would exceed stream count limit ",
-                   incoming_advertised_max_streams_));
+    delegate_->OnError(QUIC_INVALID_STREAM_ID,
+                       quiche::QuicheStrCat("Stream id ", stream_id,
+                                            " would exceed stream count limit ",
+                                            incoming_advertised_max_streams_));
     return false;
   }
 
diff --git a/quic/core/quic_stream_id_manager.h b/quic/core/quic_stream_id_manager.h
index f1b6556..201f6a1 100644
--- a/quic/core/quic_stream_id_manager.h
+++ b/quic/core/quic_stream_id_manager.h
@@ -8,7 +8,7 @@
 #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/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
 
 namespace quic {
 
@@ -66,7 +66,7 @@
   // Generate a string suitable for sending to the log/etc to show current state
   // of the stream ID manager.
   std::string DebugString() const {
-    return QuicStrCat(
+    return quiche::QuicheStrCat(
         " { unidirectional_: ", unidirectional_,
         ", perspective: ", perspective(),
         ", outgoing_max_streams_: ", outgoing_max_streams_,
diff --git a/quic/core/quic_stream_id_manager_test.cc b/quic/core/quic_stream_id_manager_test.cc
index 6916ba8..00193dd 100644
--- a/quic/core/quic_stream_id_manager_test.cc
+++ b/quic/core/quic_stream_id_manager_test.cc
@@ -11,6 +11,7 @@
 #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_stream_id_manager_peer.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
 
 using testing::_;
 using testing::StrictMock;
@@ -40,7 +41,7 @@
 
 // Used by ::testing::PrintToStringParamName().
 std::string PrintToString(const TestParams& p) {
-  return QuicStrCat(
+  return quiche::QuicheStrCat(
       (p.perspective == Perspective::IS_CLIENT ? "Client" : "Server"),
       (p.is_unidirectional ? "Unidirectional" : "Bidirectional"));
 }
@@ -228,7 +229,7 @@
 TEST_P(QuicStreamIdManagerTest, IsIncomingStreamIdInValidAboveLimit) {
   QuicStreamId stream_id =
       GetNthIncomingStreamId(stream_id_manager_.incoming_actual_max_streams());
-  std::string error_details = QuicStrCat(
+  std::string error_details = quiche::QuicheStrCat(
       "Stream id ", stream_id, " would exceed stream count limit 100");
   EXPECT_CALL(delegate_, OnError(QUIC_INVALID_STREAM_ID, error_details));
   EXPECT_FALSE(stream_id_manager_.MaybeIncreaseLargestPeerStreamId(stream_id));
@@ -613,7 +614,7 @@
 TEST_P(QuicStreamIdManagerTest, ExtremeMaybeIncreaseLargestPeerStreamId) {
   QuicStreamId too_big_stream_id = GetNthIncomingStreamId(
       stream_id_manager_.incoming_actual_max_streams() + 20);
-  std::string error_details = QuicStrCat(
+  std::string error_details = quiche::QuicheStrCat(
       "Stream id ", too_big_stream_id, " would exceed stream count limit 100");
 
   EXPECT_CALL(delegate_, OnError(QUIC_INVALID_STREAM_ID, error_details));
diff --git a/quic/core/quic_stream_send_buffer_test.cc b/quic/core/quic_stream_send_buffer_test.cc
index 90fcd6e..5c1bff3 100644
--- a/quic/core/quic_stream_send_buffer_test.cc
+++ b/quic/core/quic_stream_send_buffer_test.cc
@@ -15,12 +15,13 @@
 #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(QuicStringPiece data) {
+struct iovec MakeIovec(quiche::QuicheStringPiece data) {
   struct iovec iov = {const_cast<char*>(data.data()),
                       static_cast<size_t>(data.size())};
   return iov;
@@ -35,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(QuicStringPiece(data1));
-    iov[1] = MakeIovec(QuicStringPiece(data2));
+    iov[0] = MakeIovec(quiche::QuicheStringPiece(data1));
+    iov[1] = MakeIovec(quiche::QuicheStringPiece(data2));
 
     QuicMemSlice slice1(&allocator_, 1024);
     memset(const_cast<char*>(slice1.data()), 'c', 1024);
@@ -86,23 +87,23 @@
   std::string copy4(768, 'd');
 
   ASSERT_TRUE(send_buffer_.WriteStreamData(0, 1024, &writer));
-  EXPECT_EQ(copy1, QuicStringPiece(buf, 1024));
+  EXPECT_EQ(copy1, quiche::QuicheStringPiece(buf, 1024));
   ASSERT_TRUE(send_buffer_.WriteStreamData(1024, 1024, &writer));
-  EXPECT_EQ(copy2, QuicStringPiece(buf + 1024, 1024));
+  EXPECT_EQ(copy2, quiche::QuicheStringPiece(buf + 1024, 1024));
   ASSERT_TRUE(send_buffer_.WriteStreamData(2048, 1024, &writer));
-  EXPECT_EQ(copy3, QuicStringPiece(buf + 2048, 1024));
+  EXPECT_EQ(copy3, quiche::QuicheStringPiece(buf + 2048, 1024));
   ASSERT_TRUE(send_buffer_.WriteStreamData(3072, 768, &writer));
-  EXPECT_EQ(copy4, QuicStringPiece(buf + 3072, 768));
+  EXPECT_EQ(copy4, quiche::QuicheStringPiece(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, QuicStringPiece(buf, 1024));
+  EXPECT_EQ(copy5, quiche::QuicheStringPiece(buf, 1024));
   ASSERT_TRUE(send_buffer_.WriteStreamData(2500, 1024, &writer2));
   std::string copy6 = std::string(572, 'c') + std::string(452, 'd');
-  EXPECT_EQ(copy6, QuicStringPiece(buf + 1024, 1024));
+  EXPECT_EQ(copy6, quiche::QuicheStringPiece(buf + 1024, 1024));
 
   // Invalid data copy.
   QuicDataWriter writer3(4000, buf, quiche::HOST_BYTE_ORDER);
@@ -127,12 +128,12 @@
   // Write more than one slice.
   EXPECT_EQ(0, QuicStreamSendBufferPeer::write_index(&send_buffer_));
   ASSERT_TRUE(send_buffer_.WriteStreamData(0, 1024, &writer));
-  EXPECT_EQ(copy1, QuicStringPiece(buf, 1024));
+  EXPECT_EQ(copy1, quiche::QuicheStringPiece(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, QuicStringPiece(buf + 1024, 2048));
+  EXPECT_EQ(copy1 + copy2, quiche::QuicheStringPiece(buf + 1024, 2048));
 
   // Write new data.
   if (!GetQuicRestartFlag(quic_coalesce_stream_frames_2)) {
@@ -142,10 +143,11 @@
   } else {
     EXPECT_EQ(2, QuicStreamSendBufferPeer::write_index(&send_buffer_));
     ASSERT_TRUE(send_buffer_.WriteStreamData(2048, 50, &writer));
-    EXPECT_EQ(std::string(50, 'c'), QuicStringPiece(buf + 1024 + 2048, 50));
+    EXPECT_EQ(std::string(50, 'c'),
+              quiche::QuicheStringPiece(buf + 1024 + 2048, 50));
     EXPECT_EQ(2, QuicStreamSendBufferPeer::write_index(&send_buffer_));
     ASSERT_TRUE(send_buffer_.WriteStreamData(2048, 1124, &writer));
-    EXPECT_EQ(copy3, QuicStringPiece(buf + 1024 + 2048 + 50, 1124));
+    EXPECT_EQ(copy3, quiche::QuicheStringPiece(buf + 1024 + 2048 + 50, 1124));
     EXPECT_EQ(3, QuicStreamSendBufferPeer::write_index(&send_buffer_));
   }
 }
diff --git a/quic/core/quic_stream_sequencer.cc b/quic/core/quic_stream_sequencer.cc
index d797668..a5f8599 100644
--- a/quic/core/quic_stream_sequencer.cc
+++ b/quic/core/quic_stream_sequencer.cc
@@ -19,8 +19,8 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.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 {
 
@@ -80,10 +80,10 @@
   size_t bytes_written;
   std::string error_details;
   QuicErrorCode result = buffered_frames_.OnStreamData(
-      byte_offset, QuicStringPiece(data_buffer, data_len), &bytes_written,
-      &error_details);
+      byte_offset, quiche::QuicheStringPiece(data_buffer, data_len),
+      &bytes_written, &error_details);
   if (result != QUIC_NO_ERROR) {
-    std::string details = QuicStrCat(
+    std::string details = quiche::QuicheStrCat(
         "Stream ", stream_->id(), ": ", QuicErrorCodeToString(result), ": ",
         error_details,
         "\nPeer Address: ", stream_->PeerAddressOfLatestPacket().ToString());
@@ -141,9 +141,9 @@
         quic_close_connection_and_discard_data_on_wrong_offset, 2, 3);
     stream_->CloseConnectionWithDetails(
         QUIC_STREAM_SEQUENCER_INVALID_STATE,
-        QuicStrCat("Stream ", stream_->id(),
-                   " received new final offset: ", offset,
-                   ", which is different from close offset: ", close_offset_));
+        quiche::QuicheStrCat(
+            "Stream ", stream_->id(), " received new final offset: ", offset,
+            ", which is different from close offset: ", close_offset_));
     return false;
   }
 
@@ -155,7 +155,7 @@
         quic_close_connection_and_discard_data_on_wrong_offset, 3, 3);
     stream_->CloseConnectionWithDetails(
         QUIC_STREAM_SEQUENCER_INVALID_STATE,
-        QuicStrCat(
+        quiche::QuicheStrCat(
             "Stream ", stream_->id(), " received fin with offset: ", offset,
             ", which reduces current highest offset: ", highest_offset_));
     return false;
@@ -221,7 +221,7 @@
       buffered_frames_.Readv(iov, iov_len, &bytes_read, &error_details);
   if (read_error != QUIC_NO_ERROR) {
     std::string details =
-        QuicStrCat("Stream ", stream_->id(), ": ", error_details);
+        quiche::QuicheStrCat("Stream ", stream_->id(), ": ", error_details);
     stream_->CloseConnectionWithDetails(read_error, details);
     return static_cast<int>(bytes_read);
   }
@@ -304,7 +304,7 @@
 
 const std::string QuicStreamSequencer::DebugString() const {
   // clang-format off
-  return QuicStrCat("QuicStreamSequencer:",
+  return quiche::QuicheStrCat("QuicStreamSequencer:",
                 "\n  bytes buffered: ", NumBytesBuffered(),
                 "\n  bytes consumed: ", NumBytesConsumed(),
                 "\n  has bytes to read: ", HasBytesToRead() ? "true" : "false",
diff --git a/quic/core/quic_stream_sequencer_buffer.cc b/quic/core/quic_stream_sequencer_buffer.cc
index 89a6ad7..ec3b49f 100644
--- a/quic/core/quic_stream_sequencer_buffer.cc
+++ b/quic/core/quic_stream_sequencer_buffer.cc
@@ -12,7 +12,8 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.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 {
@@ -67,7 +68,7 @@
 
 QuicErrorCode QuicStreamSequencerBuffer::OnStreamData(
     QuicStreamOffset starting_offset,
-    QuicStringPiece data,
+    quiche::QuicheStringPiece data,
     size_t* const bytes_buffered,
     std::string* error_details) {
   *bytes_buffered = 0;
@@ -134,7 +135,7 @@
 }
 
 bool QuicStreamSequencerBuffer::CopyStreamData(QuicStreamOffset offset,
-                                               QuicStringPiece data,
+                                               quiche::QuicheStringPiece data,
                                                size_t* bytes_copy,
                                                std::string* error_details) {
   *bytes_copy = 0;
@@ -168,7 +169,7 @@
     }
 
     if (write_block_num >= blocks_count_) {
-      *error_details = QuicStrCat(
+      *error_details = quiche::QuicheStrCat(
           "QuicStreamSequencerBuffer error: OnStreamData() exceed array bounds."
           "write offset = ",
           offset, " write_block_num = ", write_block_num,
@@ -193,7 +194,7 @@
                   << " length: " << bytes_to_copy;
 
     if (dest == nullptr || source == nullptr) {
-      *error_details = QuicStrCat(
+      *error_details = quiche::QuicheStrCat(
           "QuicStreamSequencerBuffer error: OnStreamData()"
           " dest == nullptr: ",
           (dest == nullptr), " source == nullptr: ", (source == nullptr),
@@ -230,7 +231,7 @@
           std::min<size_t>(bytes_available_in_block, dest_remaining);
       DCHECK_GT(bytes_to_copy, 0u);
       if (blocks_[block_idx] == nullptr || dest == nullptr) {
-        *error_details = QuicStrCat(
+        *error_details = quiche::QuicheStrCat(
             "QuicStreamSequencerBuffer error:"
             " Readv() dest == nullptr: ",
             (dest == nullptr), " blocks_[", block_idx,
@@ -255,7 +256,7 @@
       if (bytes_to_copy == bytes_available_in_block) {
         bool retire_successfully = RetireBlockIfEmpty(block_idx);
         if (!retire_successfully) {
-          *error_details = QuicStrCat(
+          *error_details = quiche::QuicheStrCat(
               "QuicStreamSequencerBuffer error: fail to retire block ",
               block_idx,
               " as the block is already released, total_bytes_read_ = ",
diff --git a/quic/core/quic_stream_sequencer_buffer.h b/quic/core/quic_stream_sequencer_buffer.h
index 406cd92..babf3c8 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');
-//  QuicStringPiece string_piece(source.data(), source.size());
+//  quiche::QuicheStringPiece string_piece(source.data(), source.size());
 //  size_t written = 0;
 //  buffer.OnStreamData(800, string_piece, GetEpollClockNow(), &written);
 //  source = std::string{800, 'b'};
-//  QuicStringPiece string_piece1(source.data(), 800);
+//  quiche::QuicheStringPiece 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));
@@ -69,7 +69,7 @@
 #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/quic/platform/api/quic_string_piece.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
 
 namespace quic {
 
@@ -106,7 +106,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,
-                             QuicStringPiece data,
+                             quiche::QuicheStringPiece data,
                              size_t* bytes_buffered,
                              std::string* error_details);
 
@@ -167,7 +167,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,
-                      QuicStringPiece data,
+                      quiche::QuicheStringPiece 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 b17dcc4..7341983 100644
--- a/quic/core/quic_stream_sequencer_buffer_test.cc
+++ b/quic/core/quic_stream_sequencer_buffer_test.cc
@@ -12,18 +12,19 @@
 #include <utility>
 
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.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 {
 
-QuicStringPiece IovecToStringPiece(iovec iov) {
-  return QuicStringPiece(reinterpret_cast<const char*>(iov.iov_base),
-                         iov.iov_len);
+quiche::QuicheStringPiece IovecToStringPiece(iovec iov) {
+  return quiche::QuicheStringPiece(reinterpret_cast<const char*>(iov.iov_base),
+                                   iov.iov_len);
 }
 
 char GetCharFromIOVecs(size_t offset, iovec iov[], size_t count) {
@@ -158,11 +159,11 @@
 
 TEST_F(QuicStreamSequencerBufferTest, OnStreamDataInvalidSource) {
   // Pass in an invalid source, expects to return error.
-  QuicStringPiece source;
-  source = QuicStringPiece(nullptr, 1024);
+  quiche::QuicheStringPiece source;
+  source = quiche::QuicheStringPiece(nullptr, 1024);
   EXPECT_THAT(buffer_->OnStreamData(800, source, &written_, &error_details_),
               IsError(QUIC_STREAM_SEQUENCER_INVALID_STATE));
-  EXPECT_EQ(0u, error_details_.find(QuicStrCat(
+  EXPECT_EQ(0u, error_details_.find(quiche::QuicheStrCat(
                     "QuicStreamSequencerBuffer error: OnStreamData() "
                     "dest == nullptr: ",
                     false, " source == nullptr: ", true)));
@@ -319,7 +320,7 @@
   QUIC_LOG(ERROR) << error_details_;
   EXPECT_EQ(100u, read);
   EXPECT_EQ(100u, buffer_->BytesConsumed());
-  EXPECT_EQ(source, QuicStringPiece(dest, read));
+  EXPECT_EQ(source, quiche::QuicheStringPiece(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());
@@ -609,7 +610,8 @@
 
   // Peek at a different offset.
   EXPECT_TRUE(buffer_->PeekRegion(100, &iov));
-  EXPECT_EQ(QuicStringPiece(source).substr(100), IovecToStringPiece(iov));
+  EXPECT_EQ(quiche::QuicheStringPiece(source).substr(100),
+            IovecToStringPiece(iov));
 
   // Peeking at or after FirstMissingByte() returns false.
   EXPECT_FALSE(buffer_->PeekRegion(kBlockSizeBytes, &iov));
@@ -636,15 +638,15 @@
   // Peek with an offset inside the first write.
   const QuicStreamOffset offset1 = 500;
   EXPECT_TRUE(buffer_->PeekRegion(offset1, &iov));
-  EXPECT_EQ(QuicStringPiece(source1).substr(offset1),
+  EXPECT_EQ(quiche::QuicheStringPiece(source1).substr(offset1),
             IovecToStringPiece(iov).substr(0, length1 - offset1));
-  EXPECT_EQ(QuicStringPiece(source2),
+  EXPECT_EQ(quiche::QuicheStringPiece(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(QuicStringPiece(source2).substr(offset2 - length1),
+  EXPECT_EQ(quiche::QuicheStringPiece(source2).substr(offset2 - length1),
             IovecToStringPiece(iov));
 
   // Peeking at or after FirstMissingByte() returns false.
@@ -669,16 +671,19 @@
   EXPECT_TRUE(buffer_->PeekRegion(0, &iov));
   EXPECT_EQ(kBlockSizeBytes, iov.iov_len);
   EXPECT_EQ(source1, IovecToStringPiece(iov).substr(0, length1));
-  EXPECT_EQ(QuicStringPiece(source2).substr(0, kBlockSizeBytes - length1),
-            IovecToStringPiece(iov).substr(length1));
+  EXPECT_EQ(
+      quiche::QuicheStringPiece(source2).substr(0, kBlockSizeBytes - length1),
+      IovecToStringPiece(iov).substr(length1));
 
   EXPECT_TRUE(buffer_->PeekRegion(length1, &iov));
-  EXPECT_EQ(QuicStringPiece(source2).substr(0, kBlockSizeBytes - length1),
-            IovecToStringPiece(iov));
+  EXPECT_EQ(
+      quiche::QuicheStringPiece(source2).substr(0, kBlockSizeBytes - length1),
+      IovecToStringPiece(iov));
 
   EXPECT_TRUE(buffer_->PeekRegion(kBlockSizeBytes, &iov));
-  EXPECT_EQ(QuicStringPiece(source2).substr(kBlockSizeBytes - length1),
-            IovecToStringPiece(iov));
+  EXPECT_EQ(
+      quiche::QuicheStringPiece(source2).substr(kBlockSizeBytes - length1),
+      IovecToStringPiece(iov));
 
   // Peeking at or after FirstMissingByte() returns false.
   EXPECT_FALSE(buffer_->PeekRegion(length1 + length2, &iov));
@@ -701,10 +706,12 @@
   EXPECT_FALSE(buffer_->PeekRegion(512, &iov));
 
   EXPECT_TRUE(buffer_->PeekRegion(1024, &iov));
-  EXPECT_EQ(QuicStringPiece(source1).substr(1024), IovecToStringPiece(iov));
+  EXPECT_EQ(quiche::QuicheStringPiece(source1).substr(1024),
+            IovecToStringPiece(iov));
 
   EXPECT_TRUE(buffer_->PeekRegion(1500, &iov));
-  EXPECT_EQ(QuicStringPiece(source1).substr(1500), IovecToStringPiece(iov));
+  EXPECT_EQ(quiche::QuicheStringPiece(source1).substr(1500),
+            IovecToStringPiece(iov));
 
   // Consume rest of block.
   EXPECT_TRUE(buffer_->MarkConsumed(kBlockSizeBytes - 1024));
@@ -718,7 +725,8 @@
   EXPECT_EQ(source2, IovecToStringPiece(iov));
 
   EXPECT_TRUE(buffer_->PeekRegion(kBlockSizeBytes + 128, &iov));
-  EXPECT_EQ(QuicStringPiece(source2).substr(128), IovecToStringPiece(iov));
+  EXPECT_EQ(quiche::QuicheStringPiece(source2).substr(128),
+            IovecToStringPiece(iov));
 
   // Peeking into consumed data still fails.
   EXPECT_FALSE(buffer_->PeekRegion(0, &iov));
@@ -925,7 +933,7 @@
     for (size_t i = 0; i < num_to_write; ++i) {
       write_buf[i] = (offset + i) % 256;
     }
-    QuicStringPiece string_piece_w(write_buf.get(), num_to_write);
+    quiche::QuicheStringPiece 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 cb6fb93..e31abc9 100644
--- a/quic/core/quic_stream_sequencer_test.cc
+++ b/quic/core/quic_stream_sequencer_test.cc
@@ -17,10 +17,10 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_expect_bug.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.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_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"
 
 using testing::_;
 using testing::AnyNumber;
@@ -123,7 +123,7 @@
     return true;
   }
 
-  bool VerifyIovec(const iovec& iovec, QuicStringPiece expected) {
+  bool VerifyIovec(const iovec& iovec, quiche::QuicheStringPiece expected) {
     if (iovec.iov_len != expected.length()) {
       QUIC_LOG(ERROR) << "Invalid length: " << iovec.iov_len << " vs "
                       << expected.length();
@@ -613,10 +613,10 @@
   // overlapping byte ranges - if they do, we close the connection.
   QuicStreamId id = 1;
 
-  QuicStreamFrame frame1(id, false, 1, QuicStringPiece("hello"));
+  QuicStreamFrame frame1(id, false, 1, quiche::QuicheStringPiece("hello"));
   sequencer_->OnStreamFrame(frame1);
 
-  QuicStreamFrame frame2(id, false, 2, QuicStringPiece("hello"));
+  QuicStreamFrame frame2(id, false, 2, quiche::QuicheStringPiece("hello"));
   EXPECT_CALL(stream_,
               CloseConnectionWithDetails(QUIC_OVERLAPPING_STREAM_DATA, _))
       .Times(0);
@@ -649,7 +649,7 @@
   EXPECT_EQ(0u, sequencer_->NumBytesBuffered());
 
   // Received [1498, 1503).
-  QuicStreamFrame frame3(id, false, 1498, QuicStringPiece("hello"));
+  QuicStreamFrame frame3(id, false, 1498, quiche::QuicheStringPiece("hello"));
   EXPECT_CALL(stream_, OnDataAvailable());
   sequencer_->OnStreamFrame(frame3);
   EXPECT_CALL(stream_, AddBytesConsumed(3));
@@ -658,7 +658,7 @@
   EXPECT_EQ(0u, sequencer_->NumBytesBuffered());
 
   // Received [1000, 1005).
-  QuicStreamFrame frame4(id, false, 1000, QuicStringPiece("hello"));
+  QuicStreamFrame frame4(id, false, 1000, quiche::QuicheStringPiece("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 9733f19..0a71787 100644
--- a/quic/core/quic_stream_test.cc
+++ b/quic/core/quic_stream_test.cc
@@ -31,6 +31,7 @@
 #include "net/third_party/quiche/src/quic/test_tools/quic_stream_peer.h"
 #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_string_piece.h"
 
 using testing::_;
 using testing::AnyNumber;
@@ -288,8 +289,9 @@
 
   // Write no data and no fin.  If we consume nothing we should not be write
   // blocked.
-  EXPECT_QUIC_BUG(stream_->WriteOrBufferData(QuicStringPiece(), false, nullptr),
-                  "");
+  EXPECT_QUIC_BUG(
+      stream_->WriteOrBufferData(quiche::QuicheStringPiece(), false, nullptr),
+      "");
   EXPECT_FALSE(HasWriteBlockedStreams());
 }
 
@@ -303,7 +305,8 @@
         return MockQuicSession::ConsumeData(stream_, stream_->id(), 1u, 0u,
                                             NO_FIN);
       }));
-  stream_->WriteOrBufferData(QuicStringPiece(kData1, 2), false, nullptr);
+  stream_->WriteOrBufferData(quiche::QuicheStringPiece(kData1, 2), false,
+                             nullptr);
   EXPECT_TRUE(session_->HasUnackedStreamData());
   ASSERT_EQ(1u, write_blocked_list_->NumBlockedStreams());
   EXPECT_EQ(1u, stream_->BufferedDataBytes());
@@ -321,7 +324,8 @@
         return MockQuicSession::ConsumeData(stream_, stream_->id(), 2u, 0u,
                                             NO_FIN);
       }));
-  stream_->WriteOrBufferData(QuicStringPiece(kData1, 2), true, nullptr);
+  stream_->WriteOrBufferData(quiche::QuicheStringPiece(kData1, 2), true,
+                             nullptr);
   EXPECT_TRUE(session_->HasUnackedStreamData());
   ASSERT_EQ(1u, write_blocked_list_->NumBlockedStreams());
 }
@@ -333,7 +337,7 @@
   // as the fin was not consumed.
   EXPECT_CALL(*session_, WritevData(stream_, kTestStreamId, _, _, _))
       .WillOnce(Return(QuicConsumedData(0, false)));
-  stream_->WriteOrBufferData(QuicStringPiece(), true, nullptr);
+  stream_->WriteOrBufferData(quiche::QuicheStringPiece(), true, nullptr);
   ASSERT_EQ(1u, write_blocked_list_->NumBlockedStreams());
 }
 
@@ -345,7 +349,8 @@
   // crash with an unknown stream.
   EXPECT_CALL(*session_, WritevData(stream_, kTestStreamId, _, _, _))
       .WillOnce(Invoke(this, &QuicStreamTest::CloseStreamOnWriteError));
-  stream_->WriteOrBufferData(QuicStringPiece(kData1, 2), false, nullptr);
+  stream_->WriteOrBufferData(quiche::QuicheStringPiece(kData1, 2), false,
+                             nullptr);
   ASSERT_EQ(0u, write_blocked_list_->NumBlockedStreams());
 }
 
@@ -440,7 +445,8 @@
         return MockQuicSession::ConsumeData(stream_, stream_->id(), 1u, 0u,
                                             NO_FIN);
       }));
-  stream_->WriteOrBufferData(QuicStringPiece(kData1, 1), false, nullptr);
+  stream_->WriteOrBufferData(quiche::QuicheStringPiece(kData1, 1), false,
+                             nullptr);
   EXPECT_TRUE(session_->HasUnackedStreamData());
   EXPECT_FALSE(fin_sent());
   EXPECT_FALSE(rst_sent());
@@ -468,7 +474,8 @@
         return MockQuicSession::ConsumeData(stream_, stream_->id(), 1u, 0u,
                                             FIN);
       }));
-  stream_->WriteOrBufferData(QuicStringPiece(kData1, 1), true, nullptr);
+  stream_->WriteOrBufferData(quiche::QuicheStringPiece(kData1, 1), true,
+                             nullptr);
   EXPECT_TRUE(fin_sent());
   EXPECT_FALSE(rst_sent());
 
@@ -659,7 +666,7 @@
             current_connection_flow_control_offset);
   QuicStreamFrame zero_length_stream_frame_with_fin(
       stream_->id(), /*fin=*/true, kByteOffsetExceedingFlowControlWindow,
-      QuicStringPiece());
+      quiche::QuicheStringPiece());
   EXPECT_EQ(0, zero_length_stream_frame_with_fin.data_length);
 
   EXPECT_CALL(*connection_, CloseConnection(_, _, _)).Times(0);
@@ -708,9 +715,10 @@
   EXPECT_CALL(*connection_, CloseConnection(QUIC_STREAM_LENGTH_OVERFLOW, _, _))
       .Times(1);
   QuicStreamFrame stream_frame(stream_->id(), false, kMaxStreamLength, ".");
-  EXPECT_QUIC_PEER_BUG(stream_->OnStreamFrame(stream_frame),
-                       QuicStrCat("Receive stream frame on stream ",
-                                  stream_->id(), " reaches max stream length"));
+  EXPECT_QUIC_PEER_BUG(
+      stream_->OnStreamFrame(stream_frame),
+      quiche::QuicheStrCat("Receive stream frame on stream ", stream_->id(),
+                           " reaches max stream length"));
 }
 
 TEST_P(QuicStreamTest, SetDrainingIncomingOutgoing) {
@@ -733,7 +741,8 @@
         return MockQuicSession::ConsumeData(stream_, stream_->id(), 2u, 0u,
                                             FIN);
       }));
-  stream_->WriteOrBufferData(QuicStringPiece(kData1, 2), true, nullptr);
+  stream_->WriteOrBufferData(quiche::QuicheStringPiece(kData1, 2), true,
+                             nullptr);
   EXPECT_TRUE(stream_->write_side_closed());
 
   EXPECT_EQ(1u, QuicSessionPeer::GetDrainingStreams(session_.get())
@@ -751,7 +760,8 @@
         return MockQuicSession::ConsumeData(stream_, stream_->id(), 2u, 0u,
                                             FIN);
       }));
-  stream_->WriteOrBufferData(QuicStringPiece(kData1, 2), true, nullptr);
+  stream_->WriteOrBufferData(quiche::QuicheStringPiece(kData1, 2), true,
+                             nullptr);
   EXPECT_TRUE(stream_->write_side_closed());
 
   EXPECT_EQ(1u, session_->GetNumOpenIncomingStreams());
diff --git a/quic/core/quic_tag.cc b/quic/core/quic_tag.cc
index 3b6ba0d..bc0e28e 100644
--- a/quic/core/quic_tag.cc
+++ b/quic/core/quic_tag.cc
@@ -10,7 +10,7 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_arraysize.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
 
 namespace quic {
 
@@ -60,8 +60,8 @@
     return std::string(chars, sizeof(chars));
   }
 
-  return QuicTextUtils::HexEncode(reinterpret_cast<const char*>(&orig_tag),
-                                  sizeof(orig_tag));
+  return quiche::QuicheTextUtils::HexEncode(
+      reinterpret_cast<const char*>(&orig_tag), sizeof(orig_tag));
 }
 
 uint32_t MakeQuicTag(char a, char b, char c, char d) {
diff --git a/quic/core/quic_time.cc b/quic/core/quic_time.cc
index ffc59da..b7a12fe 100644
--- a/quic/core/quic_time.cc
+++ b/quic/core/quic_time.cc
@@ -9,7 +9,7 @@
 #include <limits>
 #include <string>
 
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
 
 namespace quic {
 
@@ -22,12 +22,12 @@
   // For debugging purposes, always display the value with the highest precision
   // available.
   if (absolute_value > one_s && absolute_value % one_s == 0) {
-    return QuicStringPrintf("%" PRId64 "s", time_offset_ / one_s);
+    return quiche::QuicheStringPrintf("%" PRId64 "s", time_offset_ / one_s);
   }
   if (absolute_value > one_ms && absolute_value % one_ms == 0) {
-    return QuicStringPrintf("%" PRId64 "ms", time_offset_ / one_ms);
+    return quiche::QuicheStringPrintf("%" PRId64 "ms", time_offset_ / one_ms);
   }
-  return QuicStringPrintf("%" PRId64 "us", time_offset_);
+  return quiche::QuicheStringPrintf("%" PRId64 "us", time_offset_);
 }
 
 uint64_t QuicWallTime::ToUNIXSeconds() const {
diff --git a/quic/core/quic_time_wait_list_manager.cc b/quic/core/quic_time_wait_list_manager.cc
index 7058563..5131005 100644
--- a/quic/core/quic_time_wait_list_manager.cc
+++ b/quic/core/quic_time_wait_list_manager.cc
@@ -22,7 +22,8 @@
 #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/quic/platform/api/quic_text_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 {
 
@@ -220,7 +221,7 @@
                 << (ietf_quic ? "" : "!") << "ietf_quic, "
                 << (use_length_prefix ? "" : "!")
                 << "use_length_prefix:" << std::endl
-                << QuicTextUtils::HexDump(QuicStringPiece(
+                << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
                        version_packet->data(), version_packet->length()));
   SendOrQueuePacket(std::make_unique<QueuedPacket>(self_address, peer_address,
                                                    std::move(version_packet)),
@@ -244,9 +245,9 @@
         BuildIetfStatelessResetPacket(connection_id);
     QUIC_DVLOG(2) << "Dispatcher sending IETF reset packet for "
                   << connection_id << std::endl
-                  << QuicTextUtils::HexDump(
-                         QuicStringPiece(ietf_reset_packet->data(),
-                                         ietf_reset_packet->length()));
+                  << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
+                         ietf_reset_packet->data(),
+                         ietf_reset_packet->length()));
     SendOrQueuePacket(
         std::make_unique<QueuedPacket>(self_address, peer_address,
                                        std::move(ietf_reset_packet)),
@@ -264,7 +265,7 @@
   std::unique_ptr<QuicEncryptedPacket> reset_packet = BuildPublicReset(packet);
   QUIC_DVLOG(2) << "Dispatcher sending reset packet for " << connection_id
                 << std::endl
-                << QuicTextUtils::HexDump(QuicStringPiece(
+                << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
                        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_types.cc b/quic/core/quic_types.cc
index 1cee9fe..709f89a 100644
--- a/quic/core/quic_types.cc
+++ b/quic/core/quic_types.cc
@@ -7,7 +7,7 @@
 #include <cstdint>
 
 #include "net/third_party/quiche/src/quic/core/quic_error_codes.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
 
 namespace quic {
 
@@ -80,7 +80,7 @@
 
 std::string QuicIetfTransportErrorCodeString(QuicIetfTransportErrorCodes c) {
   if (static_cast<uint16_t>(c) >= 0xff00u) {
-    return QuicStrCat("Private value: ", static_cast<uint16_t>(c));
+    return quiche::QuicheStrCat("Private value: ", static_cast<uint16_t>(c));
   }
 
   switch (c) {
@@ -97,8 +97,8 @@
     RETURN_STRING_LITERAL(PROTOCOL_VIOLATION);
     RETURN_STRING_LITERAL(INVALID_MIGRATION);
     default:
-      return QuicStrCat("Unknown Transport Error Code Value: ",
-                        static_cast<uint16_t>(c));
+      return quiche::QuicheStrCat("Unknown Transport Error Code Value: ",
+                                  static_cast<uint16_t>(c));
   }
 }
 
@@ -465,7 +465,7 @@
     RETURN_STRING_LITERAL(IETF_EXTENSION_MESSAGE_NO_LENGTH_V99);
     RETURN_STRING_LITERAL(IETF_EXTENSION_MESSAGE_V99);
     default:
-      return QuicStrCat("Private value (", t, ")");
+      return quiche::QuicheStrCat("Private value (", t, ")");
   }
 }
 std::ostream& operator<<(std::ostream& os, const QuicIetfFrameType& c) {
@@ -489,7 +489,8 @@
       if (transmission_type == LAST_TRANSMISSION_TYPE + 1) {
         return "INVALID_TRANSMISSION_TYPE";
       }
-      return QuicStrCat("Unknown(", static_cast<int>(transmission_type), ")");
+      return quiche::QuicheStrCat("Unknown(",
+                                  static_cast<int>(transmission_type), ")");
       break;
   }
 }
@@ -500,7 +501,7 @@
     RETURN_STRING_LITERAL(IETF_QUIC_SHORT_HEADER_PACKET);
     RETURN_STRING_LITERAL(GOOGLE_QUIC_PACKET);
     default:
-      return QuicStrCat("Unknown (", static_cast<int>(format), ")");
+      return quiche::QuicheStrCat("Unknown (", static_cast<int>(format), ")");
   }
 }
 
@@ -513,7 +514,7 @@
     RETURN_STRING_LITERAL(RETRY);
     RETURN_STRING_LITERAL(INVALID_PACKET_TYPE);
     default:
-      return QuicStrCat("Unknown (", static_cast<int>(type), ")");
+      return quiche::QuicheStrCat("Unknown (", static_cast<int>(type), ")");
   }
 }
 
@@ -526,17 +527,19 @@
     RETURN_STRING_LITERAL(MESSAGE_STATUS_TOO_LARGE);
     RETURN_STRING_LITERAL(MESSAGE_STATUS_INTERNAL_ERROR);
     default:
-      return QuicStrCat("Unknown(", static_cast<int>(message_status), ")");
+      return quiche::QuicheStrCat("Unknown(", static_cast<int>(message_status),
+                                  ")");
       break;
   }
 }
 
 std::string MessageResultToString(MessageResult message_result) {
   if (message_result.status != MESSAGE_STATUS_SUCCESS) {
-    return QuicStrCat("{", MessageStatusToString(message_result.status), "}");
+    return quiche::QuicheStrCat(
+        "{", MessageStatusToString(message_result.status), "}");
   }
-  return QuicStrCat("{MESSAGE_STATUS_SUCCESS,id=", message_result.message_id,
-                    "}");
+  return quiche::QuicheStrCat(
+      "{MESSAGE_STATUS_SUCCESS,id=", message_result.message_id, "}");
 }
 
 std::ostream& operator<<(std::ostream& os, const MessageResult& mr) {
@@ -550,7 +553,8 @@
     RETURN_STRING_LITERAL(HANDSHAKE_DATA);
     RETURN_STRING_LITERAL(APPLICATION_DATA);
     default:
-      return QuicStrCat("Unknown(", static_cast<int>(packet_number_space), ")");
+      return quiche::QuicheStrCat("Unknown(",
+                                  static_cast<int>(packet_number_space), ")");
       break;
   }
 }
@@ -562,7 +566,7 @@
     RETURN_STRING_LITERAL(SEND_TO_WRITER);
     RETURN_STRING_LITERAL(FAILED_TO_WRITE_COALESCED_PACKET);
     default:
-      return QuicStrCat("Unknown(", static_cast<int>(fate), ")");
+      return quiche::QuicheStrCat("Unknown(", static_cast<int>(fate), ")");
   }
 }
 
@@ -573,7 +577,7 @@
     RETURN_STRING_LITERAL(ENCRYPTION_ZERO_RTT);
     RETURN_STRING_LITERAL(ENCRYPTION_FORWARD_SECURE);
     default:
-      return QuicStrCat("Unknown(", static_cast<int>(level), ")");
+      return quiche::QuicheStrCat("Unknown(", static_cast<int>(level), ")");
       break;
   }
 }
@@ -584,7 +588,7 @@
     RETURN_STRING_LITERAL(IETF_QUIC_TRANSPORT_CONNECTION_CLOSE);
     RETURN_STRING_LITERAL(IETF_QUIC_APPLICATION_CONNECTION_CLOSE);
     default:
-      return QuicStrCat("Unknown(", static_cast<int>(type), ")");
+      return quiche::QuicheStrCat("Unknown(", static_cast<int>(type), ")");
       break;
   }
 }
diff --git a/quic/core/quic_types_test.cc b/quic/core/quic_types_test.cc
index c7e4316..d238c78 100644
--- a/quic/core/quic_types_test.cc
+++ b/quic/core/quic_types_test.cc
@@ -6,8 +6,8 @@
 
 #include <cstdint>
 
-#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
 
 namespace quic {
 namespace test {
@@ -23,10 +23,10 @@
     QuicErrorCodeToIetfMapping mapping =
         QuicErrorCodeToTransportErrorCode(error);
     if (mapping.is_transport_close_) {
-      EXPECT_EQ(
-          QuicIetfTransportErrorCodeString(mapping.transport_error_code_),
-          QuicStrCat("Unknown Transport Error Code Value: ",
-                     static_cast<uint16_t>(mapping.transport_error_code_)));
+      EXPECT_EQ(QuicIetfTransportErrorCodeString(mapping.transport_error_code_),
+                quiche::QuicheStrCat(
+                    "Unknown Transport Error Code Value: ",
+                    static_cast<uint16_t>(mapping.transport_error_code_)));
     }
   }
 }
diff --git a/quic/core/quic_utils.cc b/quic/core/quic_utils.cc
index 8529dca..ef3af54 100644
--- a/quic/core/quic_utils.cc
+++ b/quic/core/quic_utils.cc
@@ -20,6 +20,7 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_prefetch.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_uint128.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 {
@@ -34,7 +35,8 @@
 #endif
 
 #ifdef QUIC_UTIL_HAS_UINT128
-QuicUint128 IncrementalHashFast(QuicUint128 uhash, QuicStringPiece data) {
+QuicUint128 IncrementalHashFast(QuicUint128 uhash,
+                                quiche::QuicheStringPiece 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;
@@ -57,7 +59,8 @@
 
 #ifndef QUIC_UTIL_HAS_UINT128
 // Slow implementation of IncrementalHash. In practice, only used by Chromium.
-QuicUint128 IncrementalHashSlow(QuicUint128 hash, QuicStringPiece data) {
+QuicUint128 IncrementalHashSlow(QuicUint128 hash,
+                                quiche::QuicheStringPiece data) {
   // kPrime = 309485009821345068724781371
   static const QuicUint128 kPrime = MakeQuicUint128(16777216, 315);
   const uint8_t* octets = reinterpret_cast<const uint8_t*>(data.data());
@@ -69,7 +72,7 @@
 }
 #endif
 
-QuicUint128 IncrementalHash(QuicUint128 hash, QuicStringPiece data) {
+QuicUint128 IncrementalHash(QuicUint128 hash, quiche::QuicheStringPiece data) {
 #ifdef QUIC_UTIL_HAS_UINT128
   return IncrementalHashFast(hash, data);
 #else
@@ -80,7 +83,7 @@
 }  // namespace
 
 // static
-uint64_t QuicUtils::FNV1a_64_Hash(QuicStringPiece data) {
+uint64_t QuicUtils::FNV1a_64_Hash(quiche::QuicheStringPiece data) {
   static const uint64_t kOffset = UINT64_C(14695981039346656037);
   static const uint64_t kPrime = UINT64_C(1099511628211);
 
@@ -97,20 +100,21 @@
 }
 
 // static
-QuicUint128 QuicUtils::FNV1a_128_Hash(QuicStringPiece data) {
-  return FNV1a_128_Hash_Three(data, QuicStringPiece(), QuicStringPiece());
+QuicUint128 QuicUtils::FNV1a_128_Hash(quiche::QuicheStringPiece data) {
+  return FNV1a_128_Hash_Three(data, quiche::QuicheStringPiece(),
+                              quiche::QuicheStringPiece());
 }
 
 // static
-QuicUint128 QuicUtils::FNV1a_128_Hash_Two(QuicStringPiece data1,
-                                          QuicStringPiece data2) {
-  return FNV1a_128_Hash_Three(data1, data2, QuicStringPiece());
+QuicUint128 QuicUtils::FNV1a_128_Hash_Two(quiche::QuicheStringPiece data1,
+                                          quiche::QuicheStringPiece data2) {
+  return FNV1a_128_Hash_Three(data1, data2, quiche::QuicheStringPiece());
 }
 
 // static
-QuicUint128 QuicUtils::FNV1a_128_Hash_Three(QuicStringPiece data1,
-                                            QuicStringPiece data2,
-                                            QuicStringPiece data3) {
+QuicUint128 QuicUtils::FNV1a_128_Hash_Three(quiche::QuicheStringPiece data1,
+                                            quiche::QuicheStringPiece data2,
+                                            quiche::QuicheStringPiece data3) {
   // The two constants are defined as part of the hash algorithm.
   // see http://www.isthe.com/chongo/tech/comp/fnv/
   // kOffset = 144066263297769815596495629667062367629
@@ -281,7 +285,7 @@
 }
 
 // static
-struct iovec QuicUtils::MakeIovec(QuicStringPiece data) {
+struct iovec QuicUtils::MakeIovec(quiche::QuicheStringPiece data) {
   struct iovec iov = {const_cast<char*>(data.data()),
                       static_cast<size_t>(data.size())};
   return iov;
@@ -478,7 +482,7 @@
 QuicConnectionId QuicUtils::CreateReplacementConnectionId(
     QuicConnectionId connection_id) {
   const uint64_t connection_id_hash = FNV1a_64_Hash(
-      QuicStringPiece(connection_id.data(), connection_id.length()));
+      quiche::QuicheStringPiece(connection_id.data(), connection_id.length()));
   return QuicConnectionId(reinterpret_cast<const char*>(&connection_id_hash),
                           sizeof(connection_id_hash));
 }
@@ -569,7 +573,7 @@
 QuicUint128 QuicUtils::GenerateStatelessResetToken(
     QuicConnectionId connection_id) {
   return FNV1a_128_Hash(
-      QuicStringPiece(connection_id.data(), connection_id.length()));
+      quiche::QuicheStringPiece(connection_id.data(), connection_id.length()));
 }
 
 // static
diff --git a/quic/core/quic_utils.h b/quic/core/quic_utils.h
index f04dace..ab8d6af 100644
--- a/quic/core/quic_utils.h
+++ b/quic/core/quic_utils.h
@@ -18,8 +18,8 @@
 #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/quic/platform/api/quic_socket_address.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.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 {
 
@@ -29,22 +29,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(QuicStringPiece data);
+  static uint64_t FNV1a_64_Hash(quiche::QuicheStringPiece 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(QuicStringPiece data);
+  static QuicUint128 FNV1a_128_Hash(quiche::QuicheStringPiece 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(QuicStringPiece data1,
-                                        QuicStringPiece data2);
+  static QuicUint128 FNV1a_128_Hash_Two(quiche::QuicheStringPiece data1,
+                                        quiche::QuicheStringPiece 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(QuicStringPiece data1,
-                                          QuicStringPiece data2,
-                                          QuicStringPiece data3);
+  static QuicUint128 FNV1a_128_Hash_Three(quiche::QuicheStringPiece data1,
+                                          quiche::QuicheStringPiece data2,
+                                          quiche::QuicheStringPiece data3);
 
   // SerializeUint128 writes the first 96 bits of |v| in little-endian form
   // to |out|.
@@ -78,7 +78,7 @@
                            char* buffer);
 
   // Creates an iovec pointing to the same data as |data|.
-  static struct iovec MakeIovec(QuicStringPiece data);
+  static struct iovec MakeIovec(quiche::QuicheStringPiece 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 362c766..2633bab 100644
--- a/quic/core/quic_utils_test.cc
+++ b/quic/core/quic_utils_test.cc
@@ -11,6 +11,7 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_arraysize.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 test {
@@ -99,7 +100,7 @@
     data[i] = i % 255;
   }
   EXPECT_EQ(IncrementalHashReference(data.data(), data.size()),
-            QuicUtils::FNV1a_128_Hash(QuicStringPiece(
+            QuicUtils::FNV1a_128_Hash(quiche::QuicheStringPiece(
                 reinterpret_cast<const char*>(data.data()), data.size())));
 }
 
diff --git a/quic/core/quic_versions.cc b/quic/core/quic_versions.cc
index b034b16..c387f3a 100644
--- a/quic/core/quic_versions.cc
+++ b/quic/core/quic_versions.cc
@@ -14,8 +14,8 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
 #include "net/third_party/quiche/src/common/platform/api/quiche_endian.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_text_utils.h"
 
 namespace quic {
 namespace {
@@ -170,7 +170,8 @@
     return UnsupportedQuicVersion();
   }
   int quic_version_number = 0;
-  if (QuicTextUtils::StringToInt(version_string, &quic_version_number) &&
+  if (quiche::QuicheTextUtils::StringToInt(version_string,
+                                           &quic_version_number) &&
       quic_version_number > 0) {
     return ParsedQuicVersion(
         PROTOCOL_QUIC_CRYPTO,
@@ -448,7 +449,8 @@
 std::string AlpnForVersion(ParsedQuicVersion parsed_version) {
   if (parsed_version.handshake_protocol == PROTOCOL_TLS1_3 &&
       parsed_version.transport_version == QUIC_VERSION_99) {
-    return "h3-" + QuicTextUtils::Uint64ToString(kQuicIetfDraftVersion);
+    return "h3-" +
+           quiche::QuicheTextUtils::Uint64ToString(kQuicIetfDraftVersion);
   }
   return "h3-" + ParsedQuicVersionToString(parsed_version);
 }
diff --git a/quic/core/tls_client_handshaker.cc b/quic/core/tls_client_handshaker.cc
index a222c20..b027004 100644
--- a/quic/core/tls_client_handshaker.cc
+++ b/quic/core/tls_client_handshaker.cc
@@ -11,7 +11,8 @@
 #include "net/third_party/quiche/src/quic/core/crypto/quic_encrypter.h"
 #include "net/third_party/quiche/src/quic/core/crypto/transport_parameters.h"
 #include "net/third_party/quiche/src/quic/core/quic_session.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_text_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 {
 
@@ -133,8 +134,8 @@
       success && (SSL_set_alpn_protos(ssl(), alpn, alpn_writer.length()) == 0);
   if (!success) {
     QUIC_BUG << "Failed to set ALPN: "
-             << QuicTextUtils::HexDump(
-                    QuicStringPiece(alpn_writer.data(), alpn_writer.length()));
+             << quiche::QuicheTextUtils::HexDump(quiche::QuicheStringPiece(
+                    alpn_writer.data(), alpn_writer.length()));
     return false;
   }
   QUIC_DLOG(INFO) << "Client using ALPN: '" << alpns[0] << "'";
@@ -415,7 +416,7 @@
 }
 
 void TlsClientHandshaker::WriteMessage(EncryptionLevel level,
-                                       QuicStringPiece data) {
+                                       quiche::QuicheStringPiece 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 319cd17..0dd2320 100644
--- a/quic/core/tls_client_handshaker.h
+++ b/quic/core/tls_client_handshaker.h
@@ -14,6 +14,7 @@
 #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 {
 
@@ -51,7 +52,8 @@
   size_t BufferSizeLimitForLevel(EncryptionLevel level) const override;
 
   // Override to drop initial keys if trying to write ENCRYPTION_HANDSHAKE data.
-  void WriteMessage(EncryptionLevel level, QuicStringPiece data) override;
+  void WriteMessage(EncryptionLevel level,
+                    quiche::QuicheStringPiece data) override;
 
   void AllowEmptyAlpnForTests() { allow_empty_alpn_for_tests_ = true; }
 
diff --git a/quic/core/tls_handshaker.cc b/quic/core/tls_handshaker.cc
index bc09994..f937325 100644
--- a/quic/core/tls_handshaker.cc
+++ b/quic/core/tls_handshaker.cc
@@ -10,6 +10,7 @@
 #include "net/third_party/quiche/src/quic/core/tls_client_handshaker.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_arraysize.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
 
 namespace quic {
 
@@ -21,7 +22,8 @@
 
 TlsHandshaker::~TlsHandshaker() {}
 
-bool TlsHandshaker::ProcessInput(QuicStringPiece input, EncryptionLevel level) {
+bool TlsHandshaker::ProcessInput(quiche::QuicheStringPiece input,
+                                 EncryptionLevel level) {
   if (parser_error_ != QUIC_NO_ERROR) {
     return false;
   }
@@ -80,7 +82,8 @@
                                 std::move(encrypter));
 }
 
-void TlsHandshaker::WriteMessage(EncryptionLevel level, QuicStringPiece data) {
+void TlsHandshaker::WriteMessage(EncryptionLevel level,
+                                 quiche::QuicheStringPiece data) {
   stream_->WriteCryptoData(level, data);
 }
 
diff --git a/quic/core/tls_handshaker.h b/quic/core/tls_handshaker.h
index 14503cd..8fb5e38 100644
--- a/quic/core/tls_handshaker.h
+++ b/quic/core/tls_handshaker.h
@@ -14,6 +14,7 @@
 #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 {
 
@@ -37,7 +38,8 @@
   ~TlsHandshaker() override;
 
   // From CryptoMessageParser
-  bool ProcessInput(QuicStringPiece input, EncryptionLevel level) override;
+  bool ProcessInput(quiche::QuicheStringPiece 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 {
@@ -82,7 +84,8 @@
   // 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, QuicStringPiece data) override;
+  void WriteMessage(EncryptionLevel level,
+                    quiche::QuicheStringPiece 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_handshaker_test.cc b/quic/core/tls_handshaker_test.cc
index a0a3b19..8d35e66 100644
--- a/quic/core/tls_handshaker_test.cc
+++ b/quic/core/tls_handshaker_test.cc
@@ -18,6 +18,7 @@
 #include "net/third_party/quiche/src/quic/test_tools/mock_quic_session_visitor.h"
 #include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
 #include "net/third_party/quiche/src/quic/tools/fake_proof_verifier.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
 
 namespace quic {
 namespace test {
@@ -37,7 +38,7 @@
       const uint16_t port,
       const std::string& server_config,
       QuicTransportVersion quic_version,
-      QuicStringPiece chlo_hash,
+      quiche::QuicheStringPiece chlo_hash,
       const std::vector<std::string>& certs,
       const std::string& cert_sct,
       const std::string& signature,
@@ -174,7 +175,8 @@
     return handshaker()->crypto_message_parser();
   }
 
-  void WriteCryptoData(EncryptionLevel level, QuicStringPiece data) override {
+  void WriteCryptoData(EncryptionLevel level,
+                       quiche::QuicheStringPiece data) override {
     pending_writes_.push_back(std::make_pair(std::string(data), level));
   }
 
@@ -334,7 +336,8 @@
         .WillByDefault(Return(std::vector<std::string>({default_alpn})));
     ON_CALL(server_session_, SelectAlpn(_))
         .WillByDefault(
-            [default_alpn](const std::vector<QuicStringPiece>& alpns) {
+            [default_alpn](
+                const std::vector<quiche::QuicheStringPiece>& alpns) {
               return std::find(alpns.begin(), alpns.end(), default_alpn);
             });
   }
@@ -493,8 +496,8 @@
   };
   server_stream_->WriteCryptoData(
       ENCRYPTION_INITIAL,
-      QuicStringPiece(bogus_handshake_message,
-                      QUIC_ARRAYSIZE(bogus_handshake_message)));
+      quiche::QuicheStringPiece(bogus_handshake_message,
+                                QUIC_ARRAYSIZE(bogus_handshake_message)));
   server_stream_->SendCryptoMessagesToPeer(client_stream_);
 
   EXPECT_FALSE(client_stream_->handshake_confirmed());
@@ -511,8 +514,8 @@
   };
   client_stream_->WriteCryptoData(
       ENCRYPTION_INITIAL,
-      QuicStringPiece(bogus_handshake_message,
-                      QUIC_ARRAYSIZE(bogus_handshake_message)));
+      quiche::QuicheStringPiece(bogus_handshake_message,
+                                QUIC_ARRAYSIZE(bogus_handshake_message)));
   client_stream_->SendCryptoMessagesToPeer(server_stream_);
 
   EXPECT_FALSE(server_stream_->handshake_confirmed());
@@ -573,9 +576,10 @@
 TEST_F(TlsHandshakerTest, ServerRequiresCustomALPN) {
   const std::string kTestAlpn = "An ALPN That Client Did Not Offer";
   EXPECT_CALL(server_session_, SelectAlpn(_))
-      .WillOnce([kTestAlpn](const std::vector<QuicStringPiece>& alpns) {
-        return std::find(alpns.cbegin(), alpns.cend(), kTestAlpn);
-      });
+      .WillOnce(
+          [kTestAlpn](const std::vector<quiche::QuicheStringPiece>& alpns) {
+            return std::find(alpns.cbegin(), alpns.cend(), kTestAlpn);
+          });
   EXPECT_CALL(*client_conn_, CloseConnection(QUIC_HANDSHAKE_FAILED,
                                              "Server did not select ALPN", _));
   EXPECT_CALL(*server_conn_,
@@ -600,13 +604,15 @@
   EXPECT_CALL(client_session_, GetAlpnsToOffer())
       .WillRepeatedly(Return(kTestAlpns));
   EXPECT_CALL(server_session_, SelectAlpn(_))
-      .WillOnce(
-          [kTestAlpn, kTestAlpns](const std::vector<QuicStringPiece>& alpns) {
-            EXPECT_THAT(alpns, ElementsAreArray(kTestAlpns));
-            return std::find(alpns.cbegin(), alpns.cend(), kTestAlpn);
-          });
-  EXPECT_CALL(client_session_, OnAlpnSelected(QuicStringPiece(kTestAlpn)));
-  EXPECT_CALL(server_session_, OnAlpnSelected(QuicStringPiece(kTestAlpn)));
+      .WillOnce([kTestAlpn, kTestAlpns](
+                    const std::vector<quiche::QuicheStringPiece>& alpns) {
+        EXPECT_THAT(alpns, 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)));
   client_stream_->CryptoConnect();
   ExchangeHandshakeMessages(client_stream_, server_stream_);
 
diff --git a/quic/core/tls_server_handshaker.cc b/quic/core/tls_server_handshaker.cc
index d9217c4..2d8cd79 100644
--- a/quic/core/tls_server_handshaker.cc
+++ b/quic/core/tls_server_handshaker.cc
@@ -13,6 +13,7 @@
 #include "net/third_party/quiche/src/quic/core/crypto/transport_parameters.h"
 #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_string_piece.h"
 
 namespace quic {
 
@@ -282,7 +283,7 @@
     size_t* out_len,
     size_t max_out,
     uint16_t sig_alg,
-    QuicStringPiece in) {
+    quiche::QuicheStringPiece in) {
   signature_callback_ = new SignatureCallback(this);
   proof_source_->ComputeTlsSignature(
       session()->connection()->self_address(), hostname_, sig_alg, in,
@@ -369,7 +370,7 @@
   CBS all_alpns;
   CBS_init(&all_alpns, in, in_len);
 
-  std::vector<QuicStringPiece> alpns;
+  std::vector<quiche::QuicheStringPiece> 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 507324b..7e65120 100644
--- a/quic/core/tls_server_handshaker.h
+++ b/quic/core/tls_server_handshaker.h
@@ -15,6 +15,7 @@
 #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 {
 
@@ -74,11 +75,12 @@
                  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,
-                                          QuicStringPiece in) 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 PrivateKeyComplete(uint8_t* out,
                                               size_t* out_len,
                                               size_t max_out) override;