Bug 1341987 - Part 1: Rename AnimationRuleRefreshTime to LastTransformSyncTime. r=birtles
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Mon, 27 Feb 2017 11:29:27 +0900
changeset 374020 6a83f222b4204f3b94fc9b789f2bb1765270b991
parent 374019 415f94692ed753a42dd38c99782a57f53b681581
child 374021 b2d04e22fa338410f1eb3922e58458922f647562
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1341987
milestone54.0a1
Bug 1341987 - Part 1: Rename AnimationRuleRefreshTime to LastTransformSyncTime. r=birtles It's just for transform animations on the compositor. MozReview-Commit-ID: 288CcG4kko4
dom/animation/EffectCompositor.cpp
dom/animation/EffectSet.h
dom/animation/KeyframeEffectReadOnly.cpp
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -488,17 +488,17 @@ EffectCompositor::GetServoAnimationRule(
   const nsCSSPropertyIDSet propertiesToSkip;
   for (KeyframeEffectReadOnly* effect : sortedEffectList) {
     effect->GetAnimation()->ComposeStyle(animRule, propertiesToSkip);
   }
 
   MOZ_ASSERT(effectSet == EffectSet::GetEffectSet(aElement, aPseudoType),
              "EffectSet should not change while composing style");
 
-  effectSet->UpdateAnimationRuleRefreshTime(
+  effectSet->UpdateLastTransformSyncTime(
     aCascadeLevel, mPresContext->RefreshDriver()->MostRecentRefresh());
   return animRule.mServo;
 }
 
 void
 EffectCompositor::ClearElementsToRestyle()
 {
   MOZ_ASSERT(NS_IsMainThread());
@@ -760,17 +760,17 @@ EffectCompositor::ComposeAnimationRule(d
     : effects->PropertiesForAnimationsLevel();
   for (KeyframeEffectReadOnly* effect : sortedEffectList) {
     effect->GetAnimation()->ComposeStyle(animRule, propertiesToSkip);
   }
 
   MOZ_ASSERT(effects == EffectSet::GetEffectSet(aElement, aPseudoType),
              "EffectSet should not change while composing style");
 
-  effects->UpdateAnimationRuleRefreshTime(aCascadeLevel, aRefreshTime);
+  effects->UpdateLastTransformSyncTime(aCascadeLevel, aRefreshTime);
 }
 
 /* static */ void
 EffectCompositor::GetOverriddenProperties(nsStyleContext* aStyleContext,
                                           EffectSet& aEffectSet,
                                           nsCSSPropertyIDSet&
                                             aPropertiesOverridden)
 {
--- a/dom/animation/EffectSet.h
+++ b/dom/animation/EffectSet.h
@@ -164,26 +164,26 @@ public:
   size_t Count() const { return mEffects.Count(); }
 
   struct AnimationRule&
   AnimationRule(EffectCompositor::CascadeLevel aCascadeLevel)
   {
     return mAnimationRule[aCascadeLevel];
   }
 
-  const TimeStamp& AnimationRuleRefreshTime(EffectCompositor::CascadeLevel
-                                              aCascadeLevel) const
+  const TimeStamp& LastTransformSyncTime(EffectCompositor::CascadeLevel
+                                           aCascadeLevel) const
   {
-    return mAnimationRuleRefreshTime[aCascadeLevel];
+    return mLastTransformSyncTime[aCascadeLevel];
   }
-  void UpdateAnimationRuleRefreshTime(EffectCompositor::CascadeLevel
-                                        aCascadeLevel,
-                                      const TimeStamp& aRefreshTime)
+  void UpdateLastTransformSyncTime(EffectCompositor::CascadeLevel
+                                     aCascadeLevel,
+                                   const TimeStamp& aRefreshTime)
   {
-    mAnimationRuleRefreshTime[aCascadeLevel] = aRefreshTime;
+    mLastTransformSyncTime[aCascadeLevel] = aRefreshTime;
   }
 
   bool CascadeNeedsUpdate() const { return mCascadeNeedsUpdate; }
   void MarkCascadeNeedsUpdate() { mCascadeNeedsUpdate = true; }
   void MarkCascadeUpdated() { mCascadeNeedsUpdate = false; }
 
   void UpdateAnimationGeneration(nsPresContext* aPresContext);
   uint64_t GetAnimationGeneration() const { return mAnimationGeneration; }
@@ -209,24 +209,24 @@ private:
   // style without animation, we need to not use them so that we can
   // detect any new changes; if necessary we restyle immediately
   // afterwards with animation.
   EnumeratedArray<EffectCompositor::CascadeLevel,
                   EffectCompositor::CascadeLevel(
                     EffectCompositor::kCascadeLevelCount),
                   mozilla::AnimationRule> mAnimationRule;
 
-  // A parallel array to mAnimationRule that records the refresh driver
-  // timestamp when the rule was last updated. This is used for certain
-  // animations which are updated only periodically (e.g. transform animations
-  // running on the compositor that affect the scrollable overflow region).
+  // Refresh driver timestamp from the moment when transform animations in this
+  // effect set were last updated and sent to the compositor. This is used for
+  // transform animations that run on the compositor but need to be updated on
+  // the main thread periodically (e.g. so scrollbars can be updated).
   EnumeratedArray<EffectCompositor::CascadeLevel,
                   EffectCompositor::CascadeLevel(
                     EffectCompositor::kCascadeLevelCount),
-                  TimeStamp> mAnimationRuleRefreshTime;
+                  TimeStamp> mLastTransformSyncTime;
 
   // Dirty flag to represent when the mPropertiesWithImportantRules and
   // mPropertiesForAnimationsLevel on effects in this set might need to be
   // updated.
   //
   // Set to true any time the set of effects is changed or when
   // one the effects goes in or out of the "in effect" state.
   bool mCascadeNeedsUpdate;
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -1369,21 +1369,21 @@ KeyframeEffectReadOnly::CanThrottleTrans
     presContext->RefreshDriver()->MostRecentRefresh();
 
   EffectSet* effectSet = EffectSet::GetEffectSet(mTarget->mElement,
                                                  mTarget->mPseudoType);
   MOZ_ASSERT(effectSet, "CanThrottleTransformChanges is expected to be called"
                         " on an effect in an effect set");
   MOZ_ASSERT(mAnimation, "CanThrottleTransformChanges is expected to be called"
                          " on an effect with a parent animation");
-  TimeStamp animationRuleRefreshTime =
-    effectSet->AnimationRuleRefreshTime(mAnimation->CascadeLevel());
+  TimeStamp lastSyncTime =
+    effectSet->LastTransformSyncTime(mAnimation->CascadeLevel());
   // If this animation can cause overflow, we can throttle some of the ticks.
-  if (!animationRuleRefreshTime.IsNull() &&
-      (now - animationRuleRefreshTime) < OverflowRegionRefreshInterval()) {
+  if (!lastSyncTime.IsNull() &&
+      (now - lastSyncTime) < OverflowRegionRefreshInterval()) {
     return true;
   }
 
   // If the nearest scrollable ancestor has overflow:hidden,
   // we don't care about overflow.
   nsIScrollableFrame* scrollable =
     nsLayoutUtils::GetNearestScrollableFrame(&aFrame);
   if (!scrollable) {