Remove HttpDecoder::set_visitor().
Since all call sites have a visitor ready when HttpDecoder is instantiated, pass
that in HttpDecoder constructor instead of a set_visitor() method. Also make
HttpDecoder::visitor_ member constant. Just one fewer way to hold HttpDecoder
wrong.
While touching this area already, use |QuicMakeUnique| instead of |new| for
initializing unique_ptr<HttpDecoderVisitor> members. And add quic_ptr_util.h
include to every file touched that needs it, even if no QuicMakeUnique is added
with this CL.
Also remove unused QuicReceiveControlStreamTest::decoder_ member.
gfe-relnote: n/a, change only affects QUIC v99.
PiperOrigin-RevId: 257306155
Change-Id: I6b27704dc6001f69668a36cd6072aaa24a95b389
diff --git a/quic/core/http/http_decoder.cc b/quic/core/http/http_decoder.cc
index ffd5c74..1c4c083 100644
--- a/quic/core/http/http_decoder.cc
+++ b/quic/core/http/http_decoder.cc
@@ -29,8 +29,8 @@
} // namespace
-HttpDecoder::HttpDecoder()
- : visitor_(nullptr),
+HttpDecoder::HttpDecoder(Visitor* visitor)
+ : visitor_(visitor),
state_(STATE_READING_FRAME_TYPE),
current_frame_type_(0),
current_length_field_length_(0),
@@ -40,7 +40,9 @@
current_type_field_length_(0),
remaining_type_field_length_(0),
error_(QUIC_NO_ERROR),
- error_detail_("") {}
+ error_detail_("") {
+ DCHECK(visitor_);
+}
HttpDecoder::~HttpDecoder() {}