OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_QUIC_QUIC_SPDY_SESSION_H_ |
| 6 #define NET_QUIC_QUIC_SPDY_SESSION_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "net/quic/quic_data_stream.h" |
| 11 #include "net/quic/quic_headers_stream.h" |
| 12 #include "net/quic/quic_session.h" |
| 13 |
| 14 namespace net { |
| 15 |
| 16 namespace test { |
| 17 class QuicSpdySessionPeer; |
| 18 } // namespace test |
| 19 |
| 20 // A QUIC session with a headers stream. |
| 21 class NET_EXPORT_PRIVATE QuicSpdySession : public QuicSession { |
| 22 public: |
| 23 QuicSpdySession(QuicConnection* connection, const QuicConfig& config); |
| 24 |
| 25 ~QuicSpdySession() override; |
| 26 |
| 27 void Initialize() override; |
| 28 |
| 29 // Called by |headers_stream_| when headers have been received for a stream. |
| 30 virtual void OnStreamHeaders(QuicStreamId stream_id, |
| 31 StringPiece headers_data); |
| 32 // Called by |headers_stream_| when headers with a priority have been |
| 33 // received for this stream. This method will only be called for server |
| 34 // streams. |
| 35 virtual void OnStreamHeadersPriority(QuicStreamId stream_id, |
| 36 QuicPriority priority); |
| 37 // Called by |headers_stream_| when headers have been completely received |
| 38 // for a stream. |fin| will be true if the fin flag was set in the headers |
| 39 // frame. |
| 40 virtual void OnStreamHeadersComplete(QuicStreamId stream_id, |
| 41 bool fin, |
| 42 size_t frame_len); |
| 43 |
| 44 // Writes |headers| for the stream |id| to the dedicated headers stream. |
| 45 // If |fin| is true, then no more data will be sent for the stream |id|. |
| 46 // If provided, |ack_notifier_delegate| will be registered to be notified when |
| 47 // we have seen ACKs for all packets resulting from this call. |
| 48 size_t WriteHeaders( |
| 49 QuicStreamId id, |
| 50 const SpdyHeaderBlock& headers, |
| 51 bool fin, |
| 52 QuicPriority priority, |
| 53 QuicAckNotifier::DelegateInterface* ack_notifier_delegate); |
| 54 |
| 55 QuicHeadersStream* headers_stream() { return headers_stream_.get(); } |
| 56 |
| 57 protected: |
| 58 // Override CreateIncomingDynamicStream() and CreateOutgoingDynamicStream() |
| 59 // with QuicDataStream return type to make sure that all data streams are |
| 60 // QuicDataStreams. |
| 61 QuicDataStream* CreateIncomingDynamicStream(QuicStreamId id) override = 0; |
| 62 QuicDataStream* CreateOutgoingDynamicStream() override = 0; |
| 63 |
| 64 QuicDataStream* GetSpdyDataStream(const QuicStreamId stream_id); |
| 65 |
| 66 private: |
| 67 friend class test::QuicSpdySessionPeer; |
| 68 |
| 69 scoped_ptr<QuicHeadersStream> headers_stream_; |
| 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(QuicSpdySession); |
| 72 }; |
| 73 |
| 74 } // namespace net |
| 75 |
| 76 #endif // NET_QUIC_QUIC_SPDY_SESSION_H_ |
OLD | NEW |