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

Unified Diff: Source/core/animation/AnimationPlayer.h

Issue 638313002: Web Animations: Overhaul and trace play state in AnimationPlayer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Don't set compositor pending when paused for testing Created 6 years, 2 months 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
« no previous file with comments | « no previous file | Source/core/animation/AnimationPlayer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/AnimationPlayer.h
diff --git a/Source/core/animation/AnimationPlayer.h b/Source/core/animation/AnimationPlayer.h
index c1ab1d8b2e0ba92ce92df6def6368f583ec47f92..5629ca483c066294dc82963f49bc11fe634e97f2 100644
--- a/Source/core/animation/AnimationPlayer.h
+++ b/Source/core/animation/AnimationPlayer.h
@@ -74,20 +74,20 @@ public:
double currentTime();
void setCurrentTime(double newCurrentTime);
- double calculateCurrentTime() const;
- double currentTimeInternal();
- void setCurrentTimeInternal(double newCurrentTime, TimingUpdateReason = TimingUpdateOnDemand);
+ double currentTimeInternal() const;
+ void setCurrentTimeInternal(double newCurrentTime, TimingUpdateReason = TimingUpdateOnDemand);
bool paused() const { return m_paused && !m_isPausedForTesting; }
- String playState();
- AnimationPlayState playStateInternal();
+ static const char* playStateString(AnimationPlayState);
+ String playState() { return playStateString(playStateInternal()); }
+ AnimationPlayState playStateInternal() const;
void pause();
void play();
void reverse();
void finish(ExceptionState&);
- bool finished() { return !m_idle && limited(currentTimeInternal()); }
- bool playing() { return !(finished() || m_paused || m_isPausedForTesting || m_idle); }
+ bool finished() const { return m_playState != Idle && limited(currentTimeInternal()); }
+ bool playing() const { return !(playStateInternal() == Idle || finished() || m_paused || m_isPausedForTesting); }
// FIXME: Resolve whether finished() should just return the flag, and
// remove this method.
bool finishedInternal() const { return m_finished; }
@@ -136,6 +136,7 @@ public:
bool hasActiveAnimationsOnCompositor();
void setCompositorPending(bool sourceChanged = false);
void notifyCompositorStartTime(double timelineTime);
+ void notifyStartTime(double timelineTime);
void preCommit(bool startOnCompositor);
@@ -160,16 +161,21 @@ public:
private:
AnimationPlayer(ExecutionContext*, AnimationTimeline&, AnimationNode*);
+
double sourceEnd() const;
bool limited(double currentTime) const;
- void setPlaybackRateInternal(double);
- void updateCurrentTimingState(TimingUpdateReason);
+
+ AnimationPlayState calculatePlayState();
+ double calculateCurrentTime() const;
+
void unpauseInternal();
void uncancel();
- void setFinished(bool);
+ void setPlaybackRateInternal(double);
+ void updateCurrentTimingState(TimingUpdateReason);
- double m_playbackRate;
+ AnimationPlayState m_playState;
+ double m_playbackRate;
double m_startTime;
double m_holdTime;
@@ -215,13 +221,29 @@ private:
CompositorAction pendingAction;
};
+ enum CompositorPendingChange {
+ SetCompositorPending,
+ SetCompositorPendingWithSourceChanged,
+ DoNotSetCompositorPending,
+ };
+
+ class PlayStateUpdateScope {
+ STACK_ALLOCATED();
+ public:
+ PlayStateUpdateScope(AnimationPlayer&, TimingUpdateReason, CompositorPendingChange = SetCompositorPending);
+ ~PlayStateUpdateScope();
+ private:
+ AnimationPlayer& m_player;
+ AnimationPlayState m_initial;
+ CompositorPendingChange m_compositorPendingChange;
+ };
+
// This mirrors the known compositor state. It is created when a compositor
// animation is started. Updated once the start time is known and each time
// modifications are pushed to the compositor.
OwnPtr<CompositorState> m_compositorState;
bool m_compositorPending;
bool m_currentTimePending;
- bool m_idle;
};
} // namespace blink
« no previous file with comments | « no previous file | Source/core/animation/AnimationPlayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698