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

Side by Side Diff: net/quic/quic_headers_stream.h

Issue 1572013002: relnote: QUIC header streams support to receive PUSH_PROMISE. Protected by --quic_supports_push_pr… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@14_CL_111507546
Patch Set: Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « net/quic/quic_flags.cc ('k') | net/quic/quic_headers_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_QUIC_QUIC_HEADERS_STREAM_H_ 5 #ifndef NET_QUIC_QUIC_HEADERS_STREAM_H_
6 #define NET_QUIC_QUIC_HEADERS_STREAM_H_ 6 #define NET_QUIC_QUIC_HEADERS_STREAM_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "net/base/net_export.h" 12 #include "net/base/net_export.h"
13 #include "net/quic/quic_protocol.h" 13 #include "net/quic/quic_protocol.h"
14 #include "net/quic/reliable_quic_stream.h" 14 #include "net/quic/reliable_quic_stream.h"
15 #include "net/spdy/spdy_framer.h" 15 #include "net/spdy/spdy_framer.h"
16 16
17 namespace net { 17 namespace net {
18 18
19 class QuicSpdySession; 19 class QuicSpdySession;
20 20
21 // Headers in QUIC are sent as HTTP/2 HEADERS frames over a reserved reliable 21 // Headers in QUIC are sent as HTTP/2 HEADERS or PUSH_PROMISE frames
22 // stream with the id 3. Each endpoint (client and server) will allocate an 22 // over a reserved reliable stream with the id 3. Each endpoint
23 // instance of QuicHeadersStream to send and receive headers. 23 // (client and server) will allocate an instance of QuicHeadersStream
24 // to send and receive headers.
24 class NET_EXPORT_PRIVATE QuicHeadersStream : public ReliableQuicStream { 25 class NET_EXPORT_PRIVATE QuicHeadersStream : public ReliableQuicStream {
25 public: 26 public:
26 explicit QuicHeadersStream(QuicSpdySession* session); 27 explicit QuicHeadersStream(QuicSpdySession* session);
27 ~QuicHeadersStream() override; 28 ~QuicHeadersStream() override;
28 29
29 // Writes |headers| for |stream_id| in an HTTP/2 HEADERS frame to the peer. 30 // Writes |headers| for |stream_id| in an HTTP/2 HEADERS frame to the peer.
30 // If |fin| is true, the fin flag will be set on the HEADERS frame. Returns 31 // If |fin| is true, the fin flag will be set on the HEADERS frame. Returns
31 // the size, in bytes, of the resulting HEADERS frame. 32 // the size, in bytes, of the resulting HEADERS frame.
32 size_t WriteHeaders(QuicStreamId stream_id, 33 size_t WriteHeaders(QuicStreamId stream_id,
33 const SpdyHeaderBlock& headers, 34 const SpdyHeaderBlock& headers,
34 bool fin, 35 bool fin,
35 SpdyPriority priority, 36 SpdyPriority priority,
36 QuicAckListenerInterface* ack_listener); 37 QuicAckListenerInterface* ack_listener);
37 38
38 // Write |headers| for |promised_stream_id| on |original_stream_id| in a 39 // Write |headers| for |promised_stream_id| on |original_stream_id| in a
39 // PUSH_PROMISE frame to peer. 40 // PUSH_PROMISE frame to peer.
40 // Return the size, in bytes, of the resulting PUSH_PROMISE frame. 41 // Return the size, in bytes, of the resulting PUSH_PROMISE frame.
41 size_t WritePushPromise(QuicStreamId original_stream_id, 42 size_t WritePushPromise(QuicStreamId original_stream_id,
42 QuicStreamId promised_stream_id, 43 QuicStreamId promised_stream_id,
43 const SpdyHeaderBlock& headers, 44 const SpdyHeaderBlock& headers,
44 QuicAckListenerInterface* ack_listener); 45 QuicAckListenerInterface* ack_listener);
45 46
46 // ReliableQuicStream implementation 47 // ReliableQuicStream implementation
47 void OnDataAvailable() override; 48 void OnDataAvailable() override;
48 SpdyPriority Priority() const override; 49 SpdyPriority Priority() const override;
49 50
51 bool supports_push_promise() { return supports_push_promise_; }
52
50 private: 53 private:
51 class SpdyFramerVisitor; 54 class SpdyFramerVisitor;
52 55
53 // The following methods are called by the SimpleVisitor. 56 // The following methods are called by the SimpleVisitor.
54 57
55 // Called when a HEADERS frame has been received. 58 // Called when a HEADERS frame has been received.
56 void OnHeaders(SpdyStreamId stream_id, 59 void OnHeaders(SpdyStreamId stream_id,
57 bool has_priority, 60 bool has_priority,
58 SpdyPriority priority, 61 SpdyPriority priority,
59 bool fin); 62 bool fin);
60 63
64 // Called when a PUSH_PROMISE frame has been received.
65 void OnPushPromise(SpdyStreamId stream_id,
66 SpdyStreamId promised_stream_id,
67 bool end);
68
61 // Called when a chunk of header data is available. This is called 69 // Called when a chunk of header data is available. This is called
62 // after OnHeaders. 70 // after OnHeaders.
63 // |stream_id| The stream receiving the header data. 71 // |stream_id| The stream receiving the header data.
64 // |header_data| A buffer containing the header data chunk received. 72 // |header_data| A buffer containing the header data chunk received.
65 // |len| The length of the header data buffer. A length of zero indicates 73 // |len| The length of the header data buffer. A length of zero indicates
66 // that the header data block has been completely sent. 74 // that the header data block has been completely sent.
67 void OnControlFrameHeaderData(SpdyStreamId stream_id, 75 void OnControlFrameHeaderData(SpdyStreamId stream_id,
68 const char* header_data, 76 const char* header_data,
69 size_t len); 77 size_t len);
70 78
71 // Called when the size of the compressed frame payload is available. 79 // Called when the size of the compressed frame payload is available.
72 void OnCompressedFrameSize(size_t frame_len); 80 void OnCompressedFrameSize(size_t frame_len);
73 81
74 // Returns true if the session is still connected. 82 // Returns true if the session is still connected.
75 bool IsConnected(); 83 bool IsConnected();
76 84
77 QuicSpdySession* spdy_session_; 85 QuicSpdySession* spdy_session_;
78 86
79 // Data about the stream whose headers are being processed. 87 // Data about the stream whose headers are being processed.
80 QuicStreamId stream_id_; 88 QuicStreamId stream_id_;
89 QuicStreamId promised_stream_id_;
81 bool fin_; 90 bool fin_;
82 size_t frame_len_; 91 size_t frame_len_;
83 92
84 // Helper variable that caches the corresponding feature flag. 93 // Helper variables that cache the corresponding feature flag.
85 bool measure_headers_hol_blocking_time_; 94 bool measure_headers_hol_blocking_time_;
95 bool supports_push_promise_;
86 96
87 // Timestamps used to measure HOL blocking, these are recorded by 97 // Timestamps used to measure HOL blocking, these are recorded by
88 // the sequencer approximate to the time of arrival off the wire. 98 // the sequencer approximate to the time of arrival off the wire.
89 // |cur_max_timestamp_| tracks the most recent arrival time of 99 // |cur_max_timestamp_| tracks the most recent arrival time of
90 // frames for current (at the headers stream level) processed 100 // frames for current (at the headers stream level) processed
91 // stream's headers, and |prev_max_timestamp_| tracks the most 101 // stream's headers, and |prev_max_timestamp_| tracks the most
92 // recent arrival time of lower numbered streams. 102 // recent arrival time of lower numbered streams.
93 QuicTime cur_max_timestamp_; 103 QuicTime cur_max_timestamp_;
94 QuicTime prev_max_timestamp_; 104 QuicTime prev_max_timestamp_;
95 105
96 SpdyFramer spdy_framer_; 106 SpdyFramer spdy_framer_;
97 scoped_ptr<SpdyFramerVisitor> spdy_framer_visitor_; 107 scoped_ptr<SpdyFramerVisitor> spdy_framer_visitor_;
98 108
99 DISALLOW_COPY_AND_ASSIGN(QuicHeadersStream); 109 DISALLOW_COPY_AND_ASSIGN(QuicHeadersStream);
100 }; 110 };
101 111
102 } // namespace net 112 } // namespace net
103 113
104 #endif // NET_QUIC_QUIC_HEADERS_STREAM_H_ 114 #endif // NET_QUIC_QUIC_HEADERS_STREAM_H_
OLDNEW
« no previous file with comments | « net/quic/quic_flags.cc ('k') | net/quic/quic_headers_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698