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_ENCODER_H_ | 5 #ifndef NET_SPDY_HPACK_ENCODER_H_ |
6 #define NET_SPDY_HPACK_ENCODER_H_ | 6 #define NET_SPDY_HPACK_ENCODER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
| 10 #include <utility> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
15 #include "net/base/net_export.h" | 16 #include "net/base/net_export.h" |
16 #include "net/spdy/hpack_header_table.h" | 17 #include "net/spdy/hpack_header_table.h" |
17 #include "net/spdy/hpack_output_stream.h" | 18 #include "net/spdy/hpack_output_stream.h" |
18 | 19 |
19 // An HpackEncoder encodes header sets as outlined in | 20 // An HpackEncoder encodes header sets as outlined in |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 76 |
76 // Emits a Huffman or identity string (whichever is smaller). | 77 // Emits a Huffman or identity string (whichever is smaller). |
77 void EmitString(base::StringPiece str); | 78 void EmitString(base::StringPiece str); |
78 | 79 |
79 void UpdateCharacterCounts(base::StringPiece str); | 80 void UpdateCharacterCounts(base::StringPiece str); |
80 | 81 |
81 // Crumbles a cookie header into sorted, de-duplicated crumbs. | 82 // Crumbles a cookie header into sorted, de-duplicated crumbs. |
82 static void CookieToCrumbs(const Representation& cookie, | 83 static void CookieToCrumbs(const Representation& cookie, |
83 Representations* crumbs_out); | 84 Representations* crumbs_out); |
84 | 85 |
| 86 // Crumbles other header field values at \0 delimiters. |
| 87 static void DecomposeRepresentation(const Representation& header_field, |
| 88 Representations* out); |
| 89 |
85 HpackHeaderTable header_table_; | 90 HpackHeaderTable header_table_; |
86 HpackOutputStream output_stream_; | 91 HpackOutputStream output_stream_; |
87 | 92 |
88 bool allow_huffman_compression_; | 93 bool allow_huffman_compression_; |
89 const HpackHuffmanTable& huffman_table_; | 94 const HpackHuffmanTable& huffman_table_; |
90 | 95 |
91 // Externally-owned, nullable storage for character counts of literals. | 96 // Externally-owned, nullable storage for character counts of literals. |
92 std::vector<size_t>* char_counts_; | 97 std::vector<size_t>* char_counts_; |
93 size_t* total_char_counts_; | 98 size_t* total_char_counts_; |
94 | 99 |
95 DISALLOW_COPY_AND_ASSIGN(HpackEncoder); | 100 DISALLOW_COPY_AND_ASSIGN(HpackEncoder); |
96 }; | 101 }; |
97 | 102 |
98 } // namespace net | 103 } // namespace net |
99 | 104 |
100 #endif // NET_SPDY_HPACK_ENCODER_H_ | 105 #endif // NET_SPDY_HPACK_ENCODER_H_ |
OLD | NEW |