Move HpackStringPair struct to hpack_decoder_tables.{h,cc}.

Also remove HpackDecoderTableEntry alias.

This is a follow-up on cl/362371728.

PiperOrigin-RevId: 363277884
Change-Id: Ib84be7fb06ba2b5824bfc3e09bb24cb109833da7
diff --git a/http2/hpack/decoder/hpack_decoder_listener.h b/http2/hpack/decoder/hpack_decoder_listener.h
index 130e80b..d341025 100644
--- a/http2/hpack/decoder/hpack_decoder_listener.h
+++ b/http2/hpack/decoder/hpack_decoder_listener.h
@@ -9,7 +9,6 @@
 #define QUICHE_HTTP2_HPACK_DECODER_HPACK_DECODER_LISTENER_H_
 
 #include "absl/strings/string_view.h"
-#include "http2/hpack/hpack_string.h"
 #include "http2/hpack/http2_hpack_constants.h"
 #include "common/platform/api/quiche_export.h"
 
diff --git a/http2/hpack/decoder/hpack_decoder_state.cc b/http2/hpack/decoder/hpack_decoder_state.cc
index 6c23892..edc2167 100644
--- a/http2/hpack/decoder/hpack_decoder_state.cc
+++ b/http2/hpack/decoder/hpack_decoder_state.cc
@@ -4,7 +4,6 @@
 
 #include "http2/hpack/decoder/hpack_decoder_state.h"
 
-#include "http2/hpack/hpack_string.h"
 #include "http2/http2_constants.h"
 #include "http2/platform/api/http2_logging.h"
 #include "http2/platform/api/http2_macros.h"
diff --git a/http2/hpack/decoder/hpack_decoder_state_test.cc b/http2/hpack/decoder/hpack_decoder_state_test.cc
index 8dca4cd..43332b1 100644
--- a/http2/hpack/decoder/hpack_decoder_state_test.cc
+++ b/http2/hpack/decoder/hpack_decoder_state_test.cc
@@ -10,7 +10,6 @@
 #include <vector>
 
 #include "absl/strings/string_view.h"
-#include "http2/hpack/hpack_string.h"
 #include "http2/hpack/http2_hpack_constants.h"
 #include "http2/http2_constants.h"
 #include "http2/platform/api/http2_logging.h"
diff --git a/http2/hpack/decoder/hpack_decoder_tables.cc b/http2/hpack/decoder/hpack_decoder_tables.cc
index 06ad91e..e60dbd5 100644
--- a/http2/hpack/decoder/hpack_decoder_tables.cc
+++ b/http2/hpack/decoder/hpack_decoder_tables.cc
@@ -4,6 +4,9 @@
 
 #include "http2/hpack/decoder/hpack_decoder_tables.h"
 
+#include <utility>
+
+#include "absl/strings/str_cat.h"
 #include "http2/hpack/http2_hpack_constants.h"
 #include "http2/platform/api/http2_logging.h"
 
@@ -34,6 +37,24 @@
 
 }  // namespace
 
+HpackStringPair::HpackStringPair(std::string name, std::string value)
+    : name(std::move(name)), value(std::move(value)) {
+  HTTP2_DVLOG(3) << DebugString() << " ctor";
+}
+
+HpackStringPair::~HpackStringPair() {
+  HTTP2_DVLOG(3) << DebugString() << " dtor";
+}
+
+std::string HpackStringPair::DebugString() const {
+  return absl::StrCat("HpackStringPair(name=", name, ", value=", value, ")");
+}
+
+std::ostream& operator<<(std::ostream& os, const HpackStringPair& p) {
+  os << p.DebugString();
+  return os;
+}
+
 HpackDecoderStaticTable::HpackDecoderStaticTable(
     const std::vector<HpackStringPair>* table)
     : table_(table) {}
@@ -63,7 +84,7 @@
 // peer are valid (e.g. are lower-case, no whitespace, etc.).
 void HpackDecoderDynamicTable::Insert(const std::string& name,
                                       const std::string& value) {
-  HpackDecoderTableEntry entry(name, value);
+  HpackStringPair entry(name, value);
   size_t entry_size = entry.size();
   HTTP2_DVLOG(2) << "InsertEntry of size=" << entry_size
                  << "\n     name: " << name << "\n    value: " << value;
diff --git a/http2/hpack/decoder/hpack_decoder_tables.h b/http2/hpack/decoder/hpack_decoder_tables.h
index f79edb5..c233472 100644
--- a/http2/hpack/decoder/hpack_decoder_tables.h
+++ b/http2/hpack/decoder/hpack_decoder_tables.h
@@ -19,9 +19,10 @@
 #include <stddef.h>
 
 #include <cstdint>
+#include <iosfwd>
+#include <string>
 #include <vector>
 
-#include "http2/hpack/hpack_string.h"
 #include "http2/http2_constants.h"
 #include "http2/platform/api/http2_containers.h"
 #include "common/platform/api/quiche_export.h"
@@ -31,6 +32,23 @@
 class HpackDecoderTablesPeer;
 }  // namespace test
 
+struct QUICHE_EXPORT_PRIVATE HpackStringPair {
+  HpackStringPair(std::string name, std::string value);
+  ~HpackStringPair();
+
+  // Returns the size of a header entry with this name and value, per the RFC:
+  // http://httpwg.org/specs/rfc7541.html#calculating.table.size
+  size_t size() const { return 32 + name.size() + value.size(); }
+
+  std::string DebugString() const;
+
+  const std::string name;
+  const std::string value;
+};
+
+QUICHE_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
+                                               const HpackStringPair& p);
+
 // See http://httpwg.org/specs/rfc7541.html#static.table.definition for the
 // contents, and http://httpwg.org/specs/rfc7541.html#index.address.space for
 // info about accessing the static table.
@@ -81,8 +99,6 @@
 
  private:
   friend class test::HpackDecoderTablesPeer;
-  // TODO(bnc): Move HpackStringPair class here.
-  using HpackDecoderTableEntry = HpackStringPair;
 
   // Drop older entries to ensure the size is not greater than limit.
   void EnsureSizeNoMoreThan(size_t limit);
@@ -90,7 +106,7 @@
   // Removes the oldest dynamic table entry.
   void RemoveLastEntry();
 
-  Http2Deque<HpackDecoderTableEntry> table_;
+  Http2Deque<HpackStringPair> table_;
 
   // The last received DynamicTableSizeUpdate value, initialized to
   // SETTINGS_HEADER_TABLE_SIZE.
diff --git a/http2/hpack/decoder/hpack_decoder_test.cc b/http2/hpack/decoder/hpack_decoder_test.cc
index 11a1987..355940d 100644
--- a/http2/hpack/decoder/hpack_decoder_test.cc
+++ b/http2/hpack/decoder/hpack_decoder_test.cc
@@ -15,7 +15,6 @@
 #include "http2/hpack/decoder/hpack_decoder_listener.h"
 #include "http2/hpack/decoder/hpack_decoder_state.h"
 #include "http2/hpack/decoder/hpack_decoder_tables.h"
-#include "http2/hpack/hpack_string.h"
 #include "http2/hpack/http2_hpack_constants.h"
 #include "http2/hpack/tools/hpack_block_builder.h"
 #include "http2/hpack/tools/hpack_example.h"
diff --git a/http2/hpack/hpack_string.cc b/http2/hpack/hpack_string.cc
deleted file mode 100644
index ef7af73..0000000
--- a/http2/hpack/hpack_string.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2016 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.
-
-#include "http2/hpack/hpack_string.h"
-
-#include <utility>
-
-#include "absl/strings/str_cat.h"
-#include "http2/platform/api/http2_logging.h"
-
-namespace http2 {
-
-HpackStringPair::HpackStringPair(std::string name, std::string value)
-    : name(std::move(name)), value(std::move(value)) {
-  HTTP2_DVLOG(3) << DebugString() << " ctor";
-}
-
-HpackStringPair::~HpackStringPair() {
-  HTTP2_DVLOG(3) << DebugString() << " dtor";
-}
-
-std::string HpackStringPair::DebugString() const {
-  return absl::StrCat("HpackStringPair(name=", name, ", value=", value, ")");
-}
-
-std::ostream& operator<<(std::ostream& os, const HpackStringPair& p) {
-  os << p.DebugString();
-  return os;
-}
-
-}  // namespace http2
diff --git a/http2/hpack/hpack_string.h b/http2/hpack/hpack_string.h
deleted file mode 100644
index 51520e8..0000000
--- a/http2/hpack/hpack_string.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2016 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.
-
-#ifndef QUICHE_HTTP2_HPACK_HPACK_STRING_H_
-#define QUICHE_HTTP2_HPACK_HPACK_STRING_H_
-
-#include <stddef.h>
-
-#include <iosfwd>
-#include <string>
-
-#include "absl/strings/string_view.h"
-#include "common/platform/api/quiche_export.h"
-
-namespace http2 {
-
-struct QUICHE_EXPORT_PRIVATE HpackStringPair {
-  HpackStringPair(std::string name, std::string value);
-  ~HpackStringPair();
-
-  // Returns the size of a header entry with this name and value, per the RFC:
-  // http://httpwg.org/specs/rfc7541.html#calculating.table.size
-  size_t size() const { return 32 + name.size() + value.size(); }
-
-  std::string DebugString() const;
-
-  const std::string name;
-  const std::string value;
-};
-
-QUICHE_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
-                                               const HpackStringPair& p);
-
-}  // namespace http2
-
-#endif  // QUICHE_HTTP2_HPACK_HPACK_STRING_H_
diff --git a/spdy/core/hpack/hpack_decoder_adapter.h b/spdy/core/hpack/hpack_decoder_adapter.h
index abb0562..98d10fe 100644
--- a/spdy/core/hpack/hpack_decoder_adapter.h
+++ b/spdy/core/hpack/hpack_decoder_adapter.h
@@ -17,7 +17,6 @@
 #include "http2/hpack/decoder/hpack_decoder.h"
 #include "http2/hpack/decoder/hpack_decoder_listener.h"
 #include "http2/hpack/decoder/hpack_decoder_tables.h"
-#include "http2/hpack/hpack_string.h"
 #include "http2/hpack/http2_hpack_constants.h"
 #include "common/platform/api/quiche_export.h"
 #include "spdy/core/hpack/hpack_header_table.h"