bug 1249738 - make sSystemClockChangeObservers a function static r=dhylands
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Fri, 19 Feb 2016 11:55:05 -0500
changeset 285828 53d07f5c025bc332fd2f7e189a34065162e22013
parent 285827 0f8651cfdccb0c6534853b4c8d12da79e5eca267
child 285829 a871b30278aaa722bb5b8990c21850d597610b22
push id17876
push usercbook@mozilla.com
push dateMon, 29 Feb 2016 10:43:24 +0000
treeherderfx-team@9da51cb4974e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdhylands
bugs1249738
milestone47.0a1
bug 1249738 - make sSystemClockChangeObservers a function static r=dhylands
hal/Hal.cpp
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -456,36 +456,42 @@ protected:
     PROXY_IF_SANDBOXED(EnableSystemClockChangeNotifications());
   }
 
   void DisableNotifications() {
     PROXY_IF_SANDBOXED(DisableSystemClockChangeNotifications());
   }
 };
 
-static SystemClockChangeObserversManager sSystemClockChangeObservers;
+static SystemClockChangeObserversManager&
+SystemClockChangeObservers()
+{
+  static SystemClockChangeObserversManager sSystemClockChangeObservers;
+  AssertMainThread();
+  return sSystemClockChangeObservers;
+}
 
 void
 RegisterSystemClockChangeObserver(SystemClockChangeObserver* aObserver)
 {
   AssertMainThread();
-  sSystemClockChangeObservers.AddObserver(aObserver);
+  SystemClockChangeObservers().AddObserver(aObserver);
 }
 
 void
 UnregisterSystemClockChangeObserver(SystemClockChangeObserver* aObserver)
 {
   AssertMainThread();
-  sSystemClockChangeObservers.RemoveObserver(aObserver);
+  SystemClockChangeObservers().RemoveObserver(aObserver);
 }
 
 void
 NotifySystemClockChange(const int64_t& aClockDeltaMS)
 {
-  sSystemClockChangeObservers.BroadcastInformation(aClockDeltaMS);
+  SystemClockChangeObservers().BroadcastInformation(aClockDeltaMS);
 }
 
 class SystemTimezoneChangeObserversManager : public ObserversManager<SystemTimezoneChangeInformation>
 {
 protected:
   void EnableNotifications() {
     PROXY_IF_SANDBOXED(EnableSystemTimezoneChangeNotifications());
   }