Update V8 to version 4.7.42.
[chromium-blink-merge.git] / net / quic / quic_spdy_session.h
blobb59eb63aa0e527a8336a54261ba47197818ea786
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.
5 #ifndef NET_QUIC_QUIC_SPDY_SESSION_H_
6 #define NET_QUIC_QUIC_SPDY_SESSION_H_
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"
14 namespace net {
16 namespace test {
17 class QuicSpdySessionPeer;
18 } // namespace test
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);
25 ~QuicSpdySession() override;
27 void Initialize() override;
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);
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);
55 QuicHeadersStream* headers_stream() { return headers_stream_.get(); }
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;
64 QuicDataStream* GetSpdyDataStream(const QuicStreamId stream_id);
66 private:
67 friend class test::QuicSpdySessionPeer;
69 scoped_ptr<QuicHeadersStream> headers_stream_;
71 DISALLOW_COPY_AND_ASSIGN(QuicSpdySession);
74 } // namespace net
76 #endif // NET_QUIC_QUIC_SPDY_SESSION_H_