xpcom/base/EnumeratedArrayCycleCollection.h
author Mozilla Releng Treescript <release+treescript@mozilla.org>
Wed, 21 Apr 2021 18:57:02 +0000
changeset 644108 f3e509414f1962cbdec55f8a73f73e388a7647cb
parent 505383 6f3709b3878117466168c40affa7bca0b60cf75b
permissions -rw-r--r--
no bug - Bumping Firefox l10n changesets r=release a=l10n-bump be -> 32ee82aa768707b6055da56a4e83fdc607b3eb96 bg -> 670368eb9153e61a4352a4f0692bb94849014809 el -> 96d144cf523a93a9a08105b724557757d77b21fa eo -> 3f0ceac3cab2934405973eda185f9cd1101f01ff es-AR -> e67f86e3c6b4cf4d1ed849ab502f98e63311af29 eu -> ae0d5de53af687866c33a21c577742c471cf854c fr -> c8510d6e98155bc63040242ed93213fdd9a508a7 gn -> 9b35e108954abae03a193562d5f540dad9afa04b he -> e5e3670b39a1f05a0eca44118c56499f5fe0ffb5 hr -> c565d00565bcf6a28e5bee6ad39225383818dfaa hu -> c22b0efe8d0b141f5561f44267603bf15c5492e1 it -> 35ba38e53d9a5769aa67b8d2d3800a868732bd21 kk -> e3a124e37de0fb51bdcc3513958203bd35cb5e4f ko -> 26f0ec3f9ec2ea504558fb352b25616e56335fa3 nl -> e015f736415e7af7a335c902a67664c686273a4a nn-NO -> 2f0843dcd735c5b0daf246d7310629948ca76e4c oc -> 552431495e6675f39ca4526e384a65024e44c309 pt-BR -> c1d92a4196ef0bf51f80e2e9914ae96ea8af52e0 te -> ca415e995195c6e2ed4db713525258ddae72efbe tl -> 7b593c68b487152a34f4dd4c3815444a9cdbd3c5 vi -> a3e5c4360b17f594391d0d5d4f21815bdc69c8e2 zh-CN -> 503fddc98aa9ff636a3fa6bbc978d7b6eef5a5d3 zh-TW -> 6f2b8d44b83a05809862421bde3cc914892f115f

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef EnumeratedArrayCycleCollection_h_
#define EnumeratedArrayCycleCollection_h_

#include "mozilla/EnumeratedArray.h"
#include "nsCycleCollectionTraversalCallback.h"

template <typename IndexType, IndexType SizeAsEnumValue, typename ValueType>
inline void ImplCycleCollectionUnlink(
    mozilla::EnumeratedArray<IndexType, SizeAsEnumValue, ValueType>& aField) {
  for (size_t i = 0; i < size_t(SizeAsEnumValue); ++i) {
    aField[IndexType(i)] = nullptr;
  }
}

template <typename IndexType, IndexType SizeAsEnumValue, typename ValueType>
inline void ImplCycleCollectionTraverse(
    nsCycleCollectionTraversalCallback& aCallback,
    mozilla::EnumeratedArray<IndexType, SizeAsEnumValue, ValueType>& aField,
    const char* aName, uint32_t aFlags = 0) {
  aFlags |= CycleCollectionEdgeNameArrayFlag;
  for (size_t i = 0; i < size_t(SizeAsEnumValue); ++i) {
    ImplCycleCollectionTraverse(aCallback, aField[IndexType(i)], aName, aFlags);
  }
}

#endif  // EnumeratedArrayCycleCollection_h_