| 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_HEADER_TABLE_H_ | 5 #ifndef NET_SPDY_HPACK_HEADER_TABLE_H_ |
| 6 #define NET_SPDY_HPACK_HEADER_TABLE_H_ | 6 #define NET_SPDY_HPACK_HEADER_TABLE_H_ |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 ~HpackHeaderTable(); | 41 ~HpackHeaderTable(); |
| 42 | 42 |
| 43 // Last-aknowledged value of SETTINGS_HEADER_TABLE_SIZE. | 43 // Last-aknowledged value of SETTINGS_HEADER_TABLE_SIZE. |
| 44 size_t settings_size_bound() { return settings_size_bound_; } | 44 size_t settings_size_bound() { return settings_size_bound_; } |
| 45 | 45 |
| 46 // Current and maximum estimated byte size of the table, as described in | 46 // Current and maximum estimated byte size of the table, as described in |
| 47 // 3.3.1. Notably, this is /not/ the number of entries in the table. | 47 // 3.3.1. Notably, this is /not/ the number of entries in the table. |
| 48 size_t size() const { return size_; } | 48 size_t size() const { return size_; } |
| 49 size_t max_size() const { return max_size_; } | 49 size_t max_size() const { return max_size_; } |
| 50 | 50 |
| 51 const HpackEntry::OrderedSet& reference_set() { | 51 const HpackEntry::OrderedSet& reference_set() { return reference_set_; } |
| 52 return reference_set_; | |
| 53 } | |
| 54 | 52 |
| 55 // Returns the entry matching the index, or NULL. | 53 // Returns the entry matching the index, or NULL. |
| 56 HpackEntry* GetByIndex(size_t index); | 54 HpackEntry* GetByIndex(size_t index); |
| 57 | 55 |
| 58 // Returns the lowest-value entry having |name|, or NULL. | 56 // Returns the lowest-value entry having |name|, or NULL. |
| 59 HpackEntry* GetByName(base::StringPiece name); | 57 HpackEntry* GetByName(base::StringPiece name); |
| 60 | 58 |
| 61 // Returns the lowest-index matching entry, or NULL. | 59 // Returns the lowest-index matching entry, or NULL. |
| 62 HpackEntry* GetByNameAndValue(base::StringPiece name, | 60 HpackEntry* GetByNameAndValue(base::StringPiece name, |
| 63 base::StringPiece value); | 61 base::StringPiece value); |
| 64 | 62 |
| 65 // Sets the maximum size of the header table, evicting entries if | 63 // Sets the maximum size of the header table, evicting entries if |
| 66 // necessary as described in 3.3.2. | 64 // necessary as described in 3.3.2. |
| 67 void SetMaxSize(size_t max_size); | 65 void SetMaxSize(size_t max_size); |
| 68 | 66 |
| 69 // Sets the SETTINGS_HEADER_TABLE_SIZE bound of the table. Will call | 67 // Sets the SETTINGS_HEADER_TABLE_SIZE bound of the table. Will call |
| 70 // SetMaxSize() as needed to preserve max_size() <= settings_size_bound(). | 68 // SetMaxSize() as needed to preserve max_size() <= settings_size_bound(). |
| 71 void SetSettingsHeaderTableSize(size_t settings_size); | 69 void SetSettingsHeaderTableSize(size_t settings_size); |
| 72 | 70 |
| 73 // Determine the set of entries which would be evicted by the insertion | 71 // Determine the set of entries which would be evicted by the insertion |
| 74 // of |name| & |value| into the table, as per section 3.3.3. No eviction | 72 // of |name| & |value| into the table, as per section 3.3.3. No eviction |
| 75 // actually occurs. The set is returned via range [begin_out, end_out). | 73 // actually occurs. The set is returned via range [begin_out, end_out). |
| 76 void EvictionSet(base::StringPiece name, base::StringPiece value, | 74 void EvictionSet(base::StringPiece name, |
| 75 base::StringPiece value, |
| 77 EntryTable::iterator* begin_out, | 76 EntryTable::iterator* begin_out, |
| 78 EntryTable::iterator* end_out); | 77 EntryTable::iterator* end_out); |
| 79 | 78 |
| 80 // Adds an entry for the representation, evicting entries as needed. |name| | 79 // Adds an entry for the representation, evicting entries as needed. |name| |
| 81 // and |value| must not be owned by an entry which could be evicted. The | 80 // and |value| must not be owned by an entry which could be evicted. The |
| 82 // added HpackEntry is returned, or NULL is returned if all entries were | 81 // added HpackEntry is returned, or NULL is returned if all entries were |
| 83 // evicted and the empty table is of insufficent size for the representation. | 82 // evicted and the empty table is of insufficent size for the representation. |
| 84 HpackEntry* TryAddEntry(base::StringPiece name, base::StringPiece value); | 83 HpackEntry* TryAddEntry(base::StringPiece name, base::StringPiece value); |
| 85 | 84 |
| 86 // Toggles the presence of a dynamic entry in the reference set. Returns | 85 // Toggles the presence of a dynamic entry in the reference set. Returns |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // Current number of dynamic entries. Referenced by static HpackEntry | 127 // Current number of dynamic entries. Referenced by static HpackEntry |
| 129 // instances for determination of table index. | 128 // instances for determination of table index. |
| 130 size_t dynamic_entries_count_; | 129 size_t dynamic_entries_count_; |
| 131 | 130 |
| 132 DISALLOW_COPY_AND_ASSIGN(HpackHeaderTable); | 131 DISALLOW_COPY_AND_ASSIGN(HpackHeaderTable); |
| 133 }; | 132 }; |
| 134 | 133 |
| 135 } // namespace net | 134 } // namespace net |
| 136 | 135 |
| 137 #endif // NET_SPDY_HPACK_HEADER_TABLE_H_ | 136 #endif // NET_SPDY_HPACK_HEADER_TABLE_H_ |
| OLD | NEW |