Skip to content

Commit

Permalink
Use absl::node_hash_map instead of std::unordered_map in QUICHE.
Browse files Browse the repository at this point in the history
The plan here is to switch QUICHE to Abseil types in two steps:
  1) Change Chromium to use Abseil implementation of wrapper types.
  2) Replace wrapper types with Abseil types once chromium#1 lands.

This allows us to perform the switch without introducing churn caused by
having to roll back Abseil types in case those break something in Chromium.

Change-Id: I7efd58da2487c502aa03548901e370881de69a1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2410517
Commit-Queue: Victor Vasiliev <vasilvv@chromium.org>
Reviewed-by: Mirko Bonadei <mbonadei@chromium.org>
Reviewed-by: David Schinazi <dschinazi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806808}
  • Loading branch information
Victor Vasiliev authored and Commit Bot committed Sep 15, 2020
1 parent 07b1189 commit f2304ba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
6 changes: 6 additions & 0 deletions net/quiche/common/platform/impl/DEPS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include_rules = [
# This is a temporary rule to simplify migrating QUICHE to using Abseil
# directly.
# TODO(b/166325009): remove this rule.
"+third_party/abseil-cpp/absl/container/node_hash_map.h",
]
16 changes: 6 additions & 10 deletions net/quiche/common/platform/impl/quiche_unordered_containers_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,16 @@

#include <unordered_map>

#include "third_party/abseil-cpp/absl/container/node_hash_map.h"

namespace quiche {

// The default hasher used by hash tables.
template <typename Key>
using QuicheDefaultHasherImpl = std::hash<Key>;

template <typename Key,
typename Value,
typename Hash,
typename Eq =
typename std::unordered_map<Key, Value, Hash>::key_equal,
typename Alloc =
typename std::unordered_map<Key, Value, Hash>::allocator_type>
using QuicheUnorderedMapImpl = std::unordered_map<Key, Value, Hash, Eq, Alloc>;
using QuicheDefaultHasherImpl = absl::Hash<Key>;

template <typename Key, typename Value, typename Hash, typename Eq>
using QuicheUnorderedMapImpl = absl::node_hash_map<Key, Value, Hash, Eq>;

} // namespace quiche

Expand Down

0 comments on commit f2304ba

Please sign in to comment.