mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 867755 - Detect if DiscardTracker has shutdown r=seth
This commit is contained in:
parent
a15a4e8e26
commit
5d7442e954
@ -24,6 +24,7 @@ static const char* sDiscardTimeoutPref = "image.mem.min_discard_timeout_ms";
|
||||
/* static */ uint32_t DiscardTracker::sMaxDecodedImageKB = 42 * 1024;
|
||||
/* static */ PRLock * DiscardTracker::sAllocationLock = nullptr;
|
||||
/* static */ mozilla::Mutex* DiscardTracker::sNodeListMutex = nullptr;
|
||||
/* static */ Atomic<uint32_t> DiscardTracker::sShutdown(0);
|
||||
|
||||
/*
|
||||
* When we notice we're using too much memory for decoded images, we enqueue a
|
||||
@ -82,6 +83,10 @@ DiscardTracker::Reset(Node *node)
|
||||
void
|
||||
DiscardTracker::Remove(Node *node)
|
||||
{
|
||||
if (sShutdown) {
|
||||
// Already shutdown. List should be empty, so just return.
|
||||
return;
|
||||
}
|
||||
MutexAutoLock lock(*sNodeListMutex);
|
||||
|
||||
if (node->isInList())
|
||||
@ -97,6 +102,8 @@ DiscardTracker::Remove(Node *node)
|
||||
void
|
||||
DiscardTracker::Shutdown()
|
||||
{
|
||||
sShutdown = true;
|
||||
|
||||
if (sTimer) {
|
||||
sTimer->Cancel();
|
||||
sTimer = nullptr;
|
||||
|
@ -122,6 +122,7 @@ class DiscardTracker
|
||||
// Lock for safegarding the 64-bit sCurrentDecodedImageBytes
|
||||
static PRLock *sAllocationLock;
|
||||
static mozilla::Mutex* sNodeListMutex;
|
||||
static Atomic<uint32_t> sShutdown;
|
||||
};
|
||||
|
||||
} // namespace image
|
||||
|
Loading…
Reference in New Issue
Block a user