Index: net/quic/core/quic_session.h |
diff --git a/net/quic/core/quic_session.h b/net/quic/core/quic_session.h |
index 7425732965513c9b5c564118bee0c6cc7c8c221b..7d8818b319c8f62442696302550db5b05b1b003d 100644 |
--- a/net/quic/core/quic_session.h |
+++ b/net/quic/core/quic_session.h |
@@ -41,6 +41,22 @@ class QuicSessionPeer; |
class NET_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface { |
public: |
+ // An interface from the session to the entity owning the session. |
+ // This lets the session notify its owner (the Dispatcher) when the connection |
+ // is closed, blocked, or added/removed from the time-wait std::list. |
+ class Visitor { |
+ public: |
+ virtual ~Visitor() {} |
+ |
+ // Called when the connection is closed after the streams have been closed. |
+ virtual void OnConnectionClosed(QuicConnectionId connection_id, |
+ QuicErrorCode error, |
+ const std::string& error_details) = 0; |
+ |
+ // Called when the session has become write blocked. |
+ virtual void OnWriteBlocked(QuicBlockedWriterInterface* blocked_writer) = 0; |
+ }; |
+ |
// CryptoHandshakeEvent enumerates the events generated by a QuicCryptoStream. |
enum CryptoHandshakeEvent { |
// ENCRYPTION_FIRST_ESTABLISHED indicates that a full client hello has been |
@@ -58,8 +74,10 @@ class NET_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface { |
HANDSHAKE_CONFIRMED, |
}; |
- // Does not take ownership of |connection|. |
- QuicSession(QuicConnection* connection, const QuicConfig& config); |
+ // Does not take ownership of |connection| or |visitor|. |
+ QuicSession(QuicConnection* connection, |
+ Visitor* owner, |
+ const QuicConfig& config); |
~QuicSession() override; |
@@ -74,7 +92,7 @@ class NET_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface { |
void OnConnectionClosed(QuicErrorCode error, |
const std::string& error_details, |
ConnectionCloseSource source) override; |
- void OnWriteBlocked() override {} |
+ void OnWriteBlocked() override; |
void OnSuccessfulVersionNegotiation(const QuicVersion& version) override; |
void OnCanWrite() override; |
void OnCongestionWindowChange(QuicTime /*now*/) override {} |
@@ -337,6 +355,10 @@ class NET_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface { |
virtual void HandleRstOnValidNonexistentStream( |
const QuicRstStreamFrame& frame); |
+ Visitor* visitor() { return visitor_; } |
+ |
+ const Visitor* visitor() const { return visitor_; } |
+ |
private: |
friend class test::QuicSessionPeer; |
@@ -361,6 +383,9 @@ class NET_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface { |
QuicConnection* connection_; |
+ // May be null. |
+ Visitor* visitor_; |
+ |
ClosedStreams closed_streams_; |
QuicConfig config_; |