Bug 1256981 - Make ShutdownTracker observe xpcom-will-shutdown instead of xpcom-shutdown. r=dholbert

This commit is contained in:
Seth Fowler 2016-06-24 23:38:34 -07:00
Родитель 02d34ad572
Коммит 1dd3328bab
2 изменённых файлов: 5 добавлений и 5 удалений

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

@ -32,13 +32,13 @@ struct ShutdownObserver : public nsIObserver
NS_IMETHOD Observe(nsISupports*, const char* aTopic, const char16_t*) override
{
if (strcmp(aTopic, "xpcom-shutdown") != 0) {
if (strcmp(aTopic, "xpcom-will-shutdown") != 0) {
return NS_OK;
}
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (os) {
os->RemoveObserver(this, "xpcom-shutdown");
os->RemoveObserver(this, "xpcom-will-shutdown");
}
sShutdownHasStarted = true;
@ -61,7 +61,7 @@ ShutdownTracker::Initialize()
{
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (os) {
os->AddObserver(new ShutdownObserver, "xpcom-shutdown", false);
os->AddObserver(new ShutdownObserver, "xpcom-will-shutdown", false);
}
}

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

@ -17,8 +17,8 @@ namespace image {
/**
* ShutdownTracker is an imagelib-global service that allows callers to check
* whether shutdown has started. It exists to avoid the need for registering
* many 'xpcom-shutdown' notification observers on short-lived objects, which
* would have an unnecessary performance cost.
* many 'xpcom-will-shutdown' notification observers on short-lived objects,
* which would have an unnecessary performance cost.
*/
struct ShutdownTracker
{