Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: net/spdy/hpack/hpack_header_table.h

Issue 1666843002: Refactor StringPiece hash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sort includes. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_blocked_writer_interface.h ('k') | net/spdy/hpack/hpack_header_table.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <unordered_map> 10 #include <unordered_map>
11 #include <unordered_set> 11 #include <unordered_set>
12 12
13 #include "base/containers/hash_tables.h"
14 #include "base/macros.h" 13 #include "base/macros.h"
15 #include "base/strings/string_piece.h" 14 #include "base/strings/string_piece.h"
16 #include "net/base/net_export.h" 15 #include "net/base/net_export.h"
17 #include "net/spdy/hpack/hpack_entry.h" 16 #include "net/spdy/hpack/hpack_entry.h"
18 17
19 // All section references below are to http://tools.ietf.org/html/rfc7541. 18 // All section references below are to http://tools.ietf.org/html/rfc7541.
20 19
21 namespace net { 20 namespace net {
22 21
23 namespace test { 22 namespace test {
(...skipping 14 matching lines...) Expand all
38 37
39 struct NET_EXPORT_PRIVATE EntryHasher { 38 struct NET_EXPORT_PRIVATE EntryHasher {
40 size_t operator()(const HpackEntry* entry) const; 39 size_t operator()(const HpackEntry* entry) const;
41 }; 40 };
42 struct NET_EXPORT_PRIVATE EntriesEq { 41 struct NET_EXPORT_PRIVATE EntriesEq {
43 bool operator()(const HpackEntry* lhs, const HpackEntry* rhs) const; 42 bool operator()(const HpackEntry* lhs, const HpackEntry* rhs) const;
44 }; 43 };
45 44
46 using UnorderedEntrySet = 45 using UnorderedEntrySet =
47 std::unordered_set<HpackEntry*, EntryHasher, EntriesEq>; 46 std::unordered_set<HpackEntry*, EntryHasher, EntriesEq>;
48 using NameToEntryMap = 47 using NameToEntryMap = std::unordered_map<base::StringPiece,
49 std::unordered_map<base::StringPiece, 48 const HpackEntry*,
50 const HpackEntry*, 49 base::StringPieceHash>;
51 BASE_HASH_NAMESPACE::hash<base::StringPiece>>;
52 50
53 HpackHeaderTable(); 51 HpackHeaderTable();
54 52
55 ~HpackHeaderTable(); 53 ~HpackHeaderTable();
56 54
57 // Last-acknowledged value of SETTINGS_HEADER_TABLE_SIZE. 55 // Last-acknowledged value of SETTINGS_HEADER_TABLE_SIZE.
58 size_t settings_size_bound() const { return settings_size_bound_; } 56 size_t settings_size_bound() const { return settings_size_bound_; }
59 57
60 // Current and maximum estimated byte size of the table, as described in 58 // Current and maximum estimated byte size of the table, as described in
61 // 4.1. Notably, this is /not/ the number of entries in the table. 59 // 4.1. Notably, this is /not/ the number of entries in the table.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // Total number of table insertions which have occurred. Referenced by 138 // Total number of table insertions which have occurred. Referenced by
141 // IndexOf() for determination of an HpackEntry's table index. 139 // IndexOf() for determination of an HpackEntry's table index.
142 size_t total_insertions_; 140 size_t total_insertions_;
143 141
144 DISALLOW_COPY_AND_ASSIGN(HpackHeaderTable); 142 DISALLOW_COPY_AND_ASSIGN(HpackHeaderTable);
145 }; 143 };
146 144
147 } // namespace net 145 } // namespace net
148 146
149 #endif // NET_SPDY_HPACK_HEADER_TABLE_H_ 147 #endif // NET_SPDY_HPACK_HEADER_TABLE_H_
OLDNEW
« no previous file with comments | « net/quic/quic_blocked_writer_interface.h ('k') | net/spdy/hpack/hpack_header_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698