bug 1249738 - make sSystemClockChangeObservers a function static r=dhylands
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Fri, 19 Feb 2016 11:55:05 -0500
changeset 322164 53d07f5c025bc332fd2f7e189a34065162e22013
parent 322163 0f8651cfdccb0c6534853b4c8d12da79e5eca267
child 322165 a871b30278aaa722bb5b8990c21850d597610b22
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdhylands
bugs1249738
milestone47.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 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());
   }