Clean up QuicSpdySession destructor. The previous code was there because QuicSpdyStream uses spdy_session_ in its destructor. Since that is no longer true, QuicSpdySession destructor can be cleaned up too. Protected by quic_reloadable_flag_quic_clean_up_spdy_session_destructor. PiperOrigin-RevId: 331184986 Change-Id: I399b1093963f4da48dd0df766ceeac5966996d87
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc index 77a5a00..03eb235 100644 --- a/quic/core/http/quic_spdy_session.cc +++ b/quic/core/http/quic_spdy_session.cc
@@ -414,6 +414,12 @@ QUIC_BUG_IF(destruction_indicator_ != 123456789) << "QuicSpdyStream use after free. " << destruction_indicator_ << QuicStackTrace(); + destruction_indicator_ = 987654321; + + if (GetQuicReloadableFlag(quic_clean_up_spdy_session_destructor)) { + QUIC_RELOADABLE_FLAG_COUNT(quic_clean_up_spdy_session_destructor); + return; + } // Set the streams' session pointers in closed and dynamic stream lists // to null to avoid subsequent use of this session. for (auto& stream : *closed_streams()) { @@ -428,7 +434,6 @@ static_cast<QuicSpdyStream*>(kv.second.get())->ClearSession(); } } - destruction_indicator_ = 987654321; } void QuicSpdySession::Initialize() {
diff --git a/quic/core/http/quic_spdy_stream.h b/quic/core/http/quic_spdy_stream.h index ee15732..5a58842 100644 --- a/quic/core/http/quic_spdy_stream.h +++ b/quic/core/http/quic_spdy_stream.h
@@ -209,6 +209,8 @@ // Called when owning session is getting deleted to avoid subsequent // use of the spdy_session_ member. + // TODO(b/136274541): Remove this method once + // flag_quic_clean_up_spdy_session_destructor is deprecated. void ClearSession(); // Returns true if the sequencer has delivered the FIN, and no more body bytes