Flush async paints before revoking device singletons. (bug 1380922 part 3, r=mchang)

--HG--
extra : rebase_source : 34d90c80b8cc99d0679db03cf2ac1ca21ffbc5d3
This commit is contained in:
David Anderson 2017-07-18 12:16:13 -07:00
parent d91f1ac58c
commit 7db58ae2a1

View File

@ -15,9 +15,11 @@
#include "mozilla/gfx/GPUParent.h"
#include "mozilla/gfx/GraphicsMessages.h"
#include "mozilla/gfx/Logging.h"
#include "mozilla/layers/CompositorBridgeChild.h"
#include "mozilla/layers/CompositorThread.h"
#include "mozilla/layers/DeviceAttachmentsD3D11.h"
#include "mozilla/layers/MLGDeviceD3D11.h"
#include "mozilla/layers/PaintThread.h"
#include "nsIGfxInfo.h"
#include "nsString.h"
#include <d3d11.h>
@ -716,6 +718,14 @@ DeviceManagerDx::CreateMLGDevice()
void
DeviceManagerDx::ResetDevices()
{
// Flush the paint thread before revoking all these singletons. This
// should ensure that the paint thread doesn't start mixing and matching
// old and new objects together.
if (PaintThread::Get()) {
CompositorBridgeChild* cbc = CompositorBridgeChild::Get();
cbc->FlushAsyncPaints();
}
MutexAutoLock lock(mDeviceLock);
mAdapter = nullptr;