Replace quiche::QuicheStringPiece with absl::string_view.

PiperOrigin-RevId: 336626553
Change-Id: I47efb54bff9f16626eba98024526e2824e937953
diff --git a/http2/hpack/huffman/hpack_huffman_decoder.cc b/http2/hpack/huffman/hpack_huffman_decoder.cc
index 3270496..d21624c 100644
--- a/http2/hpack/huffman/hpack_huffman_decoder.cc
+++ b/http2/hpack/huffman/hpack_huffman_decoder.cc
@@ -354,7 +354,7 @@
   count_ = 0;
 }
 
-size_t HuffmanBitBuffer::AppendBytes(quiche::QuicheStringPiece input) {
+size_t HuffmanBitBuffer::AppendBytes(absl::string_view input) {
   HuffmanAccumulatorBitCount free_cnt = free_count();
   size_t bytes_available = input.size();
   if (free_cnt < 8 || bytes_available == 0) {
@@ -412,8 +412,7 @@
 
 HpackHuffmanDecoder::~HpackHuffmanDecoder() = default;
 
-bool HpackHuffmanDecoder::Decode(quiche::QuicheStringPiece input,
-                                 std::string* output) {
+bool HpackHuffmanDecoder::Decode(absl::string_view input, std::string* output) {
   HTTP2_DVLOG(1) << "HpackHuffmanDecoder::Decode";
 
   // Fill bit_buffer_ from input.
diff --git a/http2/hpack/huffman/hpack_huffman_decoder.h b/http2/hpack/huffman/hpack_huffman_decoder.h
index 229bb58..fe312d8 100644
--- a/http2/hpack/huffman/hpack_huffman_decoder.h
+++ b/http2/hpack/huffman/hpack_huffman_decoder.h
@@ -18,8 +18,8 @@
 #include <iosfwd>
 #include <string>
 
+#include "absl/strings/string_view.h"
 #include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
 
 namespace http2 {
 
@@ -47,7 +47,7 @@
 
   // Add as many whole bytes to the accumulator (accumulator_) as possible,
   // returning the number of bytes added.
-  size_t AppendBytes(quiche::QuicheStringPiece input);
+  size_t AppendBytes(absl::string_view input);
 
   // Get the bits of the accumulator.
   HuffmanAccumulator value() const { return accumulator_; }
@@ -109,7 +109,7 @@
   // will contain the leading bits of the code for that symbol, but not the
   // final bits of that code.
   // Note that output should be empty, but that it is not cleared by Decode().
-  bool Decode(quiche::QuicheStringPiece input, std::string* output);
+  bool Decode(absl::string_view input, std::string* output);
 
   // Is what remains in the bit_buffer_ valid at the end of an encoded string?
   // Call after passing the the final portion of a Huffman string to Decode,
diff --git a/http2/hpack/huffman/hpack_huffman_decoder_test.cc b/http2/hpack/huffman/hpack_huffman_decoder_test.cc
index eda8c99..46dd2a5 100644
--- a/http2/hpack/huffman/hpack_huffman_decoder_test.cc
+++ b/http2/hpack/huffman/hpack_huffman_decoder_test.cc
@@ -36,7 +36,7 @@
   s.push_back('\x11');
   s.push_back('\x22');
   s.push_back('\x33');
-  quiche::QuicheStringPiece sp(s);
+  absl::string_view sp(s);
 
   HuffmanBitBuffer bb;
   sp.remove_prefix(bb.AppendBytes(sp));
@@ -85,7 +85,7 @@
   s.push_back('\x11');
   s.push_back('\x22');
   s.push_back('\x33');
-  quiche::QuicheStringPiece sp(s);
+  absl::string_view sp(s);
 
   HuffmanBitBuffer bb;
   sp.remove_prefix(bb.AppendBytes(sp));
@@ -117,7 +117,7 @@
   s.push_back('\xbb');
   s.push_back('\xcc');
   s.push_back('\xdd');
-  quiche::QuicheStringPiece sp(s);
+  absl::string_view sp(s);
 
   HuffmanBitBuffer bb;
   sp.remove_prefix(bb.AppendBytes(sp));
@@ -161,10 +161,10 @@
 
   DecodeStatus ResumeDecoding(DecodeBuffer* b) override {
     input_bytes_seen_ += b->Remaining();
-    quiche::QuicheStringPiece sp(b->cursor(), b->Remaining());
+    absl::string_view sp(b->cursor(), b->Remaining());
     if (decoder_.Decode(sp, &output_buffer_)) {
       b->AdvanceCursor(b->Remaining());
-      // Successfully decoded (or buffered) the bytes in QuicheStringPiece.
+      // Successfully decoded (or buffered) the bytes in absl::string_view.
       EXPECT_LE(input_bytes_seen_, input_bytes_expected_);
       // Have we reached the end of the encoded string?
       if (input_bytes_expected_ == input_bytes_seen_) {
diff --git a/http2/hpack/huffman/hpack_huffman_encoder.cc b/http2/hpack/huffman/hpack_huffman_encoder.cc
index ce6009a..c4492df 100644
--- a/http2/hpack/huffman/hpack_huffman_encoder.cc
+++ b/http2/hpack/huffman/hpack_huffman_encoder.cc
@@ -9,7 +9,7 @@
 
 namespace http2 {
 
-size_t HuffmanSize(quiche::QuicheStringPiece plain) {
+size_t HuffmanSize(absl::string_view plain) {
   size_t bits = 0;
   for (const uint8_t c : plain) {
     bits += HuffmanSpecTables::kCodeLengths[c];
@@ -17,7 +17,7 @@
   return (bits + 7) / 8;
 }
 
-void HuffmanEncode(quiche::QuicheStringPiece plain,
+void HuffmanEncode(absl::string_view plain,
                    size_t encoded_size,
                    std::string* huffman) {
   DCHECK(huffman != nullptr);
@@ -65,7 +65,7 @@
   }
 }
 
-void HuffmanEncodeFast(quiche::QuicheStringPiece input,
+void HuffmanEncodeFast(absl::string_view input,
                        size_t encoded_size,
                        std::string* output) {
   const size_t original_size = output->size();
diff --git a/http2/hpack/huffman/hpack_huffman_encoder.h b/http2/hpack/huffman/hpack_huffman_encoder.h
index c3ac1f6..fb79fb1 100644
--- a/http2/hpack/huffman/hpack_huffman_encoder.h
+++ b/http2/hpack/huffman/hpack_huffman_encoder.h
@@ -11,27 +11,27 @@
 #include <cstddef>  // For size_t
 #include <string>
 
+#include "absl/strings/string_view.h"
 #include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
 
 namespace http2 {
 
 // Returns the size of the Huffman encoding of |plain|, which may be greater
 // than plain.size().
-QUICHE_EXPORT_PRIVATE size_t HuffmanSize(quiche::QuicheStringPiece plain);
+QUICHE_EXPORT_PRIVATE size_t HuffmanSize(absl::string_view plain);
 
 // Encode the plain text string |plain| with the Huffman encoding defined in the
 // HPACK RFC, 7541.  |encoded_size| is used to pre-allocate storage and it
 // should be the value returned by HuffmanSize().  Appends the result to
 // |*huffman|.
-QUICHE_EXPORT_PRIVATE void HuffmanEncode(quiche::QuicheStringPiece plain,
+QUICHE_EXPORT_PRIVATE void HuffmanEncode(absl::string_view plain,
                                          size_t encoded_size,
                                          std::string* huffman);
 
 // Encode |input| with the Huffman encoding defined RFC7541, used in HPACK and
 // QPACK.  |encoded_size| must be the value returned by HuffmanSize().
 // Appends the result to the end of |*output|.
-QUICHE_EXPORT_PRIVATE void HuffmanEncodeFast(quiche::QuicheStringPiece input,
+QUICHE_EXPORT_PRIVATE void HuffmanEncodeFast(absl::string_view input,
                                              size_t encoded_size,
                                              std::string* output);
 
diff --git a/http2/hpack/huffman/hpack_huffman_encoder_test.cc b/http2/hpack/huffman/hpack_huffman_encoder_test.cc
index 9e7f7bb..7fd899b 100644
--- a/http2/hpack/huffman/hpack_huffman_encoder_test.cc
+++ b/http2/hpack/huffman/hpack_huffman_encoder_test.cc
@@ -16,7 +16,7 @@
   HuffmanEncoderTest() : use_fast_encoder_(GetParam()) {}
   virtual ~HuffmanEncoderTest() = default;
 
-  void Encode(quiche::QuicheStringPiece input,
+  void Encode(absl::string_view input,
               size_t encoded_size,
               std::string* output) {
     use_fast_encoder_ ? HuffmanEncodeFast(input, encoded_size, output)
diff --git a/http2/hpack/huffman/hpack_huffman_transcoder_test.cc b/http2/hpack/huffman/hpack_huffman_transcoder_test.cc
index e761964..087f374 100644
--- a/http2/hpack/huffman/hpack_huffman_transcoder_test.cc
+++ b/http2/hpack/huffman/hpack_huffman_transcoder_test.cc
@@ -6,13 +6,13 @@
 
 #include <stddef.h>
 
+#include "absl/strings/string_view.h"
 #include "net/third_party/quiche/src/http2/decoder/decode_buffer.h"
 #include "net/third_party/quiche/src/http2/decoder/decode_status.h"
 #include "net/third_party/quiche/src/http2/hpack/huffman/hpack_huffman_decoder.h"
 #include "net/third_party/quiche/src/http2/hpack/huffman/hpack_huffman_encoder.h"
 #include "net/third_party/quiche/src/http2/platform/api/http2_string_utils.h"
 #include "net/third_party/quiche/src/http2/tools/random_decoder_test.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
 #include "net/third_party/quiche/src/common/platform/api/quiche_test.h"
 
 using ::testing::AssertionResult;
@@ -52,10 +52,10 @@
 
   DecodeStatus ResumeDecoding(DecodeBuffer* b) override {
     input_bytes_seen_ += b->Remaining();
-    quiche::QuicheStringPiece sp(b->cursor(), b->Remaining());
+    absl::string_view sp(b->cursor(), b->Remaining());
     if (decoder_.Decode(sp, &output_buffer_)) {
       b->AdvanceCursor(b->Remaining());
-      // Successfully decoded (or buffered) the bytes in QuicheStringPiece.
+      // Successfully decoded (or buffered) the bytes in absl::string_view.
       EXPECT_LE(input_bytes_seen_, input_bytes_expected_);
       // Have we reached the end of the encoded string?
       if (input_bytes_expected_ == input_bytes_seen_) {
@@ -71,8 +71,8 @@
   }
 
   AssertionResult TranscodeAndValidateSeveralWays(
-      quiche::QuicheStringPiece plain,
-      quiche::QuicheStringPiece expected_huffman) {
+      absl::string_view plain,
+      absl::string_view expected_huffman) {
     size_t encoded_size = HuffmanSize(plain);
     std::string encoded;
     HuffmanEncode(plain, encoded_size, &encoded);
@@ -92,8 +92,7 @@
                                         ValidateDoneAndEmpty(validator));
   }
 
-  AssertionResult TranscodeAndValidateSeveralWays(
-      quiche::QuicheStringPiece plain) {
+  AssertionResult TranscodeAndValidateSeveralWays(absl::string_view plain) {
     return TranscodeAndValidateSeveralWays(plain, "");
   }