Bug 985017 - [1/2] Support null VolatileBufferPtrs, r=glandium

This commit is contained in:
Michael Wu 2014-04-02 21:32:54 -04:00
parent 041fce1065
commit 2604c0561e

View File

@ -8,6 +8,7 @@
#include "mozilla/mozalloc.h"
#include "mozilla/RefPtr.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/NullPtr.h"
/* VolatileBuffer
*
@ -78,11 +79,18 @@ private:
class VolatileBufferPtr_base {
public:
VolatileBufferPtr_base(VolatileBuffer* vbuf) : mVBuf(vbuf) {
mPurged = !vbuf->Lock(&mMapping);
if (vbuf) {
mPurged = !vbuf->Lock(&mMapping);
} else {
mMapping = nullptr;
mPurged = false;
}
}
~VolatileBufferPtr_base() {
mVBuf->Unlock();
if (mVBuf) {
mVBuf->Unlock();
}
}
bool WasBufferPurged() const {