commit e1408b070296d99c1be8b2992d350cf1291488bb
parent eb85973e23d6bbb248e9b91fcea86fd183c5952b
Author: Matthew Gaudet <mgaudet@mozilla.com>
Date: Wed, 1 Oct 2025 21:38:48 +0000
Bug 1983154 - Make Vector a parameter to ds/fifo.h r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D264129
Diffstat:
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/js/src/ds/Fifo.h b/js/src/ds/Fifo.h
@@ -25,8 +25,13 @@ namespace js {
// - Must be even.
// AllocPolicy:
// - see "Allocation policies" in AllocPolicy.h
+//
+// The vector template description is variadic to handle the differences
+// between GCVector and Vector in template parameters.
template <typename T, size_t MinInlineCapacity = 0,
- class AllocPolicy = TempAllocPolicy>
+ class AllocPolicy = TempAllocPolicy,
+ template <typename, size_t, class, typename...> class VectorType =
+ Vector>
class Fifo {
static_assert(MinInlineCapacity % 2 == 0, "MinInlineCapacity must be even!");
@@ -39,8 +44,8 @@ class Fifo {
// Invariant 2: Entries within |front_| are sorted from younger to older.
// Invariant 3: Entries within |rear_| are sorted from older to younger.
// Invariant 4: If the |Fifo| is not empty, then |front_| is not empty.
- Vector<T, MinInlineCapacity / 2, AllocPolicy> front_;
- Vector<T, MinInlineCapacity / 2, AllocPolicy> rear_;
+ VectorType<T, MinInlineCapacity / 2, AllocPolicy> front_;
+ VectorType<T, MinInlineCapacity / 2, AllocPolicy> rear_;
private:
// Maintain invariants after adding or removing entries.