2014-06-30 19:39:45 +04: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-26 06:34:03 +04: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"
|
|
|
|
|
2024-03-02 10:50:19 +03:00
|
|
|
template <typename IndexType, typename ValueType, size_t Size>
|
2014-04-26 06:34:03 +04:00
|
|
|
inline void ImplCycleCollectionUnlink(
|
2024-03-02 10:50:19 +03:00
|
|
|
mozilla::EnumeratedArray<IndexType, ValueType, Size>& aField) {
|
|
|
|
for (size_t i = 0; i < Size; ++i) {
|
2014-04-26 06:34:03 +04:00
|
|
|
aField[IndexType(i)] = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-02 10:50:19 +03:00
|
|
|
template <typename IndexType, typename ValueType, size_t Size>
|
2014-04-26 06:34:03 +04:00
|
|
|
inline void ImplCycleCollectionTraverse(
|
|
|
|
nsCycleCollectionTraversalCallback& aCallback,
|
2024-03-02 10:50:19 +03:00
|
|
|
mozilla::EnumeratedArray<IndexType, ValueType, Size>& aField,
|
2014-04-26 06:34:03 +04:00
|
|
|
const char* aName, uint32_t aFlags = 0) {
|
|
|
|
aFlags |= CycleCollectionEdgeNameArrayFlag;
|
2024-03-02 10:50:19 +03:00
|
|
|
for (size_t i = 0; i < Size; ++i) {
|
2014-04-26 06:34:03 +04:00
|
|
|
ImplCycleCollectionTraverse(aCallback, aField[IndexType(i)], aName, aFlags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // EnumeratedArrayCycleCollection_h_
|