| 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_HUFFMAN_TABLE_H_ | 5 #ifndef NET_SPDY_HPACK_HUFFMAN_TABLE_H_ |
| 6 #define NET_SPDY_HPACK_HUFFMAN_TABLE_H_ | 6 #define NET_SPDY_HPACK_HUFFMAN_TABLE_H_ |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 // Expects symbols ordered on ID ascending. | 96 // Expects symbols ordered on ID ascending. |
| 97 void BuildEncodeTable(const std::vector<Symbol>& symbols); | 97 void BuildEncodeTable(const std::vector<Symbol>& symbols); |
| 98 | 98 |
| 99 // Adds a new DecodeTable with the argument prefix & indexed length. | 99 // Adds a new DecodeTable with the argument prefix & indexed length. |
| 100 // Returns the new table index. | 100 // Returns the new table index. |
| 101 uint8 AddDecodeTable(uint8 prefix, uint8 indexed); | 101 uint8 AddDecodeTable(uint8 prefix, uint8 indexed); |
| 102 | 102 |
| 103 const DecodeEntry& Entry(const DecodeTable& table, uint32 index) const; | 103 const DecodeEntry& Entry(const DecodeTable& table, uint32 index) const; |
| 104 | 104 |
| 105 void SetEntry(const DecodeTable& table, uint32 index, | 105 void SetEntry(const DecodeTable& table, |
| 106 uint32 index, |
| 106 const DecodeEntry& entry); | 107 const DecodeEntry& entry); |
| 107 | 108 |
| 108 std::vector<DecodeTable> decode_tables_; | 109 std::vector<DecodeTable> decode_tables_; |
| 109 std::vector<DecodeEntry> decode_entries_; | 110 std::vector<DecodeEntry> decode_entries_; |
| 110 | 111 |
| 111 // Symbol code and code length, in ascending symbol ID order. | 112 // Symbol code and code length, in ascending symbol ID order. |
| 112 // Codes are stored in the most-significant bits of the word. | 113 // Codes are stored in the most-significant bits of the word. |
| 113 std::vector<uint32> code_by_id_; | 114 std::vector<uint32> code_by_id_; |
| 114 std::vector<uint8> length_by_id_; | 115 std::vector<uint8> length_by_id_; |
| 115 | 116 |
| 116 // The first 8 bits of the longest code. Applied when generating padding bits. | 117 // The first 8 bits of the longest code. Applied when generating padding bits. |
| 117 uint8 pad_bits_; | 118 uint8 pad_bits_; |
| 118 | 119 |
| 119 // If initialization fails, preserve the symbol ID which failed validation | 120 // If initialization fails, preserve the symbol ID which failed validation |
| 120 // for examination in tests. | 121 // for examination in tests. |
| 121 uint16 failed_symbol_id_; | 122 uint16 failed_symbol_id_; |
| 122 }; | 123 }; |
| 123 | 124 |
| 124 } // namespace net | 125 } // namespace net |
| 125 | 126 |
| 126 #endif // NET_SPDY_HPACK_HUFFMAN_TABLE_H_ | 127 #endif // NET_SPDY_HPACK_HUFFMAN_TABLE_H_ |
| OLD | NEW |