OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CC_ANIMATION_ANIMATION_HOST_H_ | 5 #ifndef CC_ANIMATION_ANIMATION_HOST_H_ |
6 #define CC_ANIMATION_ANIMATION_HOST_H_ | 6 #define CC_ANIMATION_ANIMATION_HOST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <unordered_map> | 9 #include <unordered_map> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "cc/animation/animation.h" | 15 #include "cc/animation/animation.h" |
16 #include "cc/base/cc_export.h" | 16 #include "cc/animation/animation_export.h" |
17 #include "cc/trees/mutator_host.h" | 17 #include "cc/trees/mutator_host.h" |
18 #include "cc/trees/mutator_host_client.h" | 18 #include "cc/trees/mutator_host_client.h" |
19 #include "ui/gfx/geometry/box_f.h" | 19 #include "ui/gfx/geometry/box_f.h" |
20 #include "ui/gfx/geometry/vector2d_f.h" | 20 #include "ui/gfx/geometry/vector2d_f.h" |
21 | 21 |
22 namespace gfx { | 22 namespace gfx { |
23 class ScrollOffset; | 23 class ScrollOffset; |
24 } | 24 } |
25 | 25 |
26 namespace cc { | 26 namespace cc { |
27 | 27 |
28 class AnimationPlayer; | 28 class AnimationPlayer; |
29 class AnimationTimeline; | 29 class AnimationTimeline; |
30 class ElementAnimations; | 30 class ElementAnimations; |
31 class LayerTreeHost; | 31 class LayerTreeHost; |
32 class ScrollOffsetAnimations; | 32 class ScrollOffsetAnimations; |
33 class ScrollOffsetAnimationsImpl; | 33 class ScrollOffsetAnimationsImpl; |
34 | 34 |
35 enum class ThreadInstance { MAIN, IMPL }; | 35 enum class ThreadInstance { MAIN, IMPL }; |
36 | 36 |
37 // An AnimationHost contains all the state required to play animations. | 37 // An AnimationHost contains all the state required to play animations. |
38 // Specifically, it owns all the AnimationTimelines objects. | 38 // Specifically, it owns all the AnimationTimelines objects. |
39 // There is just one AnimationHost for LayerTreeHost on main renderer thread | 39 // There is just one AnimationHost for LayerTreeHost on main renderer thread |
40 // and just one AnimationHost for LayerTreeHostImpl on impl thread. | 40 // and just one AnimationHost for LayerTreeHostImpl on impl thread. |
41 // We synchronize them during the commit process in a one-way data flow process | 41 // We synchronize them during the commit process in a one-way data flow process |
42 // (PushPropertiesTo). | 42 // (PushPropertiesTo). |
43 // An AnimationHost talks to its correspondent LayerTreeHost via | 43 // An AnimationHost talks to its correspondent LayerTreeHost via |
44 // MutatorHostClient interface. | 44 // MutatorHostClient interface. |
45 class CC_EXPORT AnimationHost : public NON_EXPORTED_BASE(MutatorHost) { | 45 class CC_ANIMATION_EXPORT AnimationHost |
| 46 : public NON_EXPORTED_BASE(MutatorHost) { |
46 public: | 47 public: |
47 using ElementToAnimationsMap = | 48 using ElementToAnimationsMap = |
48 std::unordered_map<ElementId, | 49 std::unordered_map<ElementId, |
49 scoped_refptr<ElementAnimations>, | 50 scoped_refptr<ElementAnimations>, |
50 ElementIdHash>; | 51 ElementIdHash>; |
51 | 52 |
52 static std::unique_ptr<AnimationHost> CreateMainInstance(); | 53 static std::unique_ptr<AnimationHost> CreateMainInstance(); |
53 static std::unique_ptr<AnimationHost> CreateForTesting( | 54 static std::unique_ptr<AnimationHost> CreateForTesting( |
54 ThreadInstance thread_instance); | 55 ThreadInstance thread_instance); |
55 ~AnimationHost() override; | 56 ~AnimationHost() override; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 206 |
206 bool supports_scroll_animations_; | 207 bool supports_scroll_animations_; |
207 bool needs_push_properties_; | 208 bool needs_push_properties_; |
208 | 209 |
209 DISALLOW_COPY_AND_ASSIGN(AnimationHost); | 210 DISALLOW_COPY_AND_ASSIGN(AnimationHost); |
210 }; | 211 }; |
211 | 212 |
212 } // namespace cc | 213 } // namespace cc |
213 | 214 |
214 #endif // CC_ANIMATION_ANIMATION_HOST_H_ | 215 #endif // CC_ANIMATION_ANIMATION_HOST_H_ |
OLD | NEW |