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
9b8255f0c4
commit
c6bc53f6f4
@ -91,6 +91,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
RefPtr<VolatileBuffer> mVBuf;
|
||||||
void* mMapping;
|
void* mMapping;
|
||||||
|
|
||||||
void Set(VolatileBuffer* vbuf) {
|
void Set(VolatileBuffer* vbuf) {
|
||||||
@ -100,7 +101,6 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RefPtr<VolatileBuffer> mVBuf;
|
|
||||||
bool mPurged;
|
bool mPurged;
|
||||||
|
|
||||||
void Lock() {
|
void Lock() {
|
||||||
@ -126,13 +126,30 @@ public:
|
|||||||
explicit VolatileBufferPtr(VolatileBuffer* vbuf) : VolatileBufferPtr_base(vbuf) {}
|
explicit VolatileBufferPtr(VolatileBuffer* vbuf) : VolatileBufferPtr_base(vbuf) {}
|
||||||
VolatileBufferPtr() : VolatileBufferPtr_base(nullptr) {}
|
VolatileBufferPtr() : VolatileBufferPtr_base(nullptr) {}
|
||||||
|
|
||||||
|
VolatileBufferPtr(VolatileBufferPtr&& aOther)
|
||||||
|
: VolatileBufferPtr_base(aOther.mVBuf)
|
||||||
|
{
|
||||||
|
aOther.Set(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
operator T*() const {
|
operator T*() const {
|
||||||
return (T*) mMapping;
|
return (T*) mMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator =(VolatileBuffer* vbuf) {
|
VolatileBufferPtr& operator=(VolatileBuffer* aVBuf)
|
||||||
Set(vbuf);
|
{
|
||||||
|
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:
|
private:
|
||||||
VolatileBufferPtr(VolatileBufferPtr const& vbufptr) MOZ_DELETE;
|
VolatileBufferPtr(VolatileBufferPtr const& vbufptr) MOZ_DELETE;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user