Update language in QpackDecoder.

Compressed field sections (formerly known as header blocks) consist of
"representations", not "instructions".  Also see
https://github.com/quicwg/base-drafts/pull/2942#discussion_r335222617.

PiperOrigin-RevId: 363015914
Change-Id: Ic113565211cc5234be9832e76c7cf025242b7a4f
diff --git a/quic/core/qpack/qpack_encoder.cc b/quic/core/qpack/qpack_encoder.cc
index de42996..5e61ee7 100644
--- a/quic/core/qpack/qpack_encoder.cc
+++ b/quic/core/qpack/qpack_encoder.cc
@@ -44,7 +44,7 @@
 QpackEncoder::~QpackEncoder() {}
 
 // static
-QpackInstructionWithValues QpackEncoder::EncodeIndexedHeaderField(
+QpackEncoder::Representation QpackEncoder::EncodeIndexedHeaderField(
     bool is_static,
     uint64_t index,
     QpackBlockingManager::IndexSet* referred_indices) {
@@ -52,11 +52,11 @@
   if (!is_static) {
     referred_indices->insert(index);
   }
-  return QpackInstructionWithValues::IndexedHeaderField(is_static, index);
+  return Representation::IndexedHeaderField(is_static, index);
 }
 
 // static
-QpackInstructionWithValues
+QpackEncoder::Representation
 QpackEncoder::EncodeLiteralHeaderFieldWithNameReference(
     bool is_static,
     uint64_t index,
@@ -66,18 +66,18 @@
   if (!is_static) {
     referred_indices->insert(index);
   }
-  return QpackInstructionWithValues::LiteralHeaderFieldNameReference(
-      is_static, index, value);
+  return Representation::LiteralHeaderFieldNameReference(is_static, index,
+                                                         value);
 }
 
 // static
-QpackInstructionWithValues QpackEncoder::EncodeLiteralHeaderField(
+QpackEncoder::Representation QpackEncoder::EncodeLiteralHeaderField(
     absl::string_view name,
     absl::string_view value) {
-  return QpackInstructionWithValues::LiteralHeaderField(name, value);
+  return Representation::LiteralHeaderField(name, value);
 }
 
-QpackEncoder::Instructions QpackEncoder::FirstPassEncode(
+QpackEncoder::Representations QpackEncoder::FirstPassEncode(
     QuicStreamId stream_id,
     const spdy::Http2HeaderBlock& header_list,
     QpackBlockingManager::IndexSet* referred_indices,
@@ -87,8 +87,8 @@
   const QuicByteCount initial_encoder_stream_buffered_byte_count =
       encoder_stream_sender_.BufferedByteCount();
 
-  Instructions instructions;
-  instructions.reserve(header_list.size());
+  Representations representations;
+  representations.reserve(header_list.size());
 
   // The index of the oldest entry that must not be evicted.
   uint64_t smallest_blocking_index =
@@ -125,7 +125,7 @@
       case QpackHeaderTable::MatchType::kNameAndValue:
         if (is_static) {
           // Refer to entry directly.
-          instructions.push_back(
+          representations.push_back(
               EncodeIndexedHeaderField(is_static, index, referred_indices));
 
           break;
@@ -136,7 +136,7 @@
           if (!blocking_allowed && index >= known_received_count) {
             blocked_stream_limit_exhausted = true;
           } else {
-            instructions.push_back(
+            representations.push_back(
                 EncodeIndexedHeaderField(is_static, index, referred_indices));
             smallest_blocking_index = std::min(smallest_blocking_index, index);
             header_table_.set_dynamic_table_entry_referenced();
@@ -157,7 +157,7 @@
                 QpackAbsoluteIndexToEncoderStreamRelativeIndex(
                     index, header_table_.inserted_entry_count()));
             uint64_t new_index = header_table_.InsertEntry(name, value);
-            instructions.push_back(EncodeIndexedHeaderField(
+            representations.push_back(EncodeIndexedHeaderField(
                 is_static, new_index, referred_indices));
             smallest_blocking_index = std::min(smallest_blocking_index, index);
             header_table_.set_dynamic_table_entry_referenced();
@@ -171,7 +171,7 @@
         // exists.
         // TODO(b/112770235): Use static entry name with literal value if
         // dynamic entry exists but cannot be used.
-        instructions.push_back(EncodeLiteralHeaderField(name, value));
+        representations.push_back(EncodeLiteralHeaderField(name, value));
 
         break;
 
@@ -185,7 +185,7 @@
             encoder_stream_sender_.SendInsertWithNameReference(is_static, index,
                                                                value);
             uint64_t new_index = header_table_.InsertEntry(name, value);
-            instructions.push_back(EncodeIndexedHeaderField(
+            representations.push_back(EncodeIndexedHeaderField(
                 /* is_static = */ false, new_index, referred_indices));
             smallest_blocking_index =
                 std::min<uint64_t>(smallest_blocking_index, new_index);
@@ -194,7 +194,7 @@
           }
 
           // Emit literal field with name reference.
-          instructions.push_back(EncodeLiteralHeaderFieldWithNameReference(
+          representations.push_back(EncodeLiteralHeaderFieldWithNameReference(
               is_static, index, value, referred_indices));
 
           break;
@@ -214,7 +214,7 @@
                   index, header_table_.inserted_entry_count()),
               value);
           uint64_t new_index = header_table_.InsertEntry(name, value);
-          instructions.push_back(
+          representations.push_back(
               EncodeIndexedHeaderField(is_static, new_index, referred_indices));
           smallest_blocking_index = std::min(smallest_blocking_index, index);
           header_table_.set_dynamic_table_entry_referenced();
@@ -225,7 +225,7 @@
         if ((blocking_allowed || index < known_received_count) &&
             index >= draining_index) {
           // If allowed, refer to entry name directly, with literal value.
-          instructions.push_back(EncodeLiteralHeaderFieldWithNameReference(
+          representations.push_back(EncodeLiteralHeaderFieldWithNameReference(
               is_static, index, value, referred_indices));
           smallest_blocking_index = std::min(smallest_blocking_index, index);
           header_table_.set_dynamic_table_entry_referenced();
@@ -238,7 +238,7 @@
         // exists.
         // TODO(b/112770235): Use static entry name with literal value if
         // dynamic entry exists but cannot be used.
-        instructions.push_back(EncodeLiteralHeaderField(name, value));
+        representations.push_back(EncodeLiteralHeaderField(name, value));
 
         break;
 
@@ -253,7 +253,7 @@
         } else {
           encoder_stream_sender_.SendInsertWithoutNameReference(name, value);
           uint64_t new_index = header_table_.InsertEntry(name, value);
-          instructions.push_back(EncodeIndexedHeaderField(
+          representations.push_back(EncodeIndexedHeaderField(
               /* is_static = */ false, new_index, referred_indices));
           smallest_blocking_index =
               std::min<uint64_t>(smallest_blocking_index, new_index);
@@ -265,7 +265,7 @@
         // TODO(b/112770235): Consider also adding to dynamic table to improve
         // compression ratio for subsequent header blocks with peers that do not
         // allow any blocked streams.
-        instructions.push_back(EncodeLiteralHeaderField(name, value));
+        representations.push_back(EncodeLiteralHeaderField(name, value));
 
         break;
     }
@@ -320,34 +320,34 @@
         "prevent referencing unacknowledged dynamic table entries.");
   }
 
-  return instructions;
+  return representations;
 }
 
 std::string QpackEncoder::SecondPassEncode(
-    QpackEncoder::Instructions instructions,
+    QpackEncoder::Representations representations,
     uint64_t required_insert_count) const {
   QpackInstructionEncoder instruction_encoder;
   std::string encoded_headers;
 
   // Header block prefix.
   instruction_encoder.Encode(
-      QpackInstructionWithValues::Prefix(QpackEncodeRequiredInsertCount(
+      Representation::Prefix(QpackEncodeRequiredInsertCount(
           required_insert_count, header_table_.max_entries())),
       &encoded_headers);
 
   const uint64_t base = required_insert_count;
 
-  for (auto& instruction : instructions) {
+  for (auto& representation : representations) {
     // Dynamic table references must be transformed from absolute to relative
     // indices.
-    if ((instruction.instruction() == QpackIndexedHeaderFieldInstruction() ||
-         instruction.instruction() ==
+    if ((representation.instruction() == QpackIndexedHeaderFieldInstruction() ||
+         representation.instruction() ==
              QpackLiteralHeaderFieldNameReferenceInstruction()) &&
-        !instruction.s_bit()) {
-      instruction.set_varint(QpackAbsoluteIndexToRequestStreamRelativeIndex(
-          instruction.varint(), base));
+        !representation.s_bit()) {
+      representation.set_varint(QpackAbsoluteIndexToRequestStreamRelativeIndex(
+          representation.varint(), base));
     }
-    instruction_encoder.Encode(instruction, &encoded_headers);
+    instruction_encoder.Encode(representation, &encoded_headers);
   }
 
   return encoded_headers;
@@ -361,8 +361,8 @@
   // that it can be passed to QpackBlockingManager.
   QpackBlockingManager::IndexSet referred_indices;
 
-  // First pass: encode into |instructions|.
-  Instructions instructions =
+  // First pass: encode into |representations|.
+  Representations representations =
       FirstPassEncode(stream_id, header_list, &referred_indices,
                       encoder_stream_sent_byte_count);
 
@@ -375,7 +375,7 @@
   }
 
   // Second pass.
-  return SecondPassEncode(std::move(instructions), required_insert_count);
+  return SecondPassEncode(std::move(representations), required_insert_count);
 }
 
 bool QpackEncoder::SetMaximumDynamicTableCapacity(
diff --git a/quic/core/qpack/qpack_encoder.h b/quic/core/qpack/qpack_encoder.h
index 3d95f6e..9d02441 100644
--- a/quic/core/qpack/qpack_encoder.h
+++ b/quic/core/qpack/qpack_encoder.h
@@ -105,27 +105,27 @@
  private:
   friend class test::QpackEncoderPeer;
 
-  using Instructions = std::vector<QpackInstructionWithValues>;
+  using Representation = QpackInstructionWithValues;
+  using Representations = std::vector<Representation>;
 
-  // Generate indexed header field instruction
+  // Generate indexed header field representation
   // and optionally update |*referred_indices|.
-  static QpackInstructionWithValues EncodeIndexedHeaderField(
+  static Representation EncodeIndexedHeaderField(
       bool is_static,
       uint64_t index,
       QpackBlockingManager::IndexSet* referred_indices);
 
-  // Generate literal header field with name reference instruction
+  // Generate literal header field with name reference representation
   // and optionally update |*referred_indices|.
-  static QpackInstructionWithValues EncodeLiteralHeaderFieldWithNameReference(
+  static Representation EncodeLiteralHeaderFieldWithNameReference(
       bool is_static,
       uint64_t index,
       absl::string_view value,
       QpackBlockingManager::IndexSet* referred_indices);
 
-  // Generate literal header field instruction.
-  static QpackInstructionWithValues EncodeLiteralHeaderField(
-      absl::string_view name,
-      absl::string_view value);
+  // Generate literal header field representation.
+  static Representation EncodeLiteralHeaderField(absl::string_view name,
+                                                 absl::string_view value);
 
   // Performs first pass of two-pass encoding: represent each header field in
   // |*header_list| as a reference to an existing entry, the name of an existing
@@ -136,17 +136,18 @@
   // sets |*encoder_stream_sent_byte_count| to the number of bytes sent on the
   // encoder stream to insert dynamic table entries.  Returns list of header
   // field representations, with all dynamic table entries referred to with
-  // absolute indices.  Returned Instructions object may have
+  // absolute indices.  Returned representation objects may have
   // absl::string_views pointing to strings owned by |*header_list|.
-  Instructions FirstPassEncode(QuicStreamId stream_id,
-                               const spdy::Http2HeaderBlock& header_list,
-                               QpackBlockingManager::IndexSet* referred_indices,
-                               QuicByteCount* encoder_stream_sent_byte_count);
+  Representations FirstPassEncode(
+      QuicStreamId stream_id,
+      const spdy::Http2HeaderBlock& header_list,
+      QpackBlockingManager::IndexSet* referred_indices,
+      QuicByteCount* encoder_stream_sent_byte_count);
 
   // Performs second pass of two-pass encoding: serializes representations
   // generated in first pass, transforming absolute indices of dynamic table
   // entries to relative indices.
-  std::string SecondPassEncode(Instructions instructions,
+  std::string SecondPassEncode(Representations representations,
                                uint64_t required_insert_count) const;
 
   DecoderStreamErrorDelegate* const decoder_stream_error_delegate_;