diff options
Diffstat (limited to 'js/src/jsapi.h')
-rw-r--r-- | js/src/jsapi.h | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 1eecdbf74..8e70cc152 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -2546,10 +2546,14 @@ struct JS_PUBLIC_API(PropertyDescriptor) { void trace(JSTracer* trc); }; -template <typename Outer> -class PropertyDescriptorOperations +} // namespace JS + +namespace js { + +template <typename Wrapper> +class WrappedPtrOperations<JS::PropertyDescriptor, Wrapper> { - const PropertyDescriptor& desc() const { return static_cast<const Outer*>(this)->get(); } + const JS::PropertyDescriptor& desc() const { return static_cast<const Wrapper*>(this)->get(); } bool has(unsigned bit) const { MOZ_ASSERT(bit != 0); @@ -2678,10 +2682,11 @@ class PropertyDescriptorOperations } }; -template <typename Outer> -class MutablePropertyDescriptorOperations : public PropertyDescriptorOperations<Outer> +template <typename Wrapper> +class MutableWrappedPtrOperations<JS::PropertyDescriptor, Wrapper> + : public js::WrappedPtrOperations<JS::PropertyDescriptor, Wrapper> { - PropertyDescriptor& desc() { return static_cast<Outer*>(this)->get(); } + JS::PropertyDescriptor& desc() { return static_cast<Wrapper*>(this)->get(); } public: void clear() { @@ -2692,7 +2697,7 @@ class MutablePropertyDescriptorOperations : public PropertyDescriptorOperations< value().setUndefined(); } - void initFields(HandleObject obj, HandleValue v, unsigned attrs, + void initFields(JS::HandleObject obj, JS::HandleValue v, unsigned attrs, JSGetterOp getterOp, JSSetterOp setterOp) { MOZ_ASSERT(getterOp != JS_PropertyStub); MOZ_ASSERT(setterOp != JS_StrictPropertyStub); @@ -2704,7 +2709,7 @@ class MutablePropertyDescriptorOperations : public PropertyDescriptorOperations< setSetter(setterOp); } - void assign(PropertyDescriptor& other) { + void assign(JS::PropertyDescriptor& other) { object().set(other.obj); setAttributes(other.attrs); setGetter(other.getter); @@ -2712,7 +2717,7 @@ class MutablePropertyDescriptorOperations : public PropertyDescriptorOperations< value().set(other.value); } - void setDataDescriptor(HandleValue v, unsigned attrs) { + void setDataDescriptor(JS::HandleValue v, unsigned attrs) { MOZ_ASSERT((attrs & ~(JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY | @@ -2787,26 +2792,7 @@ class MutablePropertyDescriptorOperations : public PropertyDescriptorOperations< } }; -} /* namespace JS */ - -namespace js { - -template <> -class RootedBase<JS::PropertyDescriptor> - : public JS::MutablePropertyDescriptorOperations<JS::Rooted<JS::PropertyDescriptor>> -{}; - -template <> -class HandleBase<JS::PropertyDescriptor> - : public JS::PropertyDescriptorOperations<JS::Handle<JS::PropertyDescriptor>> -{}; - -template <> -class MutableHandleBase<JS::PropertyDescriptor> - : public JS::MutablePropertyDescriptorOperations<JS::MutableHandle<JS::PropertyDescriptor>> -{}; - -} /* namespace js */ +} // namespace js namespace JS { |