diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp index e0f9ae562357..d62c0099a61b 100644 --- a/gfx/layers/PaintThread.cpp +++ b/gfx/layers/PaintThread.cpp @@ -158,7 +158,6 @@ PaintThread::ShutdownOnPaintThread() /* static */ PaintThread* PaintThread::Get() { - MOZ_ASSERT(NS_IsMainThread()); return PaintThread::sSingleton.get(); } @@ -242,34 +241,12 @@ PaintThread::AsyncPaintTask(CompositorBridgeChild* aBridge, NS_ReleaseOnMainThreadSystemGroup("PaintTask::DrawTargetCapture", aTask->mCapture.forget()); } - { - RefPtr cbc(aBridge); - RefPtr Task(aTask); - - RefPtr self = this; - RefPtr task = NS_NewRunnableFunction("PaintThread::AsyncPaintTaskFinished", - [self, cbc, Task]() -> void - { - self->AsyncPaintTaskFinished(cbc, Task); - }); - - #ifndef OMTP_FORCE_SYNC - sThread->Dispatch(task.forget()); - #else - SyncRunnable::DispatchToThread(sThread, task); - #endif + if (aBridge->NotifyFinishedAsyncWorkerPaint(aTask)) { + AsyncEndLayerTransaction(aBridge); } } void -PaintThread::AsyncPaintTaskFinished(CompositorBridgeChild* aBridge, - PaintTask* aTask) -{ - MOZ_ASSERT(IsOnPaintThread()); - if (aBridge->NotifyFinishedAsyncWorkerPaint(aTask)) { - aBridge->NotifyFinishedAsyncEndLayerTransaction(); - } -} void PaintThread::Dispatch(RefPtr& aRunnable) @@ -307,26 +284,10 @@ PaintThread::EndLayerTransaction(SyncObjectClient* aSyncObject) void PaintThread::AsyncEndLayerTransaction(CompositorBridgeChild* aBridge) { - MOZ_ASSERT(IsOnPaintThread()); + MOZ_ASSERT(IsOnPaintWorkerThread()); aBridge->NotifyFinishedAsyncEndLayerTransaction(); } -void -PaintThread::DispatchEndLayerTransaction(CompositorBridgeChild* aBridge) -{ - MOZ_ASSERT(IsOnPaintThread()); - - RefPtr cbc = aBridge; - RefPtr self = this; - RefPtr task = NS_NewRunnableFunction("PaintThread::AsyncEndLayerTransaction", - [self, cbc]() -> void - { - self->AsyncEndLayerTransaction(cbc); - }); - - sThread->Dispatch(task.forget()); -} - } // namespace layers } // namespace mozilla diff --git a/gfx/layers/PaintThread.h b/gfx/layers/PaintThread.h index c6fffb5e4e81..a4094b796946 100644 --- a/gfx/layers/PaintThread.h +++ b/gfx/layers/PaintThread.h @@ -91,13 +91,8 @@ private: void AsyncPaintTask(CompositorBridgeChild* aBridge, PaintTask* aTask); - void AsyncPaintTaskFinished(CompositorBridgeChild* aBridge, - PaintTask* aTask); - void AsyncEndLayerTransaction(CompositorBridgeChild* aBridge); - void DispatchEndLayerTransaction(CompositorBridgeChild* aBridge); - static StaticAutoPtr sSingleton; static StaticRefPtr sThread; static PlatformThreadId sThreadId; diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index b35cf3b73246..b34cd0ea5b0b 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -1775,7 +1775,7 @@ TextureClient::AddPaintThreadRef() void TextureClient::DropPaintThreadRef() { - MOZ_RELEASE_ASSERT(PaintThread::IsOnPaintThread()); + MOZ_RELEASE_ASSERT(PaintThread::Get()->IsOnPaintWorkerThread()); MOZ_RELEASE_ASSERT(mPaintThreadRefs >= 1); mPaintThreadRefs -= 1; } diff --git a/gfx/layers/ipc/CompositorBridgeChild.cpp b/gfx/layers/ipc/CompositorBridgeChild.cpp index 94f427a828a1..eea3e84159ad 100644 --- a/gfx/layers/ipc/CompositorBridgeChild.cpp +++ b/gfx/layers/ipc/CompositorBridgeChild.cpp @@ -1210,7 +1210,7 @@ CompositorBridgeChild::NotifyBeginAsyncPaint(PaintTask* aTask) bool CompositorBridgeChild::NotifyFinishedAsyncWorkerPaint(PaintTask* aTask) { - MOZ_ASSERT(PaintThread::IsOnPaintThread()); + MOZ_ASSERT(PaintThread::Get()->IsOnPaintWorkerThread()); MonitorAutoLock lock(mPaintLock); mOutstandingAsyncPaints--; @@ -1240,7 +1240,7 @@ CompositorBridgeChild::NotifyBeginAsyncEndLayerTransaction(SyncObjectClient* aSy void CompositorBridgeChild::NotifyFinishedAsyncEndLayerTransaction() { - MOZ_ASSERT(PaintThread::IsOnPaintThread()); + MOZ_ASSERT(PaintThread::Get()->IsOnPaintWorkerThread()); if (mOutstandingAsyncSyncObject) { mOutstandingAsyncSyncObject->Synchronize(); @@ -1273,7 +1273,7 @@ CompositorBridgeChild::ResumeIPCAfterAsyncPaint() { // Note: the caller is responsible for holding the lock. mPaintLock.AssertCurrentThreadOwns(); - MOZ_ASSERT(PaintThread::IsOnPaintThread()); + MOZ_ASSERT(PaintThread::Get()->IsOnPaintWorkerThread()); MOZ_ASSERT(mOutstandingAsyncPaints == 0); MOZ_ASSERT(!mOutstandingAsyncEndTransaction); MOZ_ASSERT(mIsDelayingForAsyncPaints);