Bug 1273079 - Use MOZ_MUST_USE in hal. r?gsvelto draft
authorWei-Cheng Pan <wpan@mozilla.com>
Mon, 16 May 2016 17:24:03 +0800
changeset 369640 4f9d4bdc4f63d8cbfdef6604c4b4daa278ff8899
parent 369317 16663eb3dcfa759f25b5e27b101bc79270c156f2
child 521582 ffc57ae7a32f220d21c3d7cb0bc7b325b17b9a3c
push id18875
push userbmo:wpan@mozilla.com
push dateMon, 23 May 2016 08:58:22 +0000
reviewersgsvelto
bugs1273079
milestone49.0a1
Bug 1273079 - Use MOZ_MUST_USE in hal. r?gsvelto MozReview-Commit-ID: 7VLDpz34DRu
dom/base/ScreenOrientation.cpp
hal/Hal.h
hal/HalInternal.h
--- a/dom/base/ScreenOrientation.cpp
+++ b/dom/base/ScreenOrientation.cpp
@@ -548,17 +548,18 @@ ScreenOrientation::Notify(const hal::Scr
 }
 
 void
 ScreenOrientation::UpdateActiveOrientationLock(ScreenOrientationInternal aOrientation)
 {
   if (aOrientation == eScreenOrientation_None) {
     hal::UnlockScreenOrientation();
   } else {
-    hal::LockScreenOrientation(aOrientation);
+    bool rv = hal::LockScreenOrientation(aOrientation);
+    NS_WARN_IF(!rv);
   }
 }
 
 void
 ScreenOrientation::DispatchChangeEvent()
 {
   nsresult rv = DispatchTrustedEvent(NS_LITERAL_STRING("change"));
   NS_WARN_IF(NS_FAILED(rv));
--- a/hal/Hal.h
+++ b/hal/Hal.h
@@ -389,17 +389,17 @@ void GetCurrentScreenConfiguration(hal::
  * @param aScreenConfiguration The new screen orientation.
  */
 void NotifyScreenConfigurationChange(const hal::ScreenConfiguration& aScreenConfiguration);
 
 /**
  * Lock the screen orientation to the specific orientation.
  * @return Whether the lock has been accepted.
  */
-bool LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation);
+MOZ_MUST_USE bool LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation);
 
 /**
  * Unlock the screen orientation.
  */
 void UnlockScreenOrientation();
 
 /**
  * Register an observer for the switch of given SwitchDevice.
@@ -433,17 +433,17 @@ void NotifySwitchStateFromInputDevice(ha
                                       hal::SwitchState aState);
 
 /**
  * Register an observer that is notified when a programmed alarm
  * expires.
  *
  * Currently, there can only be 0 or 1 alarm observers.
  */
-bool RegisterTheOneAlarmObserver(hal::AlarmObserver* aObserver);
+MOZ_MUST_USE bool RegisterTheOneAlarmObserver(hal::AlarmObserver* aObserver);
 
 /**
  * Unregister the alarm observer.  Doing so will implicitly cancel any
  * programmed alarm.
  */
 void UnregisterTheOneAlarmObserver();
 
 /**
@@ -460,17 +460,17 @@ void NotifyAlarmFired();
  * real-time clock is changed; that is, this alarm respects changes to
  * the real-time clock.  Return true iff the alarm was programmed.
  *
  * The alarm can be reprogrammed at any time.
  *
  * This API is currently only allowed to be used from non-sandboxed
  * contexts.
  */
-bool SetAlarm(int32_t aSeconds, int32_t aNanoseconds);
+MOZ_MUST_USE bool SetAlarm(int32_t aSeconds, int32_t aNanoseconds);
 
 /**
  * Set the priority of the given process.
  *
  * Exactly what this does will vary between platforms.  On *nix we might give
  * background processes higher nice values.  On other platforms, we might
  * ignore this call entirely.
  */
@@ -580,17 +580,17 @@ void CancelFMRadioSeek();
 /**
  * Get FM radio band settings by country.
  */
 hal::FMRadioSettings GetFMBandSettings(hal::FMRadioCountry aCountry);
 
 /**
  * Enable RDS data reception
  */
-bool EnableRDS(uint32_t aMask);
+MOZ_MUST_USE bool EnableRDS(uint32_t aMask);
 
 /**
  * Disable RDS data reception
  */
 void DisableRDS();
 
 /**
  * Start a watchdog to compulsively shutdown the system if it hangs.
--- a/hal/HalInternal.h
+++ b/hal/HalInternal.h
@@ -62,17 +62,17 @@ void EnableSwitchNotifications(hal::Swit
 /**
  * Disable switch notifications from the backend
  */
 void DisableSwitchNotifications(hal::SwitchDevice aDevice);
 
 /**
  * Enable alarm notifications from the backend.
  */
-bool EnableAlarm();
+MOZ_MUST_USE bool EnableAlarm();
 
 /**
  * Disable alarm notifications from the backend.
  */
 void DisableAlarm();
 
 /**
  * Enable system clock change notifications from the backend.