Fix vsync sometimes not firing after the GPU process crashes. (bug 1305628, r=mattwoodrow)

This commit is contained in:
David Anderson 2016-09-27 13:15:55 -07:00
parent 865f4251ec
commit ea061497c3
3 changed files with 13 additions and 9 deletions

View File

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "RemoteCompositorSession.h"
#include "mozilla/VsyncDispatcher.h"
#include "mozilla/layers/APZChild.h"
#include "mozilla/layers/APZCTreeManagerChild.h"
#include "nsBaseWidget.h"

View File

@ -260,6 +260,15 @@ nsBaseWidget::Shutdown()
void nsBaseWidget::DestroyCompositor()
{
// We release this before releasing the compositor, since it may hold the
// last reference to our ClientLayerManager. ClientLayerManager's dtor can
// trigger a paint, creating a new compositor, and we don't want to re-use
// the old vsync dispatcher.
if (mCompositorVsyncDispatcher) {
mCompositorVsyncDispatcher->Shutdown();
mCompositorVsyncDispatcher = nullptr;
}
// The compositor shutdown sequence looks like this:
// 1. CompositorSession calls CompositorBridgeChild::Destroy.
// 2. CompositorBridgeChild synchronously sends WillClose.
@ -284,13 +293,6 @@ void nsBaseWidget::DestroyCompositor()
RefPtr<CompositorSession> session = mCompositorSession.forget();
session->Shutdown();
}
// Can have base widgets that are things like tooltips
// which don't have CompositorVsyncDispatchers
if (mCompositorVsyncDispatcher) {
mCompositorVsyncDispatcher->Shutdown();
mCompositorVsyncDispatcher = nullptr;
}
}
void nsBaseWidget::ReleaseContentController()

View File

@ -32,8 +32,9 @@ InProcessWinCompositorWidget::RealWidget()
void
InProcessWinCompositorWidget::ObserveVsync(VsyncObserver* aObserver)
{
RefPtr<CompositorVsyncDispatcher> cvd = mWindow->GetCompositorVsyncDispatcher();
cvd->SetCompositorVsyncObserver(aObserver);
if (RefPtr<CompositorVsyncDispatcher> cvd = mWindow->GetCompositorVsyncDispatcher()) {
cvd->SetCompositorVsyncObserver(aObserver);
}
}
} // namespace widget