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" |
11 #include "net/spdy/hpack/hpack_static_table.h" | 11 #include "net/spdy/hpack/hpack_static_table.h" |
| 12 #include "net/spdy/spdy_flags.h" |
12 | 13 |
13 namespace net { | 14 namespace net { |
14 | 15 |
15 using base::StringPiece; | 16 using base::StringPiece; |
16 | 17 |
17 size_t HpackHeaderTable::EntryHasher::operator()( | 18 size_t HpackHeaderTable::EntryHasher::operator()( |
18 const HpackEntry* entry) const { | 19 const HpackEntry* entry) const { |
19 return base::StringPieceHash()(entry->name()) ^ | 20 return base::StringPieceHash()(entry->name()) ^ |
20 base::StringPieceHash()(entry->value()); | 21 base::StringPieceHash()(entry->value()); |
21 } | 22 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 119 |
119 max_size_ = max_size; | 120 max_size_ = max_size; |
120 if (size_ > max_size_) { | 121 if (size_ > max_size_) { |
121 Evict(EvictionCountToReclaim(size_ - max_size_)); | 122 Evict(EvictionCountToReclaim(size_ - max_size_)); |
122 CHECK_LE(size_, max_size_); | 123 CHECK_LE(size_, max_size_); |
123 } | 124 } |
124 } | 125 } |
125 | 126 |
126 void HpackHeaderTable::SetSettingsHeaderTableSize(size_t settings_size) { | 127 void HpackHeaderTable::SetSettingsHeaderTableSize(size_t settings_size) { |
127 settings_size_bound_ = settings_size; | 128 settings_size_bound_ = settings_size; |
128 if (settings_size_bound_ < max_size_) { | 129 if (!FLAGS_chromium_reloadable_flag_increase_hpack_table_size) { |
| 130 if (settings_size_bound_ < max_size_) { |
| 131 SetMaxSize(settings_size_bound_); |
| 132 } |
| 133 } else { |
129 SetMaxSize(settings_size_bound_); | 134 SetMaxSize(settings_size_bound_); |
130 } | 135 } |
131 } | 136 } |
132 | 137 |
133 void HpackHeaderTable::EvictionSet(StringPiece name, | 138 void HpackHeaderTable::EvictionSet(StringPiece name, |
134 StringPiece value, | 139 StringPiece value, |
135 EntryTable::iterator* begin_out, | 140 EntryTable::iterator* begin_out, |
136 EntryTable::iterator* end_out) { | 141 EntryTable::iterator* end_out) { |
137 size_t eviction_count = EvictionCountForEntry(name, value); | 142 size_t eviction_count = EvictionCountForEntry(name, value); |
138 *begin_out = dynamic_entries_.end() - eviction_count; | 143 *begin_out = dynamic_entries_.end() - eviction_count; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 for (auto* entry : dynamic_index_) { | 264 for (auto* entry : dynamic_index_) { |
260 DVLOG(2) << " " << entry->GetDebugString(); | 265 DVLOG(2) << " " << entry->GetDebugString(); |
261 } | 266 } |
262 DVLOG(2) << "Full Dynamic Name Index:"; | 267 DVLOG(2) << "Full Dynamic Name Index:"; |
263 for (const auto it : dynamic_name_index_) { | 268 for (const auto it : dynamic_name_index_) { |
264 DVLOG(2) << " " << it.first << ": " << it.second->GetDebugString(); | 269 DVLOG(2) << " " << it.first << ": " << it.second->GetDebugString(); |
265 } | 270 } |
266 } | 271 } |
267 | 272 |
268 } // namespace net | 273 } // namespace net |
OLD | NEW |