| 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_HEADER_TABLE_H_ | 5 #ifndef NET_SPDY_HPACK_HPACK_HEADER_TABLE_H_ |
| 6 #define NET_SPDY_HPACK_HPACK_HEADER_TABLE_H_ | 6 #define NET_SPDY_HPACK_HPACK_HEADER_TABLE_H_ |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // evicted and the empty table is of insufficent size for the representation. | 118 // evicted and the empty table is of insufficent size for the representation. |
| 119 const HpackEntry* TryAddEntry(base::StringPiece name, | 119 const HpackEntry* TryAddEntry(base::StringPiece name, |
| 120 base::StringPiece value); | 120 base::StringPiece value); |
| 121 | 121 |
| 122 void DebugLogTableState() const; | 122 void DebugLogTableState() const; |
| 123 | 123 |
| 124 void set_debug_visitor(std::unique_ptr<DebugVisitorInterface> visitor) { | 124 void set_debug_visitor(std::unique_ptr<DebugVisitorInterface> visitor) { |
| 125 debug_visitor_ = std::move(visitor); | 125 debug_visitor_ = std::move(visitor); |
| 126 } | 126 } |
| 127 | 127 |
| 128 // Returns the estimate of dynamically allocated memory in bytes. |
| 129 size_t EstimateMemoryUsage() const; |
| 130 |
| 128 private: | 131 private: |
| 129 // Returns number of evictions required to enter |name| & |value|. | 132 // Returns number of evictions required to enter |name| & |value|. |
| 130 size_t EvictionCountForEntry(base::StringPiece name, | 133 size_t EvictionCountForEntry(base::StringPiece name, |
| 131 base::StringPiece value) const; | 134 base::StringPiece value) const; |
| 132 | 135 |
| 133 // Returns number of evictions required to reclaim |reclaim_size| table size. | 136 // Returns number of evictions required to reclaim |reclaim_size| table size. |
| 134 size_t EvictionCountToReclaim(size_t reclaim_size) const; | 137 size_t EvictionCountToReclaim(size_t reclaim_size) const; |
| 135 | 138 |
| 136 // Evicts |count| oldest entries from the table. | 139 // Evicts |count| oldest entries from the table. |
| 137 void Evict(size_t count); | 140 void Evict(size_t count); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 167 size_t total_insertions_; | 170 size_t total_insertions_; |
| 168 | 171 |
| 169 std::unique_ptr<DebugVisitorInterface> debug_visitor_; | 172 std::unique_ptr<DebugVisitorInterface> debug_visitor_; |
| 170 | 173 |
| 171 DISALLOW_COPY_AND_ASSIGN(HpackHeaderTable); | 174 DISALLOW_COPY_AND_ASSIGN(HpackHeaderTable); |
| 172 }; | 175 }; |
| 173 | 176 |
| 174 } // namespace net | 177 } // namespace net |
| 175 | 178 |
| 176 #endif // NET_SPDY_HPACK_HPACK_HEADER_TABLE_H_ | 179 #endif // NET_SPDY_HPACK_HPACK_HEADER_TABLE_H_ |
| OLD | NEW |