[email protected] | 9034a28 | 2014-06-05 03:11:47 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_ | ||||
6 | #define UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_ | ||||
7 | |||||
8 | #include <set> | ||||
9 | |||||
10 | #include "base/callback.h" | ||||
avi | 87b8b58 | 2015-12-24 21:35:25 | [diff] [blame] | 11 | #include "base/macros.h" |
[email protected] | 9034a28 | 2014-06-05 03:11:47 | [diff] [blame] | 12 | #include "base/memory/ref_counted.h" |
13 | #include "base/time/time.h" | ||||
[email protected] | 5ffe6d14 | 2014-08-01 16:04:38 | [diff] [blame] | 14 | #include "ui/compositor/compositor_animation_observer.h" |
[email protected] | 9034a28 | 2014-06-05 03:11:47 | [diff] [blame] | 15 | #include "ui/compositor/compositor_export.h" |
16 | |||||
[email protected] | 9034a28 | 2014-06-05 03:11:47 | [diff] [blame] | 17 | namespace ui { |
18 | |||||
[email protected] | 5ffe6d14 | 2014-08-01 16:04:38 | [diff] [blame] | 19 | class Compositor; |
[email protected] | 9034a28 | 2014-06-05 03:11:47 | [diff] [blame] | 20 | class LayerAnimator; |
21 | |||||
[email protected] | 9034a28 | 2014-06-05 03:11:47 | [diff] [blame] | 22 | // A collection of LayerAnimators that should be updated at each animation step |
23 | // in the compositor. | ||||
[email protected] | 5ffe6d14 | 2014-08-01 16:04:38 | [diff] [blame] | 24 | class COMPOSITOR_EXPORT LayerAnimatorCollection |
25 | : public CompositorAnimationObserver { | ||||
[email protected] | 9034a28 | 2014-06-05 03:11:47 | [diff] [blame] | 26 | public: |
[email protected] | 5ffe6d14 | 2014-08-01 16:04:38 | [diff] [blame] | 27 | explicit LayerAnimatorCollection(Compositor* compositor); |
dcheng | 0803879 | 2014-10-21 10:53:26 | [diff] [blame] | 28 | ~LayerAnimatorCollection() override; |
[email protected] | 9034a28 | 2014-06-05 03:11:47 | [diff] [blame] | 29 | |
30 | void StartAnimator(scoped_refptr<LayerAnimator> animator); | ||||
31 | void StopAnimator(scoped_refptr<LayerAnimator> animator); | ||||
32 | |||||
33 | bool HasActiveAnimators() const; | ||||
34 | |||||
[email protected] | 9034a28 | 2014-06-05 03:11:47 | [diff] [blame] | 35 | base::TimeTicks last_tick_time() const { return last_tick_time_; } |
36 | |||||
[email protected] | 5ffe6d14 | 2014-08-01 16:04:38 | [diff] [blame] | 37 | // CompositorAnimationObserver: |
dcheng | 0803879 | 2014-10-21 10:53:26 | [diff] [blame] | 38 | void OnAnimationStep(base::TimeTicks timestamp) override; |
lof84 | adf2ce86 | 2015-06-02 22:23:32 | [diff] [blame] | 39 | void OnCompositingShuttingDown(Compositor* compositor) override; |
[email protected] | 5ffe6d14 | 2014-08-01 16:04:38 | [diff] [blame] | 40 | |
[email protected] | 9034a28 | 2014-06-05 03:11:47 | [diff] [blame] | 41 | private: |
[email protected] | 5ffe6d14 | 2014-08-01 16:04:38 | [diff] [blame] | 42 | Compositor* compositor_; |
[email protected] | 9034a28 | 2014-06-05 03:11:47 | [diff] [blame] | 43 | base::TimeTicks last_tick_time_; |
44 | std::set<scoped_refptr<LayerAnimator> > animators_; | ||||
45 | |||||
46 | DISALLOW_COPY_AND_ASSIGN(LayerAnimatorCollection); | ||||
47 | }; | ||||
48 | |||||
49 | } // namespace ui | ||||
50 | |||||
51 | #endif // UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_ |