Bug 1494745 part 3 - Make nsRefreshDriver::AddTimerAdjustmentObserver void since it's infallible. r=bz
authorMats Palmgren <mats@mozilla.com>
Sun, 14 Oct 2018 18:12:23 +0200
changeset 441155 7fa23df410e43bab5f4c264b7095fc36eee44f35
parent 441154 e0debd3f26f6d4ff98c8ede64aa05111864c56d0
child 441156 1ec0c8e82a3d11acae7dd7cfbc81fe0a9d1ef024
push id108916
push usermpalmgren@mozilla.com
push dateSun, 14 Oct 2018 16:12:35 +0000
treeherdermozilla-inbound@2b7fce8c4f92 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1494745
milestone64.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 1494745 part 3 - Make nsRefreshDriver::AddTimerAdjustmentObserver void since it's infallible. r=bz mTimerAdjustmentObservers is a nsTObserverArray which is infallible, so no need to check the return value from AppendElement (which a later patch in this series will remove).
layout/base/nsRefreshDriver.cpp
layout/base/nsRefreshDriver.h
--- a/layout/base/nsRefreshDriver.cpp
+++ b/layout/base/nsRefreshDriver.cpp
@@ -1216,31 +1216,30 @@ nsRefreshDriver::AddRefreshObserver(nsAR
 bool
 nsRefreshDriver::RemoveRefreshObserver(nsARefreshObserver* aObserver,
                                        FlushType aFlushType)
 {
   ObserverArray& array = ArrayFor(aFlushType);
   return array.RemoveElement(aObserver);
 }
 
-bool
+void
 nsRefreshDriver::AddTimerAdjustmentObserver(
-  nsATimerAdjustmentObserver *aObserver)
+  nsATimerAdjustmentObserver* aObserver)
 {
   MOZ_ASSERT(!mTimerAdjustmentObservers.Contains(aObserver));
-
-  return mTimerAdjustmentObservers.AppendElement(aObserver) != nullptr;
+  mTimerAdjustmentObservers.AppendElement(aObserver);
 }
 
-bool
+void
 nsRefreshDriver::RemoveTimerAdjustmentObserver(
-  nsATimerAdjustmentObserver *aObserver)
+  nsATimerAdjustmentObserver* aObserver)
 {
   MOZ_ASSERT(mTimerAdjustmentObservers.Contains(aObserver));
-  return mTimerAdjustmentObservers.RemoveElement(aObserver);
+  mTimerAdjustmentObservers.RemoveElement(aObserver);
 }
 
 void
 nsRefreshDriver::PostScrollEvent(mozilla::Runnable* aScrollEvent)
 {
   mScrollEvents.AppendElement(aScrollEvent);
   EnsureTimerStarted();
 }
--- a/layout/base/nsRefreshDriver.h
+++ b/layout/base/nsRefreshDriver.h
@@ -140,18 +140,18 @@ public:
   void AddRefreshObserver(nsARefreshObserver* aObserver,
                           mozilla::FlushType aFlushType);
   bool RemoveRefreshObserver(nsARefreshObserver* aObserver,
                              mozilla::FlushType aFlushType);
   /**
    * Add / remove an observer wants to know the time when the refresh driver
    * updated the most recent refresh time due to its active timer changes.
    */
-  bool AddTimerAdjustmentObserver(nsATimerAdjustmentObserver *aObserver);
-  bool RemoveTimerAdjustmentObserver(nsATimerAdjustmentObserver *aObserver);
+  void AddTimerAdjustmentObserver(nsATimerAdjustmentObserver* aObserver);
+  void RemoveTimerAdjustmentObserver(nsATimerAdjustmentObserver* aObserver);
 
   void PostScrollEvent(mozilla::Runnable* aScrollEvent);
   void DispatchScrollEvents();
 
   /**
    * Add an observer that will be called after each refresh. The caller
    * must remove the observer before it is deleted. This does not trigger
    * refresh driver ticks.