michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:set ts=2 sw=2 sts=2 et cindent: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef EnumeratedArrayCycleCollection_h_ michael@0: #define EnumeratedArrayCycleCollection_h_ michael@0: michael@0: #include "mozilla/EnumeratedArray.h" michael@0: #include "nsCycleCollectionTraversalCallback.h" michael@0: michael@0: template michael@0: inline void michael@0: ImplCycleCollectionUnlink(mozilla::EnumeratedArray& aField) michael@0: { michael@0: for (size_t i = 0; i < size_t(SizeAsEnumValue); i++) { michael@0: aField[IndexType(i)] = nullptr; michael@0: } michael@0: } michael@0: michael@0: template michael@0: inline void michael@0: ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, michael@0: mozilla::EnumeratedArray& aField, michael@0: const char* aName, michael@0: uint32_t aFlags = 0) michael@0: { michael@0: aFlags |= CycleCollectionEdgeNameArrayFlag; michael@0: for (size_t i = 0; i < size_t(SizeAsEnumValue); ++i) { michael@0: ImplCycleCollectionTraverse(aCallback, aField[IndexType(i)], aName, aFlags); michael@0: } michael@0: } michael@0: michael@0: #endif // EnumeratedArrayCycleCollection_h_