mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1057894 (Part 1) - Make VolatileBufferPtr's moveable. r=mwu
This commit is contained in:
parent
385660b12e
commit
3fa8c4b046
@ -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