Bug 1482956 - Don't dispatch extra runnable for ending layer transaction. r=nical

This may have been needed at some point, but all the important code for
EndLayerTransaction is in CompositorBridgeChild behind a lock, so this
should be safe.

--HG--
extra : rebase_source : bda4080bc04afa95954732050df7bd25c8177752
extra : histedit_source : 9386583dd923bf0ae44ff783d3ef1c6692944c77
This commit is contained in:
Ryan Hunt 2018-08-13 12:57:15 -05:00
Родитель 92823fa25e
Коммит a3a666772d
4 изменённых файлов: 7 добавлений и 51 удалений

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

@ -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<CompositorBridgeChild> cbc(aBridge);
RefPtr<PaintTask> Task(aTask);
RefPtr<PaintThread> self = this;
RefPtr<Runnable> 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<Runnable>& 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<CompositorBridgeChild> cbc = aBridge;
RefPtr<PaintThread> self = this;
RefPtr<Runnable> task = NS_NewRunnableFunction("PaintThread::AsyncEndLayerTransaction",
[self, cbc]() -> void
{
self->AsyncEndLayerTransaction(cbc);
});
sThread->Dispatch(task.forget());
}
} // namespace layers
} // namespace mozilla

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

@ -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<PaintThread> sSingleton;
static StaticRefPtr<nsIThread> sThread;
static PlatformThreadId sThreadId;

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

@ -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;
}

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

@ -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);