Add QuicHash(Map|Set) as a general-purpose hash map and set, which doesn't gurantee pointer stability. And switch to QuicHashSet in various places.
gfe-relnote: (n/a) Switching data structures. No behavior change.
PiperOrigin-RevId: 308041428
Change-Id: I499959c1744d772b01e050a1ea433cbc76f31e6d
diff --git a/quic/core/legacy_quic_stream_id_manager.h b/quic/core/legacy_quic_stream_id_manager.h
index 1a94905..16daa64 100644
--- a/quic/core/legacy_quic_stream_id_manager.h
+++ b/quic/core/legacy_quic_stream_id_manager.h
@@ -99,7 +99,7 @@
// Set of stream ids that are less than the largest stream id that has been
// received, but are nonetheless available to be created.
- QuicUnorderedSet<QuicStreamId> available_streams_;
+ QuicHashSet<QuicStreamId> available_streams_;
QuicStreamId largest_peer_created_stream_id_;
};
diff --git a/quic/core/quic_dispatcher.h b/quic/core/quic_dispatcher.h
index 849a8c9..b85f667 100644
--- a/quic/core/quic_dispatcher.h
+++ b/quic/core/quic_dispatcher.h
@@ -309,9 +309,6 @@
private:
friend class test::QuicDispatcherPeer;
- typedef QuicUnorderedSet<QuicConnectionId, QuicConnectionIdHash>
- QuicConnectionIdSet;
-
// TODO(fayang): Consider to rename this function to
// ProcessValidatedPacketWithUnknownConnectionId.
void ProcessHeader(ReceivedPacketInfo* packet_info);
diff --git a/quic/core/quic_session.h b/quic/core/quic_session.h
index 9d94289..75e524f 100644
--- a/quic/core/quic_session.h
+++ b/quic/core/quic_session.h
@@ -750,10 +750,10 @@
// been consumed.
// TODO(fayang): Remove draining_streams_ when deprecate
// quic_deprecate_draining_streams.
- QuicUnorderedSet<QuicStreamId> draining_streams_;
+ QuicHashSet<QuicStreamId> draining_streams_;
// Set of stream ids that are waiting for acks excluding crypto stream id.
- QuicUnorderedSet<QuicStreamId> streams_waiting_for_acks_;
+ QuicHashSet<QuicStreamId> streams_waiting_for_acks_;
// TODO(fayang): Consider moving LegacyQuicStreamIdManager into
// UberQuicStreamIdManager.
diff --git a/quic/core/quic_stream_id_manager.h b/quic/core/quic_stream_id_manager.h
index bdcb7cb..9e6ef20 100644
--- a/quic/core/quic_stream_id_manager.h
+++ b/quic/core/quic_stream_id_manager.h
@@ -176,7 +176,7 @@
// Set of stream ids that are less than the largest stream id that has been
// received, but are nonetheless available to be created.
- QuicUnorderedSet<QuicStreamId> available_streams_;
+ QuicHashSet<QuicStreamId> available_streams_;
QuicStreamId largest_peer_created_stream_id_;
};
diff --git a/quic/platform/api/quic_containers.h b/quic/platform/api/quic_containers.h
index 44c7ab1..d0c63a5 100644
--- a/quic/platform/api/quic_containers.h
+++ b/quic/platform/api/quic_containers.h
@@ -17,10 +17,18 @@
template <typename Key, typename Value, typename Hash = QuicDefaultHasher<Key>>
using QuicUnorderedMap = QuicUnorderedMapImpl<Key, Value, Hash>;
+// A general-purpose unordered map that does not gurantee pointer stability.
+template <typename Key, typename Value, typename Hash = QuicDefaultHasher<Key>>
+using QuicHashMap = QuicHashMapImpl<Key, Value, Hash>;
+
// A general-purpose unordered set.
template <typename Key, typename Hash = QuicDefaultHasher<Key>>
using QuicUnorderedSet = QuicUnorderedSetImpl<Key, Hash>;
+// A general-purpose unordered set that does not gurantee pointer stability.
+template <typename Key, typename Hash = QuicDefaultHasher<Key>>
+using QuicHashSet = QuicHashSetImpl<Key, Hash>;
+
// A map which offers insertion-ordered iteration.
template <typename Key, typename Value, typename Hash = QuicDefaultHasher<Key>>
using QuicLinkedHashMap = QuicLinkedHashMapImpl<Key, Value, Hash>;
diff --git a/quic/qbone/qbone_session_base.h b/quic/qbone/qbone_session_base.h
index 241a3c9..59ca2c4 100644
--- a/quic/qbone/qbone_session_base.h
+++ b/quic/qbone/qbone_session_base.h
@@ -110,8 +110,6 @@
// Number of times the connection has failed to send packets as MESSAGE frame
// and used streams as a fallback.
uint64_t num_fallback_to_stream_ = 0;
-
- QuicUnorderedSet<QuicStreamId> reliable_streams_;
};
} // namespace quic
diff --git a/quic/test_tools/simulator/simulator.h b/quic/test_tools/simulator/simulator.h
index 46f8077..e8280c0 100644
--- a/quic/test_tools/simulator/simulator.h
+++ b/quic/test_tools/simulator/simulator.h
@@ -131,7 +131,7 @@
// For each actor, maintain the time it is scheduled at. The value for
// unscheduled actors is QuicTime::Infinite().
QuicUnorderedMap<Actor*, QuicTime> scheduled_times_;
- QuicUnorderedSet<std::string> actor_names_;
+ QuicHashSet<std::string> actor_names_;
};
template <class TerminationPredicate>