Add QuicSpdySession debug visitor to help with HTTP/3 debugging.
gfe-relnote: debugging only, not protected.
PiperOrigin-RevId: 269599486
Change-Id: Icc3a31fd46a42fa113e87b45d5fd28c78acd4fc0
diff --git a/quic/core/http/quic_spdy_session.h b/quic/core/http/quic_spdy_session.h
index faba099..40ad070 100644
--- a/quic/core/http/quic_spdy_session.h
+++ b/quic/core/http/quic_spdy_session.h
@@ -52,6 +52,27 @@
virtual void OnUseEntry(QuicTime::Delta elapsed) = 0;
};
+class QUIC_EXPORT_PRIVATE Http3DebugVisitor {
+ public:
+ Http3DebugVisitor();
+ Http3DebugVisitor(const Http3DebugVisitor&) = delete;
+ Http3DebugVisitor& operator=(const Http3DebugVisitor&) = delete;
+
+ virtual ~Http3DebugVisitor();
+
+ // Called when peer's control stream type is received.
+ virtual void OnPeerControlStreamCreated(QuicStreamId /*stream_id*/) = 0;
+
+ // Called when peer's QPACK encoder stream type is received.
+ virtual void OnPeerQpackEncoderStreamCreated(QuicStreamId /*stream_id*/) = 0;
+
+ // Called when peer's QPACK decoder stream type is received.
+ virtual void OnPeerQpackDecoderStreamCreated(QuicStreamId /*stream_id*/) = 0;
+
+ // Called when SETTINGS frame is received.
+ virtual void OnSettingsFrame(const SettingsFrame& /*frame*/) = 0;
+};
+
// A QUIC session for HTTP.
class QUIC_EXPORT_PRIVATE QuicSpdySession
: public QuicSession,
@@ -209,6 +230,12 @@
int32_t destruction_indicator() const { return destruction_indicator_; }
+ void set_debug_visitor(Http3DebugVisitor* debug_visitor) {
+ debug_visitor_ = debug_visitor;
+ }
+
+ Http3DebugVisitor* debug_visitor() { return debug_visitor_; }
+
protected:
// Override CreateIncomingStream(), CreateOutgoingBidirectionalStream() and
// CreateOutgoingUnidirectionalStream() with QuicSpdyStream return type to
@@ -363,6 +390,9 @@
// constructor. As long as it is not the assigned value, that would indicate
// an use-after-free.
int32_t destruction_indicator_;
+
+ // Not owned by the session.
+ Http3DebugVisitor* debug_visitor_;
};
} // namespace quic