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 #include "net/spdy/hpack/hpack_header_table.h" | 5 #include "net/spdy/hpack/hpack_header_table.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "net/spdy/hpack/hpack_constants.h" | 10 #include "net/spdy/hpack/hpack_constants.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 max_size_ = max_size; | 121 max_size_ = max_size; |
122 if (size_ > max_size_) { | 122 if (size_ > max_size_) { |
123 Evict(EvictionCountToReclaim(size_ - max_size_)); | 123 Evict(EvictionCountToReclaim(size_ - max_size_)); |
124 CHECK_LE(size_, max_size_); | 124 CHECK_LE(size_, max_size_); |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 void HpackHeaderTable::SetSettingsHeaderTableSize(size_t settings_size) { | 128 void HpackHeaderTable::SetSettingsHeaderTableSize(size_t settings_size) { |
129 settings_size_bound_ = settings_size; | 129 settings_size_bound_ = settings_size; |
130 if (!FLAGS_chromium_reloadable_flag_increase_hpack_table_size) { | 130 SetMaxSize(settings_size_bound_); |
131 if (settings_size_bound_ < max_size_) { | |
132 SetMaxSize(settings_size_bound_); | |
133 } | |
134 } else { | |
135 SetMaxSize(settings_size_bound_); | |
136 } | |
137 } | 131 } |
138 | 132 |
139 void HpackHeaderTable::EvictionSet(StringPiece name, | 133 void HpackHeaderTable::EvictionSet(StringPiece name, |
140 StringPiece value, | 134 StringPiece value, |
141 EntryTable::iterator* begin_out, | 135 EntryTable::iterator* begin_out, |
142 EntryTable::iterator* end_out) { | 136 EntryTable::iterator* end_out) { |
143 size_t eviction_count = EvictionCountForEntry(name, value); | 137 size_t eviction_count = EvictionCountForEntry(name, value); |
144 *begin_out = dynamic_entries_.end() - eviction_count; | 138 *begin_out = dynamic_entries_.end() - eviction_count; |
145 *end_out = dynamic_entries_.end(); | 139 *end_out = dynamic_entries_.end(); |
146 } | 140 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 } | 269 } |
276 } | 270 } |
277 | 271 |
278 size_t HpackHeaderTable::EstimateMemoryUsage() const { | 272 size_t HpackHeaderTable::EstimateMemoryUsage() const { |
279 return SpdyEstimateMemoryUsage(dynamic_entries_) + | 273 return SpdyEstimateMemoryUsage(dynamic_entries_) + |
280 SpdyEstimateMemoryUsage(dynamic_index_) + | 274 SpdyEstimateMemoryUsage(dynamic_index_) + |
281 SpdyEstimateMemoryUsage(dynamic_name_index_); | 275 SpdyEstimateMemoryUsage(dynamic_name_index_); |
282 } | 276 } |
283 | 277 |
284 } // namespace net | 278 } // namespace net |
OLD | NEW |