Remove SpdyHash, SpdyHashSet, SpdyHashMap, QuicheHashStringPair. absl::flat_hash_set, absl::flat_hash_map, and absl::Hash are already used elsewhere is QUICHE. SpdyHash is not used. SpdyHashSetImpl and SpdyHashMapImpl are already absl::flat_hash_set and absl::flat_hash_map in internal code. They were std::unordered_set and std::unordered_map in Chromium, but absl hash containers are better according to https://abseil.io/tips/136. QuicheHashStringPair is already absl::Hash in Chromium. Internal code uses a custom implementation that is officially deprecated in favor of absl::Hash. PiperOrigin-RevId: 363562364 Change-Id: I3367a242ac376df7cec4662b3d7967d323048806
diff --git a/common/platform/api/quiche_string_piece.h b/common/platform/api/quiche_string_piece.h deleted file mode 100644 index ca58aae..0000000 --- a/common/platform/api/quiche_string_piece.h +++ /dev/null
@@ -1,19 +0,0 @@ -// Copyright (c) 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_STRING_PIECE_H_ -#define QUICHE_COMMON_PLATFORM_API_QUICHE_STRING_PIECE_H_ - -#include "absl/strings/string_view.h" -#include "net/quiche/common/platform/impl/quiche_string_piece_impl.h" - -namespace quiche { - -inline size_t QuicheHashStringPair(absl::string_view a, absl::string_view b) { - return QuicheHashStringPairImpl(a, b); -} - -} // namespace quiche - -#endif // QUICHE_COMMON_PLATFORM_API_QUICHE_STRING_PIECE_H_
diff --git a/spdy/core/hpack/hpack_header_table.cc b/spdy/core/hpack/hpack_header_table.cc index 9e36e2f..006618d 100644 --- a/spdy/core/hpack/hpack_header_table.cc +++ b/spdy/core/hpack/hpack_header_table.cc
@@ -6,7 +6,6 @@ #include <algorithm> -#include "common/platform/api/quiche_string_piece.h" #include "spdy/core/hpack/hpack_constants.h" #include "spdy/core/hpack/hpack_static_table.h" #include "spdy/platform/api/spdy_containers.h" @@ -17,7 +16,8 @@ size_t HpackHeaderTable::EntryHasher::operator()( const HpackEntry* entry) const { - return quiche::QuicheHashStringPair(entry->name(), entry->value()); + return absl::Hash<std::pair<absl::string_view, absl::string_view>>()( + std::make_pair(entry->name(), entry->value())); } bool HpackHeaderTable::EntriesEq::operator()(const HpackEntry* lhs,
diff --git a/spdy/core/hpack/hpack_header_table.h b/spdy/core/hpack/hpack_header_table.h index 88a656f..d6ea206 100644 --- a/spdy/core/hpack/hpack_header_table.h +++ b/spdy/core/hpack/hpack_header_table.h
@@ -11,6 +11,8 @@ #include <memory> #include "absl/base/attributes.h" +#include "absl/container/flat_hash_map.h" +#include "absl/container/flat_hash_set.h" #include "absl/hash/hash.h" #include "absl/strings/string_view.h" #include "common/platform/api/quiche_export.h" @@ -50,10 +52,10 @@ struct QUICHE_EXPORT_PRIVATE EntriesEq { bool operator()(const HpackEntry* lhs, const HpackEntry* rhs) const; }; - using UnorderedEntrySet = SpdyHashSet<HpackEntry*, EntryHasher, EntriesEq>; - using NameToEntryMap = SpdyHashMap<absl::string_view, - const HpackEntry*, - absl::Hash<absl::string_view>>; + using UnorderedEntrySet = + absl::flat_hash_set<HpackEntry*, EntryHasher, EntriesEq>; + using NameToEntryMap = + absl::flat_hash_map<absl::string_view, const HpackEntry*>; HpackHeaderTable(); HpackHeaderTable(const HpackHeaderTable&) = delete;
diff --git a/spdy/platform/api/spdy_containers.h b/spdy/platform/api/spdy_containers.h index a1a00e6..33da399 100644 --- a/spdy/platform/api/spdy_containers.h +++ b/spdy/platform/api/spdy_containers.h
@@ -9,19 +9,6 @@ namespace spdy { -template <typename KeyType> -using SpdyHash = SpdyHashImpl<KeyType>; - -// SpdyHashMap does not guarantee pointer stability. -template <typename KeyType, - typename ValueType, - typename Hash = SpdyHash<KeyType>> -using SpdyHashMap = SpdyHashMapImpl<KeyType, ValueType, Hash>; - -// SpdyHashSet does not guarantee pointer stability. -template <typename ElementType, typename Hasher, typename Eq> -using SpdyHashSet = SpdyHashSetImpl<ElementType, Hasher, Eq>; - // A map which offers insertion-ordered iteration. template <typename Key, typename Value, typename Hash, typename Eq> using SpdyLinkedHashMap = SpdyLinkedHashMapImpl<Key, Value, Hash, Eq>;