OLD | NEW |
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_header_list.h" |
13 #include "net/quic/quic_protocol.h" | 14 #include "net/quic/quic_protocol.h" |
14 #include "net/quic/reliable_quic_stream.h" | 15 #include "net/quic/reliable_quic_stream.h" |
15 #include "net/spdy/spdy_framer.h" | 16 #include "net/spdy/spdy_framer.h" |
16 | 17 |
17 namespace net { | 18 namespace net { |
18 | 19 |
19 class QuicSpdySession; | 20 class QuicSpdySession; |
20 | 21 |
21 // Headers in QUIC are sent as HTTP/2 HEADERS or PUSH_PROMISE frames | 22 // Headers in QUIC are sent as HTTP/2 HEADERS or PUSH_PROMISE frames |
22 // over a reserved reliable stream with the id 3. Each endpoint | 23 // over a reserved reliable stream with the id 3. Each endpoint |
(...skipping 19 matching lines...) Expand all Loading... |
42 virtual size_t WritePushPromise(QuicStreamId original_stream_id, | 43 virtual size_t WritePushPromise(QuicStreamId original_stream_id, |
43 QuicStreamId promised_stream_id, | 44 QuicStreamId promised_stream_id, |
44 const SpdyHeaderBlock& headers, | 45 const SpdyHeaderBlock& headers, |
45 QuicAckListenerInterface* ack_listener); | 46 QuicAckListenerInterface* ack_listener); |
46 | 47 |
47 // ReliableQuicStream implementation | 48 // ReliableQuicStream implementation |
48 void OnDataAvailable() override; | 49 void OnDataAvailable() override; |
49 | 50 |
50 bool supports_push_promise() { return supports_push_promise_; } | 51 bool supports_push_promise() { return supports_push_promise_; } |
51 | 52 |
| 53 // Experimental: force HPACK to use static table and huffman coding |
| 54 // only. Part of exploring improvements related to headers stream |
| 55 // induced HOL blocking in QUIC. |
| 56 void DisableHpackDynamicTable(); |
| 57 |
52 private: | 58 private: |
53 class SpdyFramerVisitor; | 59 class SpdyFramerVisitor; |
54 | 60 |
55 // The following methods are called by the SimpleVisitor. | 61 // The following methods are called by the SimpleVisitor. |
56 | 62 |
57 // Called when a HEADERS frame has been received. | 63 // Called when a HEADERS frame has been received. |
58 void OnHeaders(SpdyStreamId stream_id, | 64 void OnHeaders(SpdyStreamId stream_id, |
59 bool has_priority, | 65 bool has_priority, |
60 SpdyPriority priority, | 66 SpdyPriority priority, |
61 bool fin); | 67 bool fin); |
62 | 68 |
63 // Called when a PUSH_PROMISE frame has been received. | 69 // Called when a PUSH_PROMISE frame has been received. |
64 void OnPushPromise(SpdyStreamId stream_id, | 70 void OnPushPromise(SpdyStreamId stream_id, |
65 SpdyStreamId promised_stream_id, | 71 SpdyStreamId promised_stream_id, |
66 bool end); | 72 bool end); |
67 | 73 |
68 // Called when a chunk of header data is available. This is called | 74 // Called when a chunk of header data is available. This is called |
69 // after OnHeaders. | 75 // after OnHeaders. |
70 // |stream_id| The stream receiving the header data. | 76 // |stream_id| The stream receiving the header data. |
71 // |header_data| A buffer containing the header data chunk received. | 77 // |header_data| A buffer containing the header data chunk received. |
72 // |len| The length of the header data buffer. A length of zero indicates | 78 // |len| The length of the header data buffer. A length of zero indicates |
73 // that the header data block has been completely sent. | 79 // that the header data block has been completely sent. |
74 void OnControlFrameHeaderData(SpdyStreamId stream_id, | 80 void OnControlFrameHeaderData(SpdyStreamId stream_id, |
75 const char* header_data, | 81 const char* header_data, |
76 size_t len); | 82 size_t len); |
77 | 83 |
| 84 // Called when the complete list of headers is available. |
| 85 void OnHeaderList(const QuicHeaderList& header_list); |
| 86 |
78 // Called when the size of the compressed frame payload is available. | 87 // Called when the size of the compressed frame payload is available. |
79 void OnCompressedFrameSize(size_t frame_len); | 88 void OnCompressedFrameSize(size_t frame_len); |
80 | 89 |
81 // Returns true if the session is still connected. | 90 // Returns true if the session is still connected. |
82 bool IsConnected(); | 91 bool IsConnected(); |
83 | 92 |
84 QuicSpdySession* spdy_session_; | 93 QuicSpdySession* spdy_session_; |
85 | 94 |
86 // Data about the stream whose headers are being processed. | 95 // Data about the stream whose headers are being processed. |
87 QuicStreamId stream_id_; | 96 QuicStreamId stream_id_; |
(...skipping 10 matching lines...) Expand all Loading... |
98 // |cur_max_timestamp_| tracks the most recent arrival time of | 107 // |cur_max_timestamp_| tracks the most recent arrival time of |
99 // frames for current (at the headers stream level) processed | 108 // frames for current (at the headers stream level) processed |
100 // stream's headers, and |prev_max_timestamp_| tracks the most | 109 // stream's headers, and |prev_max_timestamp_| tracks the most |
101 // recent arrival time of lower numbered streams. | 110 // recent arrival time of lower numbered streams. |
102 QuicTime cur_max_timestamp_; | 111 QuicTime cur_max_timestamp_; |
103 QuicTime prev_max_timestamp_; | 112 QuicTime prev_max_timestamp_; |
104 | 113 |
105 SpdyFramer spdy_framer_; | 114 SpdyFramer spdy_framer_; |
106 scoped_ptr<SpdyFramerVisitor> spdy_framer_visitor_; | 115 scoped_ptr<SpdyFramerVisitor> spdy_framer_visitor_; |
107 | 116 |
| 117 // Either empty, or contains the complete list of headers. |
| 118 QuicHeaderList header_list_; |
| 119 |
108 DISALLOW_COPY_AND_ASSIGN(QuicHeadersStream); | 120 DISALLOW_COPY_AND_ASSIGN(QuicHeadersStream); |
109 }; | 121 }; |
110 | 122 |
111 } // namespace net | 123 } // namespace net |
112 | 124 |
113 #endif // NET_QUIC_QUIC_HEADERS_STREAM_H_ | 125 #endif // NET_QUIC_QUIC_HEADERS_STREAM_H_ |
OLD | NEW |