Bug 1760812 - Part 1: Use std::tuple in NativeThenHandler r=smaug,mccr8

Differential Revision: https://phabricator.services.mozilla.com/D141754
This commit is contained in:
Kagami Sascha Rosylight 2022-03-22 16:44:58 +00:00
Родитель 638f64a642
Коммит 19f195a70c
2 изменённых файлов: 19 добавлений и 2 удалений

Просмотреть файл

@ -153,7 +153,7 @@ class NativeThenHandler final : public PromiseNativeThenHandlerBase {
JS::Handle<JS::Value> aValue,
ErrorResult& aRv,
std::index_sequence<Indices...>) {
return aHandler(aCx, aValue, aRv, ArgType(Get<Indices>(mArgs))...);
return aHandler(aCx, aValue, aRv, ArgType(std::get<Indices>(mArgs))...);
}
template <typename TCallback>
@ -166,7 +166,7 @@ class NativeThenHandler final : public PromiseNativeThenHandlerBase {
ResolveCallback mOnResolve;
RejectCallback mOnReject;
Tuple<StorageType<Args>...> mArgs;
std::tuple<StorageType<Args>...> mArgs;
};
} // anonymous namespace

Просмотреть файл

@ -1085,4 +1085,21 @@ inline void ImplCycleCollectionUnlink(JS::Heap<T*>& aField) {
MOZ_FOR_EACH_EXPAND_HELPER js_members_) \
NS_IMPL_CYCLE_COLLECTION_TRACE_END
template <typename... Elements>
inline void ImplCycleCollectionUnlink(std::tuple<Elements...>& aField) {
std::apply([](auto&&... aArgs) { (ImplCycleCollectionUnlink(aArgs), ...); },
aField);
}
template <typename... Elements>
inline void ImplCycleCollectionTraverse(
nsCycleCollectionTraversalCallback& aCallback,
std::tuple<Elements...>& aField, const char* aName, uint32_t aFlags) {
aFlags |= CycleCollectionEdgeNameArrayFlag;
std::apply(
[&](auto&&... aArgs) {
(ImplCycleCollectionTraverse(aCallback, aArgs, aName, aFlags), ...);
},
aField);
}
#endif // nsCycleCollectionParticipant_h__