зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1412181 - add a proxy to be registered with ClearOnShutdown() to clear MediaCache::sThread. r=gerald
MozReview-Commit-ID: 9SXSKTP9Twb --HG-- extra : rebase_source : 1cec3d8e307c980e2634fdc43ff9333833cb5547 extra : source : 2fa3d4a310a6e5765ee51cd3115013434d4662e5
This commit is contained in:
Родитель
40de7fdd1a
Коммит
c94f001983
|
@ -268,15 +268,6 @@ public:
|
||||||
uint32_t mNext;
|
uint32_t mNext;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Called during shutdown to clear sThread.
|
|
||||||
void operator=(std::nullptr_t)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIThread> thread = sThread.forget();
|
|
||||||
if (thread) {
|
|
||||||
thread->Shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit MediaCache(MediaBlockCacheBase* aCache)
|
explicit MediaCache(MediaBlockCacheBase* aCache)
|
||||||
: mNextResourceID(1)
|
: mNextResourceID(1)
|
||||||
|
@ -726,10 +717,18 @@ MediaCache::GetMediaCache(int64_t aContentLength)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
sThread = thread.forget();
|
sThread = thread.forget();
|
||||||
// Note it is safe to pass an invalid pointer for operator=(std::nullptr_t)
|
|
||||||
// is non-virtual and it will not access |this|.
|
static struct ClearThread
|
||||||
ClearOnShutdown(reinterpret_cast<MediaCache*>(0x1),
|
{
|
||||||
ShutdownPhase::ShutdownThreads);
|
// Called during shutdown to clear sThread.
|
||||||
|
void operator=(std::nullptr_t)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIThread> thread = sThread.forget();
|
||||||
|
MOZ_ASSERT(thread);
|
||||||
|
thread->Shutdown();
|
||||||
|
}
|
||||||
|
} sClearThread;
|
||||||
|
ClearOnShutdown(&sClearThread, ShutdownPhase::ShutdownThreads);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sThread) {
|
if (!sThread) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче