Add QpackHeaderTableBase accessors, remove QpackHeaderTablePeer.
This simplification will also make template magic easier in subsequent CLs.
PiperOrigin-RevId: 368302154
Change-Id: Iae2c3981fed81550d7683cbad75a10474e5234c7
diff --git a/quic/core/http/end_to_end_test.cc b/quic/core/http/end_to_end_test.cc
index 866e02c..caec403 100644
--- a/quic/core/http/end_to_end_test.cc
+++ b/quic/core/http/end_to_end_test.cc
@@ -43,7 +43,6 @@
#include "quic/test_tools/packet_reordering_writer.h"
#include "quic/test_tools/qpack/qpack_encoder_peer.h"
#include "quic/test_tools/qpack/qpack_encoder_test_utils.h"
-#include "quic/test_tools/qpack/qpack_header_table_peer.h"
#include "quic/test_tools/qpack/qpack_test_utils.h"
#include "quic/test_tools/quic_client_peer.h"
#include "quic/test_tools/quic_config_peer.h"
@@ -3357,7 +3356,7 @@
ADD_FAILURE() << "Missing header table";
return;
}
- if (QpackHeaderTablePeer::dynamic_table_capacity(header_table) > 0) {
+ if (header_table->dynamic_table_capacity() > 0) {
break;
}
}
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc
index 9787d0c..34a7ebc 100644
--- a/quic/core/http/quic_spdy_session_test.cc
+++ b/quic/core/http/quic_spdy_session_test.cc
@@ -38,7 +38,6 @@
#include "quic/platform/api/quic_map_util.h"
#include "quic/platform/api/quic_test.h"
#include "quic/test_tools/qpack/qpack_encoder_peer.h"
-#include "quic/test_tools/qpack/qpack_header_table_peer.h"
#include "quic/test_tools/qpack/qpack_test_utils.h"
#include "quic/test_tools/quic_config_peer.h"
#include "quic/test_tools/quic_connection_peer.h"
@@ -2522,16 +2521,14 @@
QpackEncoderHeaderTable* header_table =
QpackEncoderPeer::header_table(qpack_encoder);
- EXPECT_NE(512u,
- QpackHeaderTablePeer::maximum_dynamic_table_capacity(header_table));
+ EXPECT_NE(512u, header_table->maximum_dynamic_table_capacity());
EXPECT_NE(5u, session_.max_outbound_header_list_size());
EXPECT_NE(42u, QpackEncoderPeer::maximum_blocked_streams(qpack_encoder));
EXPECT_CALL(debug_visitor, OnSettingsFrameReceived(settings));
session_.OnStreamFrame(frame);
- EXPECT_EQ(512u,
- QpackHeaderTablePeer::maximum_dynamic_table_capacity(header_table));
+ EXPECT_EQ(512u, header_table->maximum_dynamic_table_capacity());
EXPECT_EQ(5u, session_.max_outbound_header_list_size());
EXPECT_EQ(42u, QpackEncoderPeer::maximum_blocked_streams(qpack_encoder));
}
diff --git a/quic/core/qpack/qpack_encoder_test.cc b/quic/core/qpack/qpack_encoder_test.cc
index 1cd965c..1c00e88 100644
--- a/quic/core/qpack/qpack_encoder_test.cc
+++ b/quic/core/qpack/qpack_encoder_test.cc
@@ -14,7 +14,6 @@
#include "quic/platform/api/quic_test.h"
#include "quic/test_tools/qpack/qpack_encoder_peer.h"
#include "quic/test_tools/qpack/qpack_encoder_test_utils.h"
-#include "quic/test_tools/qpack/qpack_header_table_peer.h"
#include "quic/test_tools/qpack/qpack_test_utils.h"
#include "common/platform/api/quiche_text_utils.h"
@@ -465,9 +464,8 @@
QpackEncoderHeaderTable* header_table =
QpackEncoderPeer::header_table(&encoder_);
- EXPECT_EQ(1024u,
- QpackHeaderTablePeer::maximum_dynamic_table_capacity(header_table));
- EXPECT_EQ(30u, QpackHeaderTablePeer::dynamic_table_capacity(header_table));
+ EXPECT_EQ(1024u, header_table->maximum_dynamic_table_capacity());
+ EXPECT_EQ(30u, header_table->dynamic_table_capacity());
}
} // namespace
diff --git a/quic/core/qpack/qpack_header_table.h b/quic/core/qpack/qpack_header_table.h
index da43263..f56e37f 100644
--- a/quic/core/qpack/qpack_header_table.h
+++ b/quic/core/qpack/qpack_header_table.h
@@ -17,12 +17,6 @@
namespace quic {
-namespace test {
-
-class QpackHeaderTablePeer;
-
-} // namespace test
-
using QpackEntry = spdy::HpackEntry;
using QpackLookupEntry = spdy::HpackLookupEntry;
constexpr size_t kQpackEntrySizeOverhead = spdy::kHpackEntrySizeOverhead;
@@ -75,12 +69,11 @@
// returning false.
bool SetMaximumDynamicTableCapacity(uint64_t maximum_dynamic_table_capacity);
- // Get |maximum_dynamic_table_capacity_|.
+ uint64_t dynamic_table_size() const { return dynamic_table_size_; }
+ uint64_t dynamic_table_capacity() const { return dynamic_table_capacity_; }
uint64_t maximum_dynamic_table_capacity() const {
return maximum_dynamic_table_capacity_;
}
-
- // Used on request streams to encode and decode Required Insert Count.
uint64_t max_entries() const { return max_entries_; }
// The number of entries inserted to the dynamic table (including ones that
@@ -127,8 +120,6 @@
DynamicEntryTable dynamic_entries_;
private:
- friend class test::QpackHeaderTablePeer;
-
// Evict entries from the dynamic table until table size is less than or equal
// to |capacity|.
void EvictDownToCapacity(uint64_t capacity);
@@ -149,7 +140,8 @@
uint64_t maximum_dynamic_table_capacity_;
// MaxEntries, see Section 3.2.2. Calculated based on
- // |maximum_dynamic_table_capacity_|.
+ // |maximum_dynamic_table_capacity_|. Used on request streams to encode and
+ // decode Required Insert Count.
uint64_t max_entries_;
// The number of entries dropped from the dynamic table.
diff --git a/quic/test_tools/qpack/qpack_header_table_peer.cc b/quic/test_tools/qpack/qpack_header_table_peer.cc
deleted file mode 100644
index 8674485..0000000
--- a/quic/test_tools/qpack/qpack_header_table_peer.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2019 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 "quic/test_tools/qpack/qpack_header_table_peer.h"
-
-#include "quic/core/qpack/qpack_header_table.h"
-
-namespace quic {
-namespace test {
-
-// static
-uint64_t QpackHeaderTablePeer::dynamic_table_capacity(
- const QpackHeaderTableBase* header_table) {
- return header_table->dynamic_table_capacity_;
-}
-
-// static
-uint64_t QpackHeaderTablePeer::maximum_dynamic_table_capacity(
- const QpackHeaderTableBase* header_table) {
- return header_table->maximum_dynamic_table_capacity_;
-}
-
-} // namespace test
-} // namespace quic
diff --git a/quic/test_tools/qpack/qpack_header_table_peer.h b/quic/test_tools/qpack/qpack_header_table_peer.h
deleted file mode 100644
index f0ded66..0000000
--- a/quic/test_tools/qpack/qpack_header_table_peer.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2019 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_QUIC_TEST_TOOLS_QPACK_QPACK_HEADER_TABLE_PEER_H_
-#define QUICHE_QUIC_TEST_TOOLS_QPACK_QPACK_HEADER_TABLE_PEER_H_
-
-#include <cstdint>
-
-namespace quic {
-
-class QpackHeaderTableBase;
-
-namespace test {
-
-class QpackHeaderTablePeer {
- public:
- QpackHeaderTablePeer() = delete;
-
- static uint64_t dynamic_table_capacity(
- const QpackHeaderTableBase* header_table);
- static uint64_t maximum_dynamic_table_capacity(
- const QpackHeaderTableBase* header_table);
-};
-
-} // namespace test
-
-} // namespace quic
-
-#endif // QUICHE_QUIC_TEST_TOOLS_QPACK_QPACK_HEADER_TABLE_PEER_H_