mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-31 11:37:30 +09:00
Issue #1742 - Part 1: Refactor rooting base class templates
Based on Bug 1325406
This commit is contained in:
parent
2f81312755
commit
80d7d43961
24 changed files with 239 additions and 512 deletions
|
|
@ -50,21 +50,12 @@ struct GCPolicy<mozilla::OwningNonNull<T>>
|
|||
} // namespace JS
|
||||
|
||||
namespace js {
|
||||
template<typename T>
|
||||
struct RootedBase<mozilla::OwningNonNull<T>>
|
||||
template<typename T, typename Wrapper>
|
||||
struct WrappedPtrOperations<mozilla::OwningNonNull<T>, Wrapper>
|
||||
{
|
||||
typedef mozilla::OwningNonNull<T> SmartPtrType;
|
||||
|
||||
operator SmartPtrType& () const
|
||||
{
|
||||
auto& self = *static_cast<const JS::Rooted<SmartPtrType>*>(this);
|
||||
return self.get();
|
||||
}
|
||||
|
||||
operator T& () const
|
||||
{
|
||||
auto& self = *static_cast<const JS::Rooted<SmartPtrType>*>(this);
|
||||
return self.get();
|
||||
return static_cast<const Wrapper*>(this)->get();
|
||||
}
|
||||
};
|
||||
} // namespace js
|
||||
|
|
|
|||
|
|
@ -38,19 +38,12 @@ struct GCPolicy<RefPtr<T>>
|
|||
} // namespace JS
|
||||
|
||||
namespace js {
|
||||
template<typename T>
|
||||
struct RootedBase<RefPtr<T>>
|
||||
template<typename T, typename Wrapper>
|
||||
struct WrappedPtrOperations<RefPtr<T>, Wrapper>
|
||||
{
|
||||
operator RefPtr<T>& () const
|
||||
{
|
||||
auto& self = *static_cast<const JS::Rooted<RefPtr<T>>*>(this);
|
||||
return self.get();
|
||||
}
|
||||
|
||||
operator T*() const
|
||||
{
|
||||
auto& self = *static_cast<const JS::Rooted<RefPtr<T>>*>(this);
|
||||
return self.get();
|
||||
return static_cast<const Wrapper*>(this)->get();
|
||||
}
|
||||
};
|
||||
} // namespace js
|
||||
|
|
|
|||
|
|
@ -126,15 +126,15 @@ struct IsHeapConstructibleType<nsXBLMaybeCompiled<T>>
|
|||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <class UncompiledT>
|
||||
class HeapBase<nsXBLMaybeCompiled<UncompiledT>>
|
||||
template <class UncompiledT, class Wrapper>
|
||||
class HeapBase<nsXBLMaybeCompiled<UncompiledT>, Wrapper>
|
||||
{
|
||||
const JS::Heap<nsXBLMaybeCompiled<UncompiledT>>& wrapper() const {
|
||||
return *static_cast<const JS::Heap<nsXBLMaybeCompiled<UncompiledT>>*>(this);
|
||||
const Wrapper& wrapper() const {
|
||||
return *static_cast<const Wrapper*>(this);
|
||||
}
|
||||
|
||||
JS::Heap<nsXBLMaybeCompiled<UncompiledT>>& wrapper() {
|
||||
return *static_cast<JS::Heap<nsXBLMaybeCompiled<UncompiledT>>*>(this);
|
||||
Wrapper& wrapper() {
|
||||
return *static_cast<Wrapper*>(this);
|
||||
}
|
||||
|
||||
const nsXBLMaybeCompiled<UncompiledT>* extract() const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue