mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1057894 (Part 1) - Make VolatileBufferPtr's moveable. r=mwu
This commit is contained in:
parent
404a29c4f3
commit
33bbdb155d
@ -91,6 +91,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
RefPtr<VolatileBuffer> mVBuf;
|
||||
void* mMapping;
|
||||
|
||||
void Set(VolatileBuffer* vbuf) {
|
||||
@ -100,7 +101,6 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
RefPtr<VolatileBuffer> mVBuf;
|
||||
bool mPurged;
|
||||
|
||||
void Lock() {
|
||||
@ -126,13 +126,30 @@ public:
|
||||
explicit VolatileBufferPtr(VolatileBuffer* vbuf) : VolatileBufferPtr_base(vbuf) {}
|
||||
VolatileBufferPtr() : VolatileBufferPtr_base(nullptr) {}
|
||||
|
||||
VolatileBufferPtr(VolatileBufferPtr&& aOther)
|
||||
: VolatileBufferPtr_base(aOther.mVBuf)
|
||||
{
|
||||
aOther.Set(nullptr);
|
||||
}
|
||||
|
||||
operator T*() const {
|
||||
return (T*) mMapping;
|
||||
}
|
||||
|
||||
void operator =(VolatileBuffer* vbuf) {
|
||||
Set(vbuf);
|
||||
VolatileBufferPtr& operator=(VolatileBuffer* aVBuf)
|
||||
{
|
||||
Set(aVBuf);
|
||||
return *this;
|
||||
}
|
||||
|
||||
VolatileBufferPtr& operator=(VolatileBufferPtr&& aOther)
|
||||
{
|
||||
MOZ_ASSERT(this != &aOther, "Self-moves are prohibited");
|
||||
Set(aOther.mVBuf);
|
||||
aOther.Set(nullptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
VolatileBufferPtr(VolatileBufferPtr const& vbufptr) MOZ_DELETE;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user