зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1155759 - Part 2 - Use a static ref ptr for gObserver in nsSHistory. r=smaug
--HG-- extra : rebase_source : c30dfc9b5f3b771e1fc5ba0c76bf87e058c7538a
This commit is contained in:
Родитель
cc8e505792
Коммит
e13f897b77
|
@ -10,6 +10,7 @@
|
|||
|
||||
// Helper Classes
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
|
||||
// Interfaces Needed
|
||||
#include "nsILayoutHistoryState.h"
|
||||
|
@ -178,7 +179,7 @@ protected:
|
|||
~nsSHistoryObserver() {}
|
||||
};
|
||||
|
||||
static nsSHistoryObserver* gObserver = nullptr;
|
||||
StaticRefPtr<nsSHistoryObserver> gObserver;
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsSHistoryObserver, nsIObserver)
|
||||
|
||||
|
@ -360,7 +361,6 @@ nsSHistory::Startup()
|
|||
// but keep the per SHistory cached viewer limit constant
|
||||
if (!gObserver) {
|
||||
gObserver = new nsSHistoryObserver();
|
||||
NS_ADDREF(gObserver);
|
||||
Preferences::AddStrongObservers(gObserver, kObservedPrefs);
|
||||
|
||||
nsCOMPtr<nsIObserverService> obsSvc =
|
||||
|
@ -393,7 +393,7 @@ nsSHistory::Shutdown()
|
|||
obsSvc->RemoveObserver(gObserver, "cacheservice:empty-cache");
|
||||
obsSvc->RemoveObserver(gObserver, "memory-pressure");
|
||||
}
|
||||
NS_RELEASE(gObserver);
|
||||
gObserver = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче