mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-20 08:51:04 +00:00
Bug 1720422 - Support Rooted<...view type...> operations. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D120652
This commit is contained in:
parent
e0df89a627
commit
79a06d19d8
@ -608,6 +608,43 @@ JS_FOR_EACH_TYPED_ARRAY(JS_DECLARE_CLASS_ALIAS)
|
||||
|
||||
} // namespace JS
|
||||
|
||||
namespace js {
|
||||
|
||||
template <class Wrapper>
|
||||
class WrappedPtrOperations_ABoVBase {
|
||||
auto get() const { return static_cast<const Wrapper*>(this)->get(); }
|
||||
|
||||
public:
|
||||
explicit operator bool() const { return bool(get()); }
|
||||
JSObject* asObject() const { return get().asObject(); }
|
||||
bool isDetached() const { return get().isDetached(); }
|
||||
};
|
||||
|
||||
template <typename Wrapper>
|
||||
class WrappedPtrOperations<JS::ArrayBufferOrView, Wrapper>
|
||||
: public WrappedPtrOperations_ABoVBase<Wrapper> {};
|
||||
template <typename Wrapper>
|
||||
class WrappedPtrOperations<JS::ArrayBuffer, Wrapper>
|
||||
: public WrappedPtrOperations_ABoVBase<Wrapper> {};
|
||||
template <typename Wrapper>
|
||||
class WrappedPtrOperations<JS::ArrayBufferView, Wrapper>
|
||||
: public WrappedPtrOperations_ABoVBase<Wrapper> {};
|
||||
template <typename Wrapper>
|
||||
class WrappedPtrOperations<JS::DataView, Wrapper>
|
||||
: public WrappedPtrOperations_ABoVBase<Wrapper> {};
|
||||
template <typename Wrapper>
|
||||
class WrappedPtrOperations<JS::TypedArray_base, Wrapper>
|
||||
: public WrappedPtrOperations_ABoVBase<Wrapper> {};
|
||||
|
||||
#define DECL_TYPED_ARRAY_ROOTED_BASE(_1, _2, Name) \
|
||||
template <typename Wrapper> \
|
||||
class WrappedPtrOperations<JS::TypedArray<JS::Scalar::Name>, Wrapper> \
|
||||
: public WrappedPtrOperations_ABoVBase<Wrapper> {};
|
||||
JS_FOR_EACH_TYPED_ARRAY(DECL_TYPED_ARRAY_ROOTED_BASE)
|
||||
#undef DECL_TYPED_ARRAY_ROOTED_BASE
|
||||
|
||||
} // namespace js
|
||||
|
||||
/*
|
||||
* JS_Is(type)Array(JSObject* maybeWrapped)
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user