Bug 1500805 Part 2 - Ensure non-main threads are idle when diverging from the recording, r=mccr8.

--HG--
extra : rebase_source : 0d9e1ae7f0bcda2631781cc4b4a73cee88e886c8
This commit is contained in:
Brian Hackett 2018-10-21 15:02:32 -06:00
Родитель 274519d9f8
Коммит f804910b86
2 изменённых файлов: 16 добавлений и 12 удалений

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

@ -199,6 +199,11 @@ DivergeFromRecording()
// Reset middleman call state whenever we first diverge from the recording.
child::SendResetMiddlemanCalls();
// Make sure all non-main threads are idle before we begin diverging. This
// thread's new behavior can change values used by other threads and induce
// recording mismatches.
Thread::WaitForIdleThreads();
thread->DivergeFromRecording();
}

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

@ -577,22 +577,21 @@ Repaint(size_t* aWidth, size_t* aHeight)
// and the last graphics we sent will still be correct.
Thread* compositorThread = Thread::GetById(gCompositorThreadId);
if (!compositorThread->WillDivergeFromRecordingSoon()) {
// Allow the compositor to diverge from the recording so it can perform
// any paint we are about to trigger, or finish any in flight paint that
// that existed at the point we are paused at.
Thread::GetById(gCompositorThreadId)->SetShouldDivergeFromRecording();
Thread::ResumeSingleIdleThread(gCompositorThreadId);
// Create an artifical vsync to see if graphics have changed since the last
// paint and a new paint is needed.
NotifyVsyncObserver();
if (gNumPendingPaints) {
// Allow the compositor to diverge from the recording so it can perform
// any paint we just triggered, or finish any in flight paint that that
// existed at the point we are paused at.
Thread::GetById(gCompositorThreadId)->SetShouldDivergeFromRecording();
// Wait for the compositor to finish all in flight paints, including any
// one we just triggered.
MonitorAutoLock lock(*gMonitor);
while (gNumPendingPaints) {
gMonitor->Wait();
}
// Wait for the compositor to finish all in flight paints, including any
// one we just triggered.
MonitorAutoLock lock(*gMonitor);
while (gNumPendingPaints) {
gMonitor->Wait();
}
}