mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 04:41:11 +00:00
Bug 1892643. Allow checking for shutdown in the image decode pool after the decode pool has been cleared. r=gfx-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D208086
This commit is contained in:
parent
7d4a28101d
commit
0220614e37
@ -245,8 +245,7 @@ void AnimationSurfaceProvider::Run() {
|
||||
// release the thread as soon as possible. The animation may advance even
|
||||
// during shutdown, which keeps us decoding, and thus blocking the decode
|
||||
// pool during teardown.
|
||||
if (!mDecoder || !continueDecoding ||
|
||||
DecodePool::Singleton()->IsShuttingDown()) {
|
||||
if (!mDecoder || !continueDecoding || DecodePool::IsShuttingDown()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -282,8 +281,7 @@ void AnimationSurfaceProvider::Run() {
|
||||
// animation may advance even during shutdown, which keeps us decoding, and
|
||||
// thus blocking the decode pool during teardown.
|
||||
MOZ_ASSERT(result == LexerResult(Yield::OUTPUT_AVAILABLE));
|
||||
if (!checkForNewFrameAtYieldResult ||
|
||||
DecodePool::Singleton()->IsShuttingDown()) {
|
||||
if (!checkForNewFrameAtYieldResult || DecodePool::IsShuttingDown()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "mozilla/StaticPrefs_image.h"
|
||||
#include "mozilla/TaskController.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/AppShutdown.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsThreadManager.h"
|
||||
@ -132,7 +133,13 @@ DecodePool::Observe(nsISupports*, const char* aTopic, const char16_t*) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool DecodePool::IsShuttingDown() const { return mShuttingDown; }
|
||||
/* static */ bool DecodePool::IsShuttingDown() {
|
||||
if (MOZ_UNLIKELY(!sSingleton)) {
|
||||
return AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdownThreads);
|
||||
}
|
||||
|
||||
return sSingleton->mShuttingDown;
|
||||
}
|
||||
|
||||
class DecodingTask final : public Task {
|
||||
public:
|
||||
|
@ -56,7 +56,7 @@ class DecodePool final : public nsIObserver {
|
||||
|
||||
/// True if the DecodePool is being shutdown. This may only be called by
|
||||
/// threads from the pool to check if they should keep working or not.
|
||||
bool IsShuttingDown() const;
|
||||
static bool IsShuttingDown();
|
||||
|
||||
/// Ask the DecodePool to run @aTask asynchronously and return immediately.
|
||||
void AsyncRun(IDecodingTask* aTask);
|
||||
|
Loading…
Reference in New Issue
Block a user