summaryrefslogtreecommitdiff
path: root/chromium/net/quic/core/quic_session.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/net/quic/core/quic_session.h')
-rw-r--r--chromium/net/quic/core/quic_session.h68
1 files changed, 56 insertions, 12 deletions
diff --git a/chromium/net/quic/core/quic_session.h b/chromium/net/quic/core/quic_session.h
index cba66a07d60..403f0e58cce 100644
--- a/chromium/net/quic/core/quic_session.h
+++ b/chromium/net/quic/core/quic_session.h
@@ -52,6 +52,9 @@ class QUIC_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface {
// Called when the session has become write blocked.
virtual void OnWriteBlocked(QuicBlockedWriterInterface* blocked_writer) = 0;
+
+ // Called when the session receives reset on a stream from the peer.
+ virtual void OnRstStreamReceived(const QuicRstStreamFrame& frame) = 0;
};
// CryptoHandshakeEvent enumerates the events generated by a QuicCryptoStream.
@@ -97,6 +100,8 @@ class QUIC_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface {
// Deletes streams that are safe to be deleted now that it's safe to do so (no
// other operations are being done on the streams at this time).
void PostProcessAfterData() override;
+ // Adds a connection level WINDOW_UPDATE frame.
+ void OnAckNeedsRetransmittableFrame() override;
bool WillingAndAbleToWrite() const override;
bool HasPendingHandshake() const override;
bool HasOpenDynamicStreams() const override;
@@ -119,7 +124,7 @@ class QUIC_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface {
QuicStreamId id,
QuicIOVector iov,
QuicStreamOffset offset,
- bool fin,
+ StreamSendingState state,
QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener);
// Called by streams when they want to close the stream in both directions.
@@ -135,11 +140,11 @@ class QUIC_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface {
// Returns true if outgoing packets will be encrypted, even if the server
// hasn't confirmed the handshake yet.
- virtual bool IsEncryptionEstablished();
+ virtual bool IsEncryptionEstablished() const;
// For a client, returns true if the server has confirmed our handshake. For
// a server, returns true if a full, valid client hello has been received.
- virtual bool IsCryptoHandshakeConfirmed();
+ virtual bool IsCryptoHandshakeConfirmed() const;
// Called by the QuicCryptoStream when a new QuicConfig has been negotiated.
virtual void OnConfigNegotiated();
@@ -245,7 +250,9 @@ class QUIC_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface {
// Returns true if this stream should yield writes to another blocked stream.
bool ShouldYield(QuicStreamId stream_id);
- bool flow_control_invariant() { return flow_control_invariant_; }
+ void set_respect_goaway(bool respect_goaway) {
+ respect_goaway_ = respect_goaway;
+ }
protected:
using StaticStreamMap = QuicSmallMap<QuicStreamId, QuicStream*, 2>;
@@ -255,6 +262,28 @@ class QUIC_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface {
using ClosedStreams = std::vector<std::unique_ptr<QuicStream>>;
+ // TODO(ckrasic) - For all *DynamicStream2 below, rename after
+ // quic_reloadable_flag_quic_refactor_stream_creation is deprecated.
+
+ // Returns true if an incoming stream can be created.
+ virtual bool ShouldCreateIncomingDynamicStream2(QuicStreamId id);
+
+ // Returns true if an outgoing stream can be created.
+ virtual bool ShouldCreateOutgoingDynamicStream2();
+
+ // Creates a new stream to handle a peer-initiated stream.
+ // Caller does not own the returned stream.
+ // Returns nullptr and does error handling if the stream can not be created.
+ virtual QuicStream* MaybeCreateIncomingDynamicStream(QuicStreamId id);
+
+ // Create a new stream to handle a locally-initiated stream.
+ // Caller does not own the returned stream.
+ // Returns nullptr if max streams have already been opened.
+ virtual QuicStream* MaybeCreateOutgoingDynamicStream(SpdyPriority priority);
+
+ // TODO(ckrasic) - For all Create*DynamicStream below, remove when
+ // quic_reloadable_flag_quic_refactor_stream_creation is deprecated.
+
// Creates a new stream to handle a peer-initiated stream.
// Caller does not own the returned stream.
// Returns nullptr and does error handling if the stream can not be created.
@@ -266,7 +295,10 @@ class QUIC_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface {
virtual QuicStream* CreateOutgoingDynamicStream(SpdyPriority priority) = 0;
// Return the reserved crypto stream.
- virtual QuicCryptoStream* GetCryptoStream() = 0;
+ virtual QuicCryptoStream* GetMutableCryptoStream() = 0;
+
+ // Return the reserved crypto stream as a constant pointer.
+ virtual const QuicCryptoStream* GetCryptoStream() const = 0;
// Adds |stream| to the dynamic stream map.
virtual void ActivateStream(std::unique_ptr<QuicStream> stream);
@@ -288,15 +320,23 @@ class QUIC_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface {
// When a stream is closed locally, it may not yet know how many bytes the
// peer sent on that stream.
- // When this data arrives (via stream frame w. FIN, or RST) this method
- // is called, and correctly updates the connection level flow controller.
- void UpdateFlowControlOnFinalReceivedByteOffset(
- QuicStreamId id,
- QuicStreamOffset final_byte_offset);
+ // When this data arrives (via stream frame w. FIN, trailing headers, or RST)
+ // this method is called, and correctly updates the connection level flow
+ // controller.
+ virtual void OnFinalByteOffsetReceived(QuicStreamId id,
+ QuicStreamOffset final_byte_offset);
// Return true if given stream is peer initiated.
bool IsIncomingStream(QuicStreamId id) const;
+ // Unconditionally creates a stream. Subclasses should use this to
+ // provide streams appropriately subclassed from |QuicStream|,
+ // e.g. |QuicSpdySession::CreateStream()| creates a |QuicSpdyStream|.
+ virtual std::unique_ptr<QuicStream> CreateStream(QuicStreamId id) = 0;
+
+ // Creates a stream and activates it, owned by the session.
+ QuicStream* CreateAndActivateStream(QuicStreamId id);
+
StaticStreamMap& static_streams() { return static_stream_map_; }
const StaticStreamMap& static_streams() const { return static_stream_map_; }
@@ -353,6 +393,8 @@ class QUIC_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface {
virtual void HandleRstOnValidNonexistentStream(
const QuicRstStreamFrame& frame);
+ bool respect_goaway() const { return respect_goaway_; }
+
private:
friend class test::QuicSessionPeer;
@@ -438,8 +480,10 @@ class QUIC_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface {
// call stack of OnCanWrite.
QuicStreamId currently_writing_stream_id_;
- // Latched value of quic_reloadable_flag_quic_flow_control_invariant.
- const bool flow_control_invariant_;
+ // If this is set to false, the session will ignore peer GOAWAYs and
+ // allow the creation of outgoing streams regardless of the high
+ // chance they will fail.
+ bool respect_goaway_;
DISALLOW_COPY_AND_ASSIGN(QuicSession);
};