Bug 1256981 - Make ShutdownTracker observe xpcom-will-shutdown instead of xpcom-shutdown. r=dholbert
authorSeth Fowler <mark.seth.fowler@gmail.com>
Fri, 24 Jun 2016 23:38:34 -0700
changeset 342695 05849fd36220a88a50cecdb5d0b585c5c81ffb4d
parent 342694 4e6dd91cd5823834a7da0394367609a1640dfb11
child 342696 d724f337b4f05a56fe90f05ccff06d09a3631eee
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1256981
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1256981 - Make ShutdownTracker observe xpcom-will-shutdown instead of xpcom-shutdown. r=dholbert
image/ShutdownTracker.cpp
image/ShutdownTracker.h
--- a/image/ShutdownTracker.cpp
+++ b/image/ShutdownTracker.cpp
@@ -27,23 +27,23 @@ static bool sShutdownHasStarted = false;
 ///////////////////////////////////////////////////////////////////////////////
 
 struct ShutdownObserver : public nsIObserver
 {
   NS_DECL_ISUPPORTS
 
   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;
     return NS_OK;
   }
 
 private:
   virtual ~ShutdownObserver() { }
@@ -56,17 +56,17 @@ NS_IMPL_ISUPPORTS(ShutdownObserver, nsIO
 // Public API
 ///////////////////////////////////////////////////////////////////////////////
 
 /* static */ void
 ShutdownTracker::Initialize()
 {
   nsCOMPtr<nsIObserverService> os = services::GetObserverService();
   if (os) {
-    os->AddObserver(new ShutdownObserver, "xpcom-shutdown", false);
+    os->AddObserver(new ShutdownObserver, "xpcom-will-shutdown", false);
   }
 }
 
 /* static */ bool
 ShutdownTracker::ShutdownHasStarted()
 {
   return sShutdownHasStarted;
 }
--- a/image/ShutdownTracker.h
+++ b/image/ShutdownTracker.h
@@ -12,18 +12,18 @@
 #define mozilla_image_ShutdownTracker_h
 
 namespace mozilla {
 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
 {
   /**
    * Initialize static data. Called during imagelib module initialization.
    */
   static void Initialize();