SharedSurface* SurfaceStream_TripleBuffer::SwapProducer(SurfaceFactory* factory, const gfxIntSize& size) { PROFILER_LABEL("SurfaceStream_TripleBuffer", "SwapProducer"); MonitorAutoLock lock(mMonitor); if (mProducer) { RecycleScraps(factory); // If WaitForCompositor succeeds, mStaging has moved to mConsumer. // If it failed, we might have to scrap it. if (mStaging && !WaitForCompositor()) Scrap(mStaging); MOZ_ASSERT(!mStaging); Move(mProducer, mStaging); mStaging->Fence(); } MOZ_ASSERT(!mProducer); New(factory, size, mProducer); return mProducer; }
SharedSurface* SurfaceStream_TripleBuffer::SwapConsumer_NoWait() { MutexAutoLock lock(mMutex); if (mStaging) { Scrap(mConsumer); Move(mStaging, mConsumer); } return mConsumer; }
SharedSurface* SurfaceStream_TripleBuffer::SwapConsumer_NoWait() { MonitorAutoLock lock(mMonitor); if (mStaging) { Scrap(mConsumer); Move(mStaging, mConsumer); mMonitor.NotifyAll(); } return mConsumer; }
SharedSurface* SurfaceStream::Resize(SurfaceFactory* factory, const gfxIntSize& size) { MonitorAutoLock lock(mMonitor); if (mProducer) { Scrap(mProducer); } New(factory, size, mProducer); return mProducer; }
SharedSurface* SurfaceStream_TripleBuffer::SwapProducer(SurfaceFactory* factory, const gfx::IntSize& size) { PROFILER_LABEL("SurfaceStream_TripleBuffer", "SwapProducer"); MonitorAutoLock lock(mMonitor); if (mProducer) { RecycleScraps(factory); if (mStaging) Scrap(mStaging); MOZ_ASSERT(!mStaging); Move(mProducer, mStaging); mStaging->Fence(); } MOZ_ASSERT(!mProducer); New(factory, size, mProducer); return mProducer; }