Bug 1078122 part 2 - Encapsulate mIsRunningOnCompositor in AnimationPlayer; r=dholbert

This commit is contained in:
Brian Birtles 2014-10-20 13:55:46 +09:00
parent 75670f2118
commit b46fbc6e51
4 changed files with 9 additions and 6 deletions

View File

@ -35,9 +35,9 @@ protected:
public: public:
explicit AnimationPlayer(AnimationTimeline* aTimeline) explicit AnimationPlayer(AnimationTimeline* aTimeline)
: mIsRunningOnCompositor(false) : mTimeline(aTimeline)
, mTimeline(aTimeline)
, mIsPaused(false) , mIsPaused(false)
, mIsRunningOnCompositor(false)
{ {
} }
@ -92,6 +92,9 @@ public:
return GetSource() && GetSource()->IsInEffect(); return GetSource() && GetSource()->IsInEffect();
} }
void SetIsRunningOnCompositor() { mIsRunningOnCompositor = true; }
void ClearIsRunningOnCompositor() { mIsRunningOnCompositor = false; }
// Returns true if this animation does not currently need to update // Returns true if this animation does not currently need to update
// style on the main thread (e.g. because it is empty, or is // style on the main thread (e.g. because it is empty, or is
// running on the compositor). // running on the compositor).
@ -99,7 +102,6 @@ public:
// The beginning of the delay period. // The beginning of the delay period.
Nullable<TimeDuration> mStartTime; // Timeline timescale Nullable<TimeDuration> mStartTime; // Timeline timescale
bool mIsRunningOnCompositor;
nsRefPtr<AnimationTimeline> mTimeline; nsRefPtr<AnimationTimeline> mTimeline;
nsRefPtr<Animation> mSource; nsRefPtr<Animation> mSource;
@ -111,6 +113,7 @@ protected:
Nullable<TimeDuration> mHoldTime; // Player timescale Nullable<TimeDuration> mHoldTime; // Player timescale
bool mIsPaused; bool mIsPaused;
bool mIsRunningOnCompositor;
}; };
} // namespace dom } // namespace dom

View File

@ -412,7 +412,7 @@ AddAnimationsForProperty(nsIFrame* aFrame, nsCSSProperty aProperty,
continue; continue;
} }
AddAnimationForProperty(aFrame, aProperty, player, aLayer, aData, aPending); AddAnimationForProperty(aFrame, aProperty, player, aLayer, aData, aPending);
player->mIsRunningOnCompositor = true; player->SetIsRunningOnCompositor();
} }
} }

View File

@ -311,7 +311,7 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
} }
// Reset compositor state so animation will be re-synchronized. // Reset compositor state so animation will be re-synchronized.
oldPlayer->mIsRunningOnCompositor = false; oldPlayer->ClearIsRunningOnCompositor();
// Handle changes in play state. // Handle changes in play state.
// CSSAnimationPlayer takes care of override behavior so that, // CSSAnimationPlayer takes care of override behavior so that,

View File

@ -834,7 +834,7 @@ nsTransitionManager::FlushTransitions(FlushFlags aFlags)
} else if ((computedTiming.mPhase == } else if ((computedTiming.mPhase ==
ComputedTiming::AnimationPhase_Active) && ComputedTiming::AnimationPhase_Active) &&
canThrottleTick && canThrottleTick &&
!player->mIsRunningOnCompositor) { !player->IsRunningOnCompositor()) {
// Start a transition with a delay where we should start the // Start a transition with a delay where we should start the
// transition proper. // transition proper.
collection->UpdateAnimationGeneration(mPresContext); collection->UpdateAnimationGeneration(mPresContext);