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

Side by Side Diff: ui/compositor/layer_animator_collection.h

Issue 427103002: compositor: Add rAF-like functionality for the UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_ 5 #ifndef UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_
6 #define UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_ 6 #define UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "ui/compositor/animation_frame_task.h"
13 #include "ui/compositor/compositor_export.h" 14 #include "ui/compositor/compositor_export.h"
14 15
15 namespace base { 16 namespace base {
16 class TimeTicks; 17 class TimeTicks;
17 } 18 }
18 19
19 namespace ui { 20 namespace ui {
20 21
21 class LayerAnimator; 22 class LayerAnimator;
22 23
23 class COMPOSITOR_EXPORT LayerAnimatorCollectionDelegate {
24 public:
25 virtual ~LayerAnimatorCollectionDelegate() {}
26
27 virtual void ScheduleAnimationForLayerCollection() = 0;
28 };
29
30 // A collection of LayerAnimators that should be updated at each animation step 24 // A collection of LayerAnimators that should be updated at each animation step
31 // in the compositor. 25 // in the compositor.
32 class COMPOSITOR_EXPORT LayerAnimatorCollection { 26 class COMPOSITOR_EXPORT LayerAnimatorCollection : public AnimationFrameTask {
33 public: 27 public:
34 explicit LayerAnimatorCollection(LayerAnimatorCollectionDelegate* delegate); 28 explicit LayerAnimatorCollection(AnimationFrameTaskProvider* provider);
35 ~LayerAnimatorCollection(); 29 virtual ~LayerAnimatorCollection();
36 30
37 void StartAnimator(scoped_refptr<LayerAnimator> animator); 31 void StartAnimator(scoped_refptr<LayerAnimator> animator);
38 void StopAnimator(scoped_refptr<LayerAnimator> animator); 32 void StopAnimator(scoped_refptr<LayerAnimator> animator);
39 33
40 bool HasActiveAnimators() const; 34 bool HasActiveAnimators() const;
41 35
42 void Progress(base::TimeTicks now); 36 // AnimationFrameTask:
37 virtual AnimationFrameTaskStatus Progress(base::TimeTicks now) OVERRIDE;
43 38
44 base::TimeTicks last_tick_time() const { return last_tick_time_; } 39 base::TimeTicks last_tick_time() const { return last_tick_time_; }
45 40
46 private: 41 private:
47 LayerAnimatorCollectionDelegate* delegate_; 42 AnimationFrameTaskProvider* provider_;
48 base::TimeTicks last_tick_time_; 43 base::TimeTicks last_tick_time_;
49 std::set<scoped_refptr<LayerAnimator> > animators_; 44 std::set<scoped_refptr<LayerAnimator> > animators_;
45 scoped_ptr<ScopedAnimationFrameTask> raf_callback_;
50 46
51 DISALLOW_COPY_AND_ASSIGN(LayerAnimatorCollection); 47 DISALLOW_COPY_AND_ASSIGN(LayerAnimatorCollection);
52 }; 48 };
53 49
54 } // namespace ui 50 } // namespace ui
55 51
56 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_ 52 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698