2014-06-30 08:39:45 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2014-04-25 19:34:03 -07:00
|
|
|
/* 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"
|
|
|
|
|
2014-06-26 18:35:39 -07:00
|
|
|
template<typename IndexType,
|
|
|
|
MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(IndexType) SizeAsEnumValue,
|
|
|
|
typename ValueType>
|
2014-04-25 19:34:03 -07:00
|
|
|
inline void
|
|
|
|
ImplCycleCollectionUnlink(mozilla::EnumeratedArray<IndexType,
|
|
|
|
SizeAsEnumValue,
|
|
|
|
ValueType>& aField)
|
|
|
|
{
|
2014-06-26 18:35:39 -07:00
|
|
|
for (size_t i = 0; i < size_t(SizeAsEnumValue); ++i) {
|
2014-04-25 19:34:03 -07:00
|
|
|
aField[IndexType(i)] = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-26 18:35:39 -07:00
|
|
|
template<typename IndexType,
|
|
|
|
MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(IndexType) SizeAsEnumValue,
|
|
|
|
typename ValueType>
|
2014-04-25 19:34:03 -07:00
|
|
|
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_
|