зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1441059
- Add cycle collection implementations for Maybe. r=bz
This commit is contained in:
Родитель
04bf64da6a
Коммит
5fa70ba038
24
mfbt/Maybe.h
24
mfbt/Maybe.h
|
@ -22,6 +22,8 @@
|
|||
#include <ostream>
|
||||
#include <type_traits>
|
||||
|
||||
class nsCycleCollectionTraversalCallback;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
struct Nothing { };
|
||||
|
@ -713,6 +715,28 @@ operator>=(const Maybe<T>& aLHS, const Maybe<T>& aRHS)
|
|||
return !(aLHS < aRHS);
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
|
||||
Maybe<T>& aMaybe,
|
||||
const char* aName,
|
||||
uint32_t aFlags = 0)
|
||||
{
|
||||
if (aMaybe.isSome()) {
|
||||
ImplCycleCollectionTraverse(aCallback, aMaybe.ref(), aName, aFlags);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
ImplCycleCollectionUnlink(Maybe<T>& aMaybe)
|
||||
{
|
||||
if (aMaybe.isSome()) {
|
||||
ImplCycleCollectionUnlink(aMaybe.ref());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* mozilla_Maybe_h */
|
||||
|
|
Загрузка…
Ссылка в новой задаче