mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 900898 part 1. Give dom::TypedArray structs a no-argument constructor. r=smaug
This commit is contained in:
parent
00e61e639b
commit
967caa334c
@ -24,7 +24,12 @@ template<typename T,
|
||||
struct TypedArray_base {
|
||||
TypedArray_base(JSObject* obj)
|
||||
{
|
||||
mObj = UnboxArray(obj, &mLength, &mData);
|
||||
DoInit(obj);
|
||||
}
|
||||
|
||||
TypedArray_base() :
|
||||
mObj(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
@ -33,6 +38,12 @@ private:
|
||||
JSObject* mObj;
|
||||
|
||||
public:
|
||||
inline void Init(JSObject* obj)
|
||||
{
|
||||
MOZ_ASSERT(!inited());
|
||||
DoInit(obj);
|
||||
}
|
||||
|
||||
inline bool inited() const {
|
||||
return !!mObj;
|
||||
}
|
||||
@ -51,6 +62,12 @@ public:
|
||||
MOZ_ASSERT(inited());
|
||||
return mObj;
|
||||
}
|
||||
|
||||
protected:
|
||||
inline void DoInit(JSObject* obj)
|
||||
{
|
||||
mObj = UnboxArray(obj, &mLength, &mData);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -63,6 +80,10 @@ struct TypedArray : public TypedArray_base<T,UnboxArray> {
|
||||
TypedArray_base<T,UnboxArray>(obj)
|
||||
{}
|
||||
|
||||
TypedArray() :
|
||||
TypedArray_base<T,UnboxArray>()
|
||||
{}
|
||||
|
||||
static inline JSObject*
|
||||
Create(JSContext* cx, nsWrapperCache* creator, uint32_t length,
|
||||
const T* data = NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user