Remove QpackEncoder::DebugVisitor. This is a follow-up to cr/272023695. gfe-relnote: n/a, change to QUIC v99-only code. Protected by existing disabled gfe2_reloadable_flag_quic_enable_version_99. PiperOrigin-RevId: 272688523 Change-Id: Ie3b16f295dd87afaf1650619ff8f7ef9e38c847c
diff --git a/quic/core/qpack/qpack_encoder.cc b/quic/core/qpack/qpack_encoder.cc index 56cd17a..a3420be 100644 --- a/quic/core/qpack/qpack_encoder.cc +++ b/quic/core/qpack/qpack_encoder.cc
@@ -36,7 +36,6 @@ : decoder_stream_error_delegate_(decoder_stream_error_delegate), decoder_stream_receiver_(this), maximum_blocked_streams_(0), - debug_visitor_(nullptr), header_list_count_(0) { DCHECK(decoder_stream_error_delegate_); } @@ -112,7 +111,7 @@ const bool blocking_allowed = blocking_manager_.blocking_allowed_on_stream( stream_id, maximum_blocked_streams_); - // Track events for debug visitor. + // Track events for histograms. bool dynamic_table_insertion_blocked = false; bool blocked_stream_limit_exhausted = false; @@ -326,11 +325,6 @@ "prevent referencing unacknowledged dynamic table entries."); } - if (debug_visitor_) { - debug_visitor_->OnHeaderListEncoded(dynamic_table_insertion_blocked, - blocked_stream_limit_exhausted); - } - return instructions; }
diff --git a/quic/core/qpack/qpack_encoder.h b/quic/core/qpack/qpack_encoder.h index 6060798..be4f4e2 100644 --- a/quic/core/qpack/qpack_encoder.h +++ b/quic/core/qpack/qpack_encoder.h
@@ -47,25 +47,6 @@ virtual void OnDecoderStreamError(QuicStringPiece error_message) = 0; }; - // Interface for logging whenever dynamic table insertion is blocked and - // whenever using unacknowledged entries is not allowed because of the blocked - // stream limit. - class QUIC_EXPORT_PRIVATE DebugVisitor { - public: - virtual ~DebugVisitor() = default; - - // Called once for each header list encoded. - // |dynamic_table_insertion_blocked| it true if for any header field in this - // header list the encoder would have inserted an entry into the dynamic - // table, but could not because that insertion would have evicted a blocking - // entry. |blocked_stream_limit_exhausted| is true if for any header field - // in this header list the encoder would have referred to an unacknowledged - // entry in the dynamic table, but could not because that would have - // violated the limit on the number of blocked streams. - virtual void OnHeaderListEncoded(bool dynamic_table_insertion_blocked, - bool blocked_stream_limit_exhausted) = 0; - }; - QpackEncoder(DecoderStreamErrorDelegate* decoder_stream_error_delegate); ~QpackEncoder() override; @@ -106,10 +87,6 @@ return &decoder_stream_receiver_; } - void set_debug_visitor(DebugVisitor* debug_visitor) { - debug_visitor_ = debug_visitor; - } - private: friend class test::QpackEncoderPeer; @@ -172,8 +149,6 @@ QpackHeaderTable header_table_; uint64_t maximum_blocked_streams_; QpackBlockingManager blocking_manager_; - // TODO(bnc): Remove |debug_visitor_|. - DebugVisitor* debug_visitor_; int header_list_count_; };
diff --git a/quic/core/qpack/qpack_encoder_test.cc b/quic/core/qpack/qpack_encoder_test.cc index fc3e7f0..9850822 100644 --- a/quic/core/qpack/qpack_encoder_test.cc +++ b/quic/core/qpack/qpack_encoder_test.cc
@@ -22,15 +22,6 @@ namespace test { namespace { -class MockDebugVisitor : public QpackEncoder::DebugVisitor { - public: - virtual ~MockDebugVisitor() = default; - - MOCK_METHOD2(OnHeaderListEncoded, - void(bool dynamic_table_insertion_blocked, - bool blocked_stream_limit_exhausted)); -}; - class QpackEncoderTest : public QuicTest { protected: QpackEncoderTest() @@ -474,70 +465,6 @@ EXPECT_EQ(30u, QpackHeaderTablePeer::dynamic_table_capacity(header_table)); } -TEST_F(QpackEncoderTest, DebugVisitor) { - StrictMock<MockDebugVisitor> debug_visitor; - encoder_.set_debug_visitor(&debug_visitor); - encoder_.SetMaximumDynamicTableCapacity(QpackEntry::Size("foo", "bar")); - - // Set Dynamic Table Capacity instruction. - EXPECT_CALL(encoder_stream_sender_delegate_, WriteStreamData(_)); - encoder_.SetDynamicTableCapacity(QpackEntry::Size("foo", "bar")); - - // Static table entry only, no blocking. - spdy::SpdyHeaderBlock header_list1; - header_list1[":method"] = "GET"; - EXPECT_CALL(debug_visitor, OnHeaderListEncoded( - /* dynamic_table_insertion_blocked = */ false, - /* blocked_stream_limit_exhausted = */ false)); - encoder_.EncodeHeaderList(/* stream_id = */ 1, header_list1, nullptr); - - // Insert single dynamic table entry. First stream is allowed to be blocked. - spdy::SpdyHeaderBlock header_list2; - header_list2["foo"] = "bar"; - EXPECT_CALL(debug_visitor, OnHeaderListEncoded( - /* dynamic_table_insertion_blocked = */ false, - /* blocked_stream_limit_exhausted = */ false)); - // Add entry to dynamic table. - EXPECT_CALL(encoder_stream_sender_delegate_, WriteStreamData(_)); - encoder_.EncodeHeaderList(/* stream_id = */ 1, header_list2, nullptr); - - // First stream is blocked. Second stream is not allowed to be blocked. - // This would have been an insertion with name reference. - spdy::SpdyHeaderBlock header_list3; - header_list3["foo"] = "baz"; - EXPECT_CALL(debug_visitor, OnHeaderListEncoded( - /* dynamic_table_insertion_blocked = */ false, - /* blocked_stream_limit_exhausted = */ true)); - encoder_.EncodeHeaderList(/* stream_id = */ 2, header_list3, nullptr); - - // First stream is blocked. Second stream is not allowed to be blocked. - // This would have been an insertion without name reference. - spdy::SpdyHeaderBlock header_list4; - header_list4["bar"] = "baz"; - EXPECT_CALL(debug_visitor, OnHeaderListEncoded( - /* dynamic_table_insertion_blocked = */ false, - /* blocked_stream_limit_exhausted = */ true)); - encoder_.EncodeHeaderList(/* stream_id = */ 2, header_list4, nullptr); - - // Cannot insert into dynamic table because first entry takes up all space and - // it is blocking. This would have been an insertion with name reference. - spdy::SpdyHeaderBlock header_list5; - header_list5["foo"] = "baz"; - EXPECT_CALL(debug_visitor, OnHeaderListEncoded( - /* dynamic_table_insertion_blocked = */ true, - /* blocked_stream_limit_exhausted = */ false)); - encoder_.EncodeHeaderList(/* stream_id = */ 1, header_list5, nullptr); - - // Cannot insert into dynamic table because first entry takes up all space and - // it is blocking. This would have been an insertion without name reference. - spdy::SpdyHeaderBlock header_list6; - header_list6["bar"] = "baz"; - EXPECT_CALL(debug_visitor, OnHeaderListEncoded( - /* dynamic_table_insertion_blocked = */ true, - /* blocked_stream_limit_exhausted = */ false)); - encoder_.EncodeHeaderList(/* stream_id = */ 1, header_list6, nullptr); -} - } // namespace } // namespace test } // namespace quic