Bug 858039 - Initialize the correct mType for SurfaceStream_TripleBuffer_Async. r=snorp

This commit is contained in:
Douglas Crosher 2013-04-07 23:35:21 +10:00
Родитель eb54d962c4
Коммит 7700627d98
3 изменённых файлов: 30 добавлений и 12 удалений

Просмотреть файл

@ -315,7 +315,7 @@ GLScreenBuffer::Morph(SurfaceFactory_GL* newFactory, SurfaceStreamType streamTyp
mFactory = newFactory;
}
if (mStream->Type() == streamType)
if (mStream->mType == streamType)
return;
SurfaceStream* newStream = SurfaceStream::CreateForType(streamType, mStream);

Просмотреть файл

@ -351,12 +351,7 @@ SurfaceStream_TripleBuffer_Copy::SwapConsumer_NoWait()
return mConsumer;
}
SurfaceStream_TripleBuffer::SurfaceStream_TripleBuffer(SurfaceStream* prevStream)
: SurfaceStream(SurfaceStreamType::TripleBuffer, prevStream)
, mStaging(nullptr)
, mConsumer(nullptr)
void SurfaceStream_TripleBuffer::Init(SurfaceStream* prevStream)
{
if (!prevStream)
return;
@ -372,6 +367,23 @@ SurfaceStream_TripleBuffer::SurfaceStream_TripleBuffer(SurfaceStream* prevStream
mConsumer = Absorb(prevConsumer);
}
SurfaceStream_TripleBuffer::SurfaceStream_TripleBuffer(SurfaceStreamType type, SurfaceStream* prevStream)
: SurfaceStream(type, prevStream)
, mStaging(nullptr)
, mConsumer(nullptr)
{
SurfaceStream_TripleBuffer::Init(prevStream);
}
SurfaceStream_TripleBuffer::SurfaceStream_TripleBuffer(SurfaceStream* prevStream)
: SurfaceStream(SurfaceStreamType::TripleBuffer, prevStream)
, mStaging(nullptr)
, mConsumer(nullptr)
{
SurfaceStream_TripleBuffer::Init(prevStream);
}
SurfaceStream_TripleBuffer::~SurfaceStream_TripleBuffer()
{
Delete(mStaging);
@ -431,9 +443,8 @@ SurfaceStream_TripleBuffer::SwapConsumer_NoWait()
}
SurfaceStream_TripleBuffer_Async::SurfaceStream_TripleBuffer_Async(SurfaceStream* prevStream)
: SurfaceStream_TripleBuffer(prevStream)
: SurfaceStream_TripleBuffer(SurfaceStreamType::TripleBuffer_Async, prevStream)
{
mType = SurfaceStreamType::TripleBuffer_Async;
}
SurfaceStream_TripleBuffer_Async::~SurfaceStream_TripleBuffer_Async()

Просмотреть файл

@ -41,11 +41,10 @@ public:
return (SurfaceStream*)handle;
}
SurfaceStreamType Type() { return mType; }
const SurfaceStreamType mType;
protected:
// |mProd| is owned by us, but can be ripped away when
// creating a new GLStream from this one.
SurfaceStreamType mType;
SharedSurface* mProducer;
std::set<SharedSurface*> mSurfaces;
std::stack<SharedSurface*> mScraps;
@ -60,7 +59,7 @@ protected:
, mMonitor("SurfaceStream monitor")
, mIsAlive(true)
{
MOZ_ASSERT(!prevStream || mType != prevStream->Type(),
MOZ_ASSERT(!prevStream || mType != prevStream->mType,
"We should not need to create a SurfaceStream from another "
"of the same type.");
}
@ -175,10 +174,18 @@ protected:
// Returns true if we were able to wait, false if not
virtual bool WaitForCompositor() { return false; }
// To support subclasses initializing the mType.
SurfaceStream_TripleBuffer(SurfaceStreamType type, SurfaceStream* prevStream);
public:
SurfaceStream_TripleBuffer(SurfaceStream* prevStream);
virtual ~SurfaceStream_TripleBuffer();
private:
// Common constructor code.
void Init(SurfaceStream* prevStream);
public:
// Done writing to prod, swap prod and staging
virtual SharedSurface* SwapProducer(SurfaceFactory* factory,
const gfxIntSize& size);