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

Unified Diff: ui/compositor/layer_animator.h

Issue 291843012: compositor: Tick the UI animations from cc, instead of from timer callbacks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 6 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 | « ui/compositor/layer_animation_delegate.h ('k') | ui/compositor/layer_animator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_animator.h
diff --git a/ui/compositor/layer_animator.h b/ui/compositor/layer_animator.h
index a1e0ad2cd44a382a043d4e4de757ef5adf716e33..69744f8c46221f4e1c8db812db66ec27d9ab4ca0 100644
--- a/ui/compositor/layer_animator.h
+++ b/ui/compositor/layer_animator.h
@@ -9,13 +9,13 @@
#include <vector>
#include "base/compiler_specific.h"
+#include "base/gtest_prod_util.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
#include "base/time/time.h"
#include "ui/compositor/compositor_export.h"
#include "ui/compositor/layer_animation_element.h"
-#include "ui/gfx/animation/animation_container_element.h"
#include "ui/gfx/animation/tween.h"
namespace gfx {
@@ -29,6 +29,7 @@ class Layer;
class LayerAnimationSequence;
class LayerAnimationDelegate;
class LayerAnimationObserver;
+class LayerAnimatorCollection;
class ScopedLayerAnimationSettings;
// When a property of layer needs to be changed it is set by way of
@@ -40,9 +41,7 @@ class ScopedLayerAnimationSettings;
// ensure that it is not disposed of until it finishes executing. It does this
// by holding a reference to itself for the duration of methods for which it
// must guarantee that |this| is valid.
-class COMPOSITOR_EXPORT LayerAnimator
- : public gfx::AnimationContainerElement,
- public base::RefCounted<LayerAnimator> {
+class COMPOSITOR_EXPORT LayerAnimator : public base::RefCounted<LayerAnimator> {
public:
enum PreemptionStrategy {
IMMEDIATELY_SET_NEW_TARGET,
@@ -188,6 +187,11 @@ class COMPOSITOR_EXPORT LayerAnimator
}
base::TimeTicks last_step_time() const { return last_step_time_; }
+ void Step(base::TimeTicks time_now);
+
+ void AddToCollection(LayerAnimatorCollection* collection);
+ void RemoveFromCollection(LayerAnimatorCollection* collection);
+
protected:
virtual ~LayerAnimator();
@@ -207,6 +211,9 @@ class COMPOSITOR_EXPORT LayerAnimator
friend class base::RefCounted<LayerAnimator>;
friend class ScopedLayerAnimationSettings;
friend class LayerAnimatorTestController;
+ FRIEND_TEST_ALL_PREFIXES(LayerAnimatorTest, AnimatorStartedCorrectly);
+ FRIEND_TEST_ALL_PREFIXES(LayerAnimatorTest,
+ AnimatorRemovedFromCollectionWhenLayerIsDestroyed);
class RunningAnimation {
public:
@@ -225,11 +232,6 @@ class COMPOSITOR_EXPORT LayerAnimator
typedef std::vector<RunningAnimation> RunningAnimations;
typedef std::deque<linked_ptr<LayerAnimationSequence> > AnimationQueue;
- // Implementation of AnimationContainerElement
- virtual void SetStartTime(base::TimeTicks start_time) OVERRIDE;
- virtual void Step(base::TimeTicks time_now) OVERRIDE;
- virtual base::TimeDelta GetTimerInterval() const OVERRIDE;
-
// Finishes all animations by either advancing them to their final state or by
// aborting them.
void StopAnimatingInternal(bool abort);
@@ -307,6 +309,8 @@ class COMPOSITOR_EXPORT LayerAnimator
// Cleans up any running animations that may have been deleted.
void PurgeDeletedAnimations();
+ LayerAnimatorCollection* GetLayerAnimatorCollection();
+
// This is the queue of animations to run.
AnimationQueue animation_queue_;
« no previous file with comments | « ui/compositor/layer_animation_delegate.h ('k') | ui/compositor/layer_animator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698