Bug 1316221 - Force VideoBridge shutdown to happen before the compositor thread is destroyed. r=dvander

This commit is contained in:
Matt Woodrow 2016-11-11 15:02:32 +13:00
Родитель 808b23cf14
Коммит 77e78d9558
4 изменённых файлов: 20 добавлений и 6 удалений

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

@ -17,6 +17,7 @@
#include "mozilla/layers/VideoBridgeChild.h" #include "mozilla/layers/VideoBridgeChild.h"
#include "mozilla/SharedThreadPool.h" #include "mozilla/SharedThreadPool.h"
#include "mozilla/layers/ImageDataSerializer.h" #include "mozilla/layers/ImageDataSerializer.h"
#include "mozilla/SyncRunnable.h"
#if XP_WIN #if XP_WIN
#include <objbase.h> #include <objbase.h>
@ -103,13 +104,21 @@ VideoDecoderManagerParent::ShutdownThreads()
sManagerTaskQueue->AwaitShutdownAndIdle(); sManagerTaskQueue->AwaitShutdownAndIdle();
sManagerTaskQueue = nullptr; sManagerTaskQueue = nullptr;
sVideoDecoderManagerThread->Dispatch(NS_NewRunnableFunction([]() {
layers::VideoBridgeChild::Shutdown();
}), NS_DISPATCH_SYNC);
sVideoDecoderManagerThread->Shutdown(); sVideoDecoderManagerThread->Shutdown();
sVideoDecoderManagerThread = nullptr; sVideoDecoderManagerThread = nullptr;
} }
void
VideoDecoderManagerParent::ShutdownVideoBridge()
{
if (sVideoDecoderManagerThread) {
RefPtr<Runnable> task = NS_NewRunnableFunction([]() {
VideoBridgeChild::Shutdown();
});
SyncRunnable::DispatchToThread(sVideoDecoderManagerThread, task);
}
}
bool bool
VideoDecoderManagerParent::OnManagerThread() VideoDecoderManagerParent::OnManagerThread()
{ {

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

@ -24,6 +24,8 @@ public:
static void StartupThreads(); static void StartupThreads();
static void ShutdownThreads(); static void ShutdownThreads();
static void ShutdownVideoBridge();
bool OnManagerThread(); bool OnManagerThread();
protected: protected:

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

@ -22,6 +22,7 @@
#include "mozilla/dom/VideoDecoderManagerParent.h" #include "mozilla/dom/VideoDecoderManagerParent.h"
#include "mozilla/layers/CompositorThread.h" #include "mozilla/layers/CompositorThread.h"
#include "mozilla/layers/ImageBridgeParent.h" #include "mozilla/layers/ImageBridgeParent.h"
#include "mozilla/dom/VideoDecoderManagerChild.h"
#include "mozilla/layers/LayerTreeOwnerTracker.h" #include "mozilla/layers/LayerTreeOwnerTracker.h"
#include "nsDebugImpl.h" #include "nsDebugImpl.h"
#include "nsExceptionHandler.h" #include "nsExceptionHandler.h"
@ -368,6 +369,7 @@ GPUParent::ActorDestroy(ActorDestroyReason aWhy)
mVsyncBridge->Shutdown(); mVsyncBridge->Shutdown();
mVsyncBridge = nullptr; mVsyncBridge = nullptr;
} }
dom::VideoDecoderManagerParent::ShutdownVideoBridge();
CompositorThreadHolder::Shutdown(); CompositorThreadHolder::Shutdown();
Factory::ShutDown(); Factory::ShutDown();
#if defined(XP_WIN) #if defined(XP_WIN)

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

@ -30,9 +30,10 @@ VideoBridgeChild::Startup()
/* static */ void /* static */ void
VideoBridgeChild::Shutdown() VideoBridgeChild::Shutdown()
{ {
if (sVideoBridgeChildSingleton) {
sVideoBridgeChildSingleton->Close(); sVideoBridgeChildSingleton->Close();
sVideoBridgeChildSingleton = nullptr; sVideoBridgeChildSingleton = nullptr;
}
} }
VideoBridgeChild::VideoBridgeChild() VideoBridgeChild::VideoBridgeChild()