Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Unified Diff: Source/core/animation/CompositorPendingAnimations.cpp

Issue 651103002: Web Animations: Compositor start notification should only apply to animations in a matching group (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/animation/CompositorPendingAnimations.cpp
diff --git a/Source/core/animation/CompositorPendingAnimations.cpp b/Source/core/animation/CompositorPendingAnimations.cpp
index d8ec11080c74c20b0da2db04ee76d110737a5997..ed6f2ffe397d1f7e31cece3241da6e249132bef8 100644
--- a/Source/core/animation/CompositorPendingAnimations.cpp
+++ b/Source/core/animation/CompositorPendingAnimations.cpp
@@ -62,11 +62,16 @@ bool CompositorPendingAnimations::update(bool startOnCompositor)
WillBeHeapVector<RefPtrWillBeMember<AnimationPlayer> > players;
players.swap(m_pending);
+ int compositorGroup = ++m_compositorGroup;
+ if (compositorGroup == 0) {
+ // Wrap around, skipping 0.
+ compositorGroup = ++m_compositorGroup;
+ }
for (size_t i = 0; i < players.size(); ++i) {
AnimationPlayer& player = *players[i].get();
bool hadCompositorAnimation = player.hasActiveAnimationsOnCompositor();
- player.preCommit(startOnCompositor);
+ player.preCommit(compositorGroup, startOnCompositor);
if (player.hasActiveAnimationsOnCompositor() && !hadCompositorAnimation) {
startedSynchronizedOnCompositor = true;
}
@@ -114,34 +119,32 @@ bool CompositorPendingAnimations::update(bool startOnCompositor)
}
// If not, go ahead and start any animations that were waiting.
- notifyAnimationStarted(monotonicallyIncreasingTime(), false);
+ notifyCompositorAnimationStarted(monotonicallyIncreasingTime());
ASSERT(m_pending.isEmpty());
return false;
}
-void CompositorPendingAnimations::notifyAnimationStarted(double monotonicAnimationStartTime, bool startedOnCompositor)
+void CompositorPendingAnimations::notifyCompositorAnimationStarted(double monotonicAnimationStartTime, int compositorGroup)
{
TRACE_EVENT0("blink", "CompositorPendingAnimations::notifyCompositorAnimationStarted");
- for (size_t i = 0; i < m_waitingForCompositorAnimationStart.size(); ++i) {
- AnimationPlayer* player = m_waitingForCompositorAnimationStart[i].get();
- if (player->hasStartTime())
+ WillBeHeapVector<RefPtrWillBeMember<AnimationPlayer> > players;
+ players.swap(m_waitingForCompositorAnimationStart);
+
+ for (size_t i = 0; i < players.size(); ++i) {
+ AnimationPlayer* player = players[i].get();
+ if (player->hasStartTime() || player->playStateInternal() != AnimationPlayer::Pending) {
+ // Already started or no longer relevant.
continue;
- double effectiveStartTime = monotonicAnimationStartTime - player->timeline()->zeroTime();
- if (startedOnCompositor) {
- player->notifyCompositorStartTime(effectiveStartTime);
- } else {
- player->notifyStartTime(effectiveStartTime);
}
+ if (compositorGroup && player->compositorGroup() != compositorGroup) {
+ // Still waiting.
+ m_waitingForCompositorAnimationStart.append(player);
+ continue;
+ }
+ player->notifyCompositorStartTime(monotonicAnimationStartTime - player->timeline()->zeroTime());
}
- m_waitingForCompositorAnimationStart.clear();
-}
-
-void CompositorPendingAnimations::notifyCompositorAnimationStarted(double monotonicAnimationStartTime)
-{
- TRACE_EVENT0("blink", "CompositorPendingAnimations::notifyCompositorAnimationStarted");
- notifyAnimationStarted(monotonicAnimationStartTime, true);
}
void CompositorPendingAnimations::trace(Visitor* visitor)
« no previous file with comments | « Source/core/animation/CompositorPendingAnimations.h ('k') | Source/core/rendering/compositing/CompositedLayerMapping.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698