Bug 1269268: Shut down the camera thread from the main thread, which will still exist. r=jesup

This commit is contained in:
Kyle Huey 2016-05-05 01:44:59 -07:00
Родитель a4d7ea2e6b
Коммит 4856a95172
1 изменённых файлов: 4 добавлений и 8 удалений

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

@ -486,23 +486,20 @@ Shutdown(void)
class ShutdownRunnable : public Runnable {
public:
ShutdownRunnable(RefPtr<Runnable> aReplyEvent,
nsIThread* aReplyThread)
: mReplyEvent(aReplyEvent), mReplyThread(aReplyThread) {};
ShutdownRunnable(RefPtr<Runnable> aReplyEvent)
: mReplyEvent(aReplyEvent) {};
NS_IMETHOD Run() override {
LOG(("Closing BackgroundChild"));
ipc::BackgroundChild::CloseForCurrentThread();
LOG(("PBackground thread exists, shutting down thread"));
mReplyThread->Dispatch(mReplyEvent, NS_DISPATCH_NORMAL);
NS_DispatchToMainThread(mReplyEvent);
return NS_OK;
}
private:
RefPtr<Runnable> mReplyEvent;
nsIThread* mReplyThread;
};
void
@ -548,8 +545,7 @@ CamerasChild::ShutdownChild()
// BackgroundChild is closed.
RefPtr<Runnable> event =
new ThreadDestructor(CamerasSingleton::Thread());
RefPtr<ShutdownRunnable> runnable =
new ShutdownRunnable(event, NS_GetCurrentThread());
RefPtr<ShutdownRunnable> runnable = new ShutdownRunnable(event);
CamerasSingleton::Thread()->Dispatch(runnable, NS_DISPATCH_NORMAL);
} else {
LOG(("Shutdown called without PBackground thread"));