Bug 1548798 - Switch SequenceRooter, RecordRooter and RootedUnion to use RootedContext. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D29810

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Zibi Braniecki 2019-05-03 16:07:21 +00:00
parent 5d18af73e6
commit 28c31b907a

View File

@ -2079,21 +2079,24 @@ void DoTraceSequence(JSTracer* trc, InfallibleTArray<T>& seq) {
template <typename T>
class MOZ_RAII SequenceRooter final : private JS::CustomAutoRooter {
public:
SequenceRooter(JSContext* aCx,
template <typename CX>
SequenceRooter(const CX& cx,
FallibleTArray<T>* aSequence MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::CustomAutoRooter(aCx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
: JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
mFallibleArray(aSequence),
mSequenceType(eFallibleArray) {}
SequenceRooter(JSContext* aCx,
template <typename CX>
SequenceRooter(const CX& cx,
InfallibleTArray<T>* aSequence MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::CustomAutoRooter(aCx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
: JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
mInfallibleArray(aSequence),
mSequenceType(eInfallibleArray) {}
SequenceRooter(JSContext* aCx, Nullable<nsTArray<T>>* aSequence
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::CustomAutoRooter(aCx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
template <typename CX>
SequenceRooter(const CX& cx, Nullable<nsTArray<T>>* aSequence
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
mNullableArray(aSequence),
mSequenceType(eNullableArray) {}
@ -2126,15 +2129,17 @@ class MOZ_RAII SequenceRooter final : private JS::CustomAutoRooter {
template <typename K, typename V>
class MOZ_RAII RecordRooter final : private JS::CustomAutoRooter {
public:
RecordRooter(JSContext* aCx,
template <typename CX>
RecordRooter(const CX& cx,
Record<K, V>* aRecord MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::CustomAutoRooter(aCx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
: JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
mRecord(aRecord),
mRecordType(eRecord) {}
RecordRooter(JSContext* aCx,
template <typename CX>
RecordRooter(const CX& cx,
Nullable<Record<K, V>>* aRecord MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::CustomAutoRooter(aCx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
: JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
mNullableRecord(aRecord),
mRecordType(eNullableRecord) {}
@ -2163,7 +2168,8 @@ class MOZ_RAII RecordRooter final : private JS::CustomAutoRooter {
template <typename T>
class MOZ_RAII RootedUnion : public T, private JS::CustomAutoRooter {
public:
explicit RootedUnion(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
template <typename CX>
explicit RootedUnion(const CX& cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: T(),
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT) {}
@ -2174,7 +2180,8 @@ template <typename T>
class MOZ_STACK_CLASS NullableRootedUnion : public Nullable<T>,
private JS::CustomAutoRooter {
public:
explicit NullableRootedUnion(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
template <typename CX>
explicit NullableRootedUnion(const CX& cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: Nullable<T>(),
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT) {}