mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1020034. r=bz
--HG-- extra : rebase_source : a38cdad564a8499b28f2f83dd1ad63f762419383
This commit is contained in:
parent
8375a2963c
commit
5a1738144d
@ -24,23 +24,31 @@ namespace dom {
|
||||
*/
|
||||
struct TypedArrayObjectStorage : AllTypedArraysBase {
|
||||
protected:
|
||||
JSObject* mObj;
|
||||
JSObject* mTypedObj;
|
||||
JSObject* mWrappedObj;
|
||||
|
||||
TypedArrayObjectStorage() : mObj(nullptr)
|
||||
TypedArrayObjectStorage()
|
||||
: mTypedObj(nullptr),
|
||||
mWrappedObj(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
explicit TypedArrayObjectStorage(TypedArrayObjectStorage&& aOther)
|
||||
: mObj(aOther.mObj)
|
||||
: mTypedObj(aOther.mTypedObj),
|
||||
mWrappedObj(aOther.mWrappedObj)
|
||||
{
|
||||
aOther.mObj = nullptr;
|
||||
aOther.mTypedObj = nullptr;
|
||||
aOther.mWrappedObj = nullptr;
|
||||
}
|
||||
|
||||
public:
|
||||
inline void TraceSelf(JSTracer* trc)
|
||||
{
|
||||
if (mObj) {
|
||||
JS_CallObjectTracer(trc, &mObj, "TypedArray.mObj");
|
||||
if (mTypedObj) {
|
||||
JS_CallObjectTracer(trc, &mTypedObj, "TypedArray.mTypedObj");
|
||||
}
|
||||
if (mWrappedObj) {
|
||||
JS_CallObjectTracer(trc, &mTypedObj, "TypedArray.mWrappedObj");
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,12 +95,12 @@ public:
|
||||
inline bool Init(JSObject* obj)
|
||||
{
|
||||
MOZ_ASSERT(!inited());
|
||||
mObj = UnwrapArray(obj);
|
||||
mTypedObj = mWrappedObj = UnwrapArray(obj);
|
||||
return inited();
|
||||
}
|
||||
|
||||
inline bool inited() const {
|
||||
return !!mObj;
|
||||
return !!mTypedObj;
|
||||
}
|
||||
|
||||
inline T *Data() const {
|
||||
@ -107,32 +115,23 @@ public:
|
||||
|
||||
inline JSObject *Obj() const {
|
||||
MOZ_ASSERT(inited());
|
||||
return mObj;
|
||||
return mWrappedObj;
|
||||
}
|
||||
|
||||
inline bool WrapIntoNewCompartment(JSContext* cx)
|
||||
{
|
||||
return JS_WrapObject(cx,
|
||||
JS::MutableHandle<JSObject*>::fromMarkedLocation(&mObj));
|
||||
JS::MutableHandle<JSObject*>::fromMarkedLocation(&mWrappedObj));
|
||||
}
|
||||
|
||||
inline void ComputeLengthAndData() const
|
||||
{
|
||||
MOZ_ASSERT(inited());
|
||||
MOZ_ASSERT(!mComputed);
|
||||
GetLengthAndData(mObj, &mLength, &mData);
|
||||
GetLengthAndData(mTypedObj, &mLength, &mData);
|
||||
mComputed = true;
|
||||
}
|
||||
|
||||
protected:
|
||||
inline void ComputeData() const {
|
||||
MOZ_ASSERT(inited());
|
||||
if (!mComputed) {
|
||||
GetLengthAndData(mObj, &mLength, &mData);
|
||||
mComputed = true;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
TypedArray_base(const TypedArray_base&) MOZ_DELETE;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user