OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SPDY_HPACK_HPACK_DECODER_H_ | 5 #ifndef NET_SPDY_HPACK_HPACK_DECODER_H_ |
6 #define NET_SPDY_HPACK_HPACK_DECODER_H_ | 6 #define NET_SPDY_HPACK_HPACK_DECODER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <memory> | 12 #include <memory> |
13 #include <string> | |
14 #include <vector> | 13 #include <vector> |
15 | 14 |
16 #include "base/macros.h" | 15 #include "base/macros.h" |
17 #include "net/base/net_export.h" | 16 #include "net/base/net_export.h" |
18 #include "net/spdy/hpack/hpack_decoder_interface.h" | 17 #include "net/spdy/hpack/hpack_decoder_interface.h" |
19 #include "net/spdy/hpack/hpack_header_table.h" | 18 #include "net/spdy/hpack/hpack_header_table.h" |
20 #include "net/spdy/hpack/hpack_input_stream.h" | 19 #include "net/spdy/hpack/hpack_input_stream.h" |
| 20 #include "net/spdy/platform/api/spdy_string.h" |
21 #include "net/spdy/platform/api/spdy_string_piece.h" | 21 #include "net/spdy/platform/api/spdy_string_piece.h" |
22 #include "net/spdy/spdy_headers_handler_interface.h" | 22 #include "net/spdy/spdy_headers_handler_interface.h" |
23 #include "net/spdy/spdy_protocol.h" | 23 #include "net/spdy/spdy_protocol.h" |
24 | 24 |
25 // An HpackDecoder decodes header sets as outlined in | 25 // An HpackDecoder decodes header sets as outlined in |
26 // http://tools.ietf.org/html/rfc7541. | 26 // http://tools.ietf.org/html/rfc7541. |
27 | 27 |
28 namespace net { | 28 namespace net { |
29 | 29 |
30 namespace test { | 30 namespace test { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 SpdyStringPiece* next_name); | 109 SpdyStringPiece* next_name); |
110 bool DecodeNextStringLiteral(HpackInputStream* input_stream, | 110 bool DecodeNextStringLiteral(HpackInputStream* input_stream, |
111 bool is_header_key, // As distinct from a value. | 111 bool is_header_key, // As distinct from a value. |
112 SpdyStringPiece* output); | 112 SpdyStringPiece* output); |
113 | 113 |
114 HpackHeaderTable header_table_; | 114 HpackHeaderTable header_table_; |
115 | 115 |
116 // TODO(jgraettinger): Buffer for headers data, and storage for the last- | 116 // TODO(jgraettinger): Buffer for headers data, and storage for the last- |
117 // processed headers block. Both will be removed with the switch to | 117 // processed headers block. Both will be removed with the switch to |
118 // SpdyHeadersHandlerInterface. | 118 // SpdyHeadersHandlerInterface. |
119 std::string headers_block_buffer_; | 119 SpdyString headers_block_buffer_; |
120 SpdyHeaderBlock decoded_block_; | 120 SpdyHeaderBlock decoded_block_; |
121 | 121 |
122 // Scratch space for storing decoded literals. | 122 // Scratch space for storing decoded literals. |
123 std::string key_buffer_, value_buffer_; | 123 SpdyString key_buffer_, value_buffer_; |
124 | 124 |
125 // If non-NULL, handles decoded headers. | 125 // If non-NULL, handles decoded headers. |
126 SpdyHeadersHandlerInterface* handler_; | 126 SpdyHeadersHandlerInterface* handler_; |
127 size_t total_header_bytes_; | 127 size_t total_header_bytes_; |
128 | 128 |
129 // How much encoded data this decoder is willing to buffer. | 129 // How much encoded data this decoder is willing to buffer. |
130 size_t max_decode_buffer_size_bytes_ = 32 * 1024; // 32 KB | 130 size_t max_decode_buffer_size_bytes_ = 32 * 1024; // 32 KB |
131 | 131 |
132 // Total bytes have been removed from headers_block_buffer_. | 132 // Total bytes have been removed from headers_block_buffer_. |
133 // Its value is updated during incremental decoding. | 133 // Its value is updated during incremental decoding. |
(...skipping 12 matching lines...) Expand all Loading... |
146 | 146 |
147 // Saved value of --chromium_http2_flag_add_hpack_incremental_decode. | 147 // Saved value of --chromium_http2_flag_add_hpack_incremental_decode. |
148 bool incremental_decode_; | 148 bool incremental_decode_; |
149 | 149 |
150 DISALLOW_COPY_AND_ASSIGN(HpackDecoder); | 150 DISALLOW_COPY_AND_ASSIGN(HpackDecoder); |
151 }; | 151 }; |
152 | 152 |
153 } // namespace net | 153 } // namespace net |
154 | 154 |
155 #endif // NET_SPDY_HPACK_HPACK_DECODER_H_ | 155 #endif // NET_SPDY_HPACK_HPACK_DECODER_H_ |
OLD | NEW |