Bug 1188251 part 7 - Move WillRefresh to CommonAnimationManager; r=dholbert
authorBrian Birtles <birtles@gmail.com>
Mon, 17 Aug 2015 13:59:44 +0900
changeset 258001 2be8060a496921b76fad7c48c47bf4ff195d6401
parent 258000 8cbb80c89aefa630ac067191b17d5e2a67bb43d2
child 258002 2eddf957653d6d1a790ac681a8d86282295e4526
push id29238
push userryanvm@gmail.com
push dateMon, 17 Aug 2015 13:06:57 +0000
treeherdermozilla-central@a6eeb28458fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1188251
milestone43.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 1188251 part 7 - Move WillRefresh to CommonAnimationManager; r=dholbert nsTransitionManager::WillRefresh and nsAnimationManager::WillRefresh are now identical and all methods they call exist on CommonAnimationManager so we can unify them there.
layout/style/AnimationCommon.cpp
layout/style/AnimationCommon.h
layout/style/nsAnimationManager.cpp
layout/style/nsAnimationManager.h
layout/style/nsTransitionManager.cpp
layout/style/nsTransitionManager.h
--- a/layout/style/AnimationCommon.cpp
+++ b/layout/style/AnimationCommon.cpp
@@ -461,16 +461,34 @@ CommonAnimationManager::LayerAnimationRe
   for (size_t i = 0; i < ArrayLength(info); ++i) {
     if (aProperty == info[i].mProperty) {
       return &info[i];
     }
   }
   return nullptr;
 }
 
+/* virtual */ void
+CommonAnimationManager::WillRefresh(TimeStamp aTime)
+{
+  MOZ_ASSERT(mPresContext,
+             "refresh driver should not notify additional observers "
+             "after pres context has been destroyed");
+  if (!mPresContext->GetPresShell()) {
+    // Someone might be keeping mPresContext alive past the point
+    // where it has been torn down; don't bother doing anything in
+    // this case.  But do get rid of all our animations so we stop
+    // triggering refreshes.
+    RemoveAllElementCollections();
+    return;
+  }
+
+  FlushAnimations(Can_Throttle);
+}
+
 #ifdef DEBUG
 /* static */ void
 CommonAnimationManager::Initialize()
 {
   const auto& info = CommonAnimationManager::sLayerAnimationInfo;
   for (size_t i = 0; i < ArrayLength(info); i++) {
     auto record = info[i];
     MOZ_ASSERT(nsCSSProps::PropHasFlags(record.mProperty,
--- a/layout/style/AnimationCommon.h
+++ b/layout/style/AnimationCommon.h
@@ -57,16 +57,19 @@ public:
 #ifdef MOZ_XUL
   virtual void RulesMatching(XULTreeRuleProcessorData* aData) override;
 #endif
   virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf)
     const MOZ_MUST_OVERRIDE override;
   virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf)
     const MOZ_MUST_OVERRIDE override;
 
+  // nsARefreshObserver
+  void WillRefresh(TimeStamp aTime) override;
+
 #ifdef DEBUG
   static void Initialize();
 #endif
 
   // NOTE:  This can return null after Disconnect().
   nsPresContext* PresContext() const { return mPresContext; }
 
   /**
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -934,26 +934,8 @@ nsAnimationManager::UpdateCascadeResults
     aElementAnimations->UpdateAnimationGeneration(presContext);
     aElementAnimations->PostUpdateLayerAnimations();
 
     // Invalidate our style rule.
     aElementAnimations->mNeedsRefreshes = true;
     aElementAnimations->mStyleRuleRefreshTime = TimeStamp();
   }
 }
-
-/* virtual */ void
-nsAnimationManager::WillRefresh(mozilla::TimeStamp aTime)
-{
-  MOZ_ASSERT(mPresContext,
-             "refresh driver should not notify additional observers "
-             "after pres context has been destroyed");
-  if (!mPresContext->GetPresShell()) {
-    // Someone might be keeping mPresContext alive past the point
-    // where it has been torn down; don't bother doing anything in
-    // this case.  But do get rid of all our transitions so we stop
-    // triggering refreshes.
-    RemoveAllElementCollections();
-    return;
-  }
-
-  FlushAnimations(Can_Throttle);
-}
--- a/layout/style/nsAnimationManager.h
+++ b/layout/style/nsAnimationManager.h
@@ -250,19 +250,16 @@ public:
   void MaybeUpdateCascadeResults(mozilla::AnimationCollection* aCollection);
 
   // nsIStyleRuleProcessor (parts)
   virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf)
     const MOZ_MUST_OVERRIDE override;
   virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
     const MOZ_MUST_OVERRIDE override;
 
-  // nsARefreshObserver
-  virtual void WillRefresh(mozilla::TimeStamp aTime) override;
-
   /**
    * Return the style rule that RulesMatching should add for
    * aStyleContext.  This might be different from what RulesMatching
    * actually added during aStyleContext's construction because the
    * element's animation-name may have changed.  (However, this does
    * return null during the non-animation restyling phase, as
    * RulesMatching does.)
    *
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -882,26 +882,8 @@ nsTransitionManager::SizeOfExcludingThis
   // - mEventDispatcher
 }
 
 /* virtual */ size_t
 nsTransitionManager::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
 {
   return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
 }
-
-/* virtual */ void
-nsTransitionManager::WillRefresh(mozilla::TimeStamp aTime)
-{
-  MOZ_ASSERT(mPresContext,
-             "refresh driver should not notify additional observers "
-             "after pres context has been destroyed");
-  if (!mPresContext->GetPresShell()) {
-    // Someone might be keeping mPresContext alive past the point
-    // where it has been torn down; don't bother doing anything in
-    // this case.  But do get rid of all our transitions so we stop
-    // triggering refreshes.
-    RemoveAllElementCollections();
-    return;
-  }
-
-  FlushAnimations(Can_Throttle);
-}
--- a/layout/style/nsTransitionManager.h
+++ b/layout/style/nsTransitionManager.h
@@ -269,19 +269,16 @@ public:
     return mInAnimationOnlyStyleUpdate;
   }
 
   virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
     MOZ_MUST_OVERRIDE override;
   virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
     MOZ_MUST_OVERRIDE override;
 
-  // nsARefreshObserver
-  virtual void WillRefresh(mozilla::TimeStamp aTime) override;
-
   void QueueEvent(mozilla::TransitionEventInfo&& aEventInfo)
   {
     mEventDispatcher.QueueEvent(
       mozilla::Forward<mozilla::TransitionEventInfo>(aEventInfo));
   }
 
   void DispatchEvents()  { mEventDispatcher.DispatchEvents(mPresContext); }
   void ClearEventQueue() { mEventDispatcher.ClearEventQueue(); }