| 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_HUFFMAN_TABLE_H_ | 5 #ifndef NET_SPDY_HPACK_HPACK_HUFFMAN_TABLE_H_ |
| 6 #define NET_SPDY_HPACK_HPACK_HUFFMAN_TABLE_H_ | 6 #define NET_SPDY_HPACK_HPACK_HUFFMAN_TABLE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <cstddef> | 10 #include <cstddef> |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // caller's responsibility to ensure |out| has reserved a sufficient buffer to | 87 // caller's responsibility to ensure |out| has reserved a sufficient buffer to |
| 88 // hold decoded output. GenericDecodeString() halts when |in| runs out of | 88 // hold decoded output. GenericDecodeString() halts when |in| runs out of |
| 89 // input, in which case true is returned. It also halts (returning false) if | 89 // input, in which case true is returned. It also halts (returning false) if |
| 90 // an invalid Huffman code prefix is read, or if |out_capacity| would | 90 // an invalid Huffman code prefix is read, or if |out_capacity| would |
| 91 // otherwise be overflowed. | 91 // otherwise be overflowed. |
| 92 // DEPRECATED: HpackHuffmanDecoder is now used for decoding strings encoded | 92 // DEPRECATED: HpackHuffmanDecoder is now used for decoding strings encoded |
| 93 // according to the Huffman Table in the HPACK spec. | 93 // according to the Huffman Table in the HPACK spec. |
| 94 bool GenericDecodeString(HpackInputStream* in, | 94 bool GenericDecodeString(HpackInputStream* in, |
| 95 std::string* out) const; | 95 std::string* out) const; |
| 96 | 96 |
| 97 // Returns the estimate of dynamically allocated memory in bytes. |
| 98 size_t EstimateMemoryUsage() const; |
| 99 |
| 97 private: | 100 private: |
| 98 // Expects symbols ordered on length & ID ascending. | 101 // Expects symbols ordered on length & ID ascending. |
| 99 void BuildDecodeTables(const std::vector<Symbol>& symbols); | 102 void BuildDecodeTables(const std::vector<Symbol>& symbols); |
| 100 | 103 |
| 101 // Expects symbols ordered on ID ascending. | 104 // Expects symbols ordered on ID ascending. |
| 102 void BuildEncodeTable(const std::vector<Symbol>& symbols); | 105 void BuildEncodeTable(const std::vector<Symbol>& symbols); |
| 103 | 106 |
| 104 // Adds a new DecodeTable with the argument prefix & indexed length. | 107 // Adds a new DecodeTable with the argument prefix & indexed length. |
| 105 // Returns the new table index. | 108 // Returns the new table index. |
| 106 uint8_t AddDecodeTable(uint8_t prefix, uint8_t indexed); | 109 uint8_t AddDecodeTable(uint8_t prefix, uint8_t indexed); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 123 uint8_t pad_bits_; | 126 uint8_t pad_bits_; |
| 124 | 127 |
| 125 // If initialization fails, preserve the symbol ID which failed validation | 128 // If initialization fails, preserve the symbol ID which failed validation |
| 126 // for examination in tests. | 129 // for examination in tests. |
| 127 uint16_t failed_symbol_id_; | 130 uint16_t failed_symbol_id_; |
| 128 }; | 131 }; |
| 129 | 132 |
| 130 } // namespace net | 133 } // namespace net |
| 131 | 134 |
| 132 #endif // NET_SPDY_HPACK_HPACK_HUFFMAN_TABLE_H_ | 135 #endif // NET_SPDY_HPACK_HPACK_HUFFMAN_TABLE_H_ |
| OLD | NEW |