зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1729602 - Templatize RootHolder in PersistentRooted to more closely match Rooted r=tcampbell,jonco
Differential Revision: https://phabricator.services.mozilla.com/D124995
This commit is contained in:
Родитель
90d784a9bd
Коммит
2ddcc9e183
|
@ -1402,39 +1402,28 @@ class PersistentRooted
|
||||||
reinterpret_cast<JS::PersistentRooted<detail::RootListEntry*>*>(this));
|
reinterpret_cast<JS::PersistentRooted<detail::RootListEntry*>*>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used when JSContext type is incomplete and so it is not known to inherit
|
||||||
|
// from RootingContext.
|
||||||
|
void registerWithRootLists(JSContext* cx) {
|
||||||
|
registerWithRootLists(RootingContext::get(cx));
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using ElementType = T;
|
using ElementType = T;
|
||||||
|
|
||||||
PersistentRooted() : ptr(SafelyInitialized<T>()) {}
|
PersistentRooted() : ptr(SafelyInitialized<T>()) {}
|
||||||
|
|
||||||
explicit PersistentRooted(RootingContext* cx) : ptr(SafelyInitialized<T>()) {
|
template <typename RootHolder>
|
||||||
|
explicit PersistentRooted(const RootHolder& cx) : ptr(SafelyInitialized<T>()) {
|
||||||
registerWithRootLists(cx);
|
registerWithRootLists(cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit PersistentRooted(JSContext* cx) : ptr(SafelyInitialized<T>()) {
|
template <typename RootHolder, typename U>
|
||||||
registerWithRootLists(RootingContext::get(cx));
|
PersistentRooted(const RootHolder& cx, U&& initial)
|
||||||
}
|
|
||||||
|
|
||||||
template <typename U>
|
|
||||||
PersistentRooted(RootingContext* cx, U&& initial)
|
|
||||||
: ptr(std::forward<U>(initial)) {
|
: ptr(std::forward<U>(initial)) {
|
||||||
registerWithRootLists(cx);
|
registerWithRootLists(cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename U>
|
|
||||||
PersistentRooted(JSContext* cx, U&& initial) : ptr(std::forward<U>(initial)) {
|
|
||||||
registerWithRootLists(RootingContext::get(cx));
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit PersistentRooted(JSRuntime* rt) : ptr(SafelyInitialized<T>()) {
|
|
||||||
registerWithRootLists(rt);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename U>
|
|
||||||
PersistentRooted(JSRuntime* rt, U&& initial) : ptr(std::forward<U>(initial)) {
|
|
||||||
registerWithRootLists(rt);
|
|
||||||
}
|
|
||||||
|
|
||||||
PersistentRooted(const PersistentRooted& rhs)
|
PersistentRooted(const PersistentRooted& rhs)
|
||||||
: mozilla::LinkedListElement<PersistentRooted<T>>(), ptr(rhs.ptr) {
|
: mozilla::LinkedListElement<PersistentRooted<T>>(), ptr(rhs.ptr) {
|
||||||
/*
|
/*
|
||||||
|
|
Загрузка…
Ссылка в новой задаче