forked from mirrors/gecko-dev
Bug 1441059 - Add cycle collection implementations for Maybe. r=bz
This commit is contained in:
parent
04bf64da6a
commit
5fa70ba038
1 changed files with 24 additions and 0 deletions
24
mfbt/Maybe.h
24
mfbt/Maybe.h
|
|
@ -22,6 +22,8 @@
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
class nsCycleCollectionTraversalCallback;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
struct Nothing { };
|
struct Nothing { };
|
||||||
|
|
@ -713,6 +715,28 @@ operator>=(const Maybe<T>& aLHS, const Maybe<T>& aRHS)
|
||||||
return !(aLHS < 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
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif /* mozilla_Maybe_h */
|
#endif /* mozilla_Maybe_h */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue