summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
authorbnc <bnc@chromium.org>2016-02-05 19:58:14 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-06 03:59:37 +0000
commit63c013002ffbbb4c7eac172097e16ea907403e08 (patch)
tree74fdd24d0dc0f31e7ef260bb842f74e2cc9c86d8 /net/base
parent4214c32b210df3f6e2c4e8cc8b92446ce98e34f3 (diff)
downloadchromium_src-63c013002ffbbb4c7eac172097e16ea907403e08.zip
chromium_src-63c013002ffbbb4c7eac172097e16ea907403e08.tar.gz
chromium_src-63c013002ffbbb4c7eac172097e16ea907403e08.tar.bz2
Refactor StringPiece hash.
Rename struct BASE_HASH_NAMESPACE::hash<base::StringPiece> to struct base::StringPieceHash, and modify existing code as necessary. This is motivated by https://crrev.com/1660273002/#msg6. * Remove #include "base/containers/hash_tables.h" where not used any more. * Add this include for hash_map where necessary (string_piece.h does not include it any longer, so this might be necessary for the code to compile). * Change net::linked_hash_map from base::hash_map to std::unordered_map and add Hash template parameter. This way BASE_HASH_NAMESPACE::hash<Key> will not be implicitly used any more, so move QuicBlockedWriterInterfacePtrHash out of that namespace. BUG=576864 Review URL: https://codereview.chromium.org/1666843002 Cr-Commit-Position: refs/heads/master@{#374005}
Diffstat (limited to 'net/base')
-rw-r--r--net/base/linked_hash_map.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/base/linked_hash_map.h b/net/base/linked_hash_map.h
index b86654b..e3d12d6 100644
--- a/net/base/linked_hash_map.h
+++ b/net/base/linked_hash_map.h
@@ -18,9 +18,9 @@
#include <stddef.h>
#include <list>
+#include <unordered_map>
#include <utility>
-#include "base/containers/hash_tables.h"
#include "base/logging.h"
#include "base/macros.h"
@@ -30,11 +30,11 @@
//
// We also keep a map<Key, list::iterator> for find. Since std::list is a
// doubly-linked list, the iterators should remain stable.
-template<class Key, class Value>
+template <class Key, class Value, class Hash = std::hash<Key>>
class linked_hash_map {
private:
typedef std::list<std::pair<Key, Value> > ListType;
- typedef base::hash_map<Key, typename ListType::iterator> MapType;
+ typedef std::unordered_map<Key, typename ListType::iterator, Hash> MapType;
public:
typedef typename ListType::iterator iterator;