Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(771)

Unified Diff: net/quic/core/quic_session.h

Issue 2460163002: Refactor QuicServerSessionBase::Visitor (Closed)
Patch Set: Updated patchset dependency Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/quic_server_session_base_test.cc ('k') | net/quic/core/quic_session.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « net/quic/core/quic_server_session_base_test.cc ('k') | net/quic/core/quic_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698