OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CompositorMutatorImpl_h | 5 #ifndef CompositorMutatorImpl_h |
6 #define CompositorMutatorImpl_h | 6 #define CompositorMutatorImpl_h |
7 | 7 |
8 #include "core/animation/CustomCompositorAnimationManager.h" | 8 #include "core/animation/CustomCompositorAnimationManager.h" |
9 #include "platform/graphics/CompositorMutator.h" | 9 #include "platform/graphics/CompositorMutator.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
11 #include "platform/heap/HeapAllocator.h" | 11 #include "platform/heap/HeapAllocator.h" |
12 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
13 #include <memory> | 13 #include <memory> |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class CompositorAnimator; | 17 class CompositorAnimator; |
18 class CompositorMutatorClient; | 18 class CompositorMutatorClient; |
| 19 class CompositorProxy; |
19 | 20 |
20 // Fans out requests from the compositor to all of the registered | 21 // Fans out requests from the compositor to all of the registered |
21 // CompositorAnimators which can then mutate layers through their respective | 22 // CompositorAnimators which can then mutate layers through their respective |
22 // mutate interface. Requests for animation frames are received from | 23 // mutate interface. Requests for animation frames are received from |
23 // CompositorAnimators and sent to the compositor to generate a new compositor | 24 // CompositorAnimators and sent to the compositor to generate a new compositor |
24 // frame. | 25 // frame. |
25 // | 26 // |
26 // Should be accessed only on the compositor thread. | 27 // Should be accessed only on the compositor thread. |
27 class CompositorMutatorImpl final : public CompositorMutator { | 28 class CompositorMutatorImpl final : public CompositorMutator { |
28 WTF_MAKE_NONCOPYABLE(CompositorMutatorImpl); | 29 WTF_MAKE_NONCOPYABLE(CompositorMutatorImpl); |
29 | 30 |
30 public: | 31 public: |
31 static std::unique_ptr<CompositorMutatorClient> createClient(); | 32 static std::unique_ptr<CompositorMutatorClient> createClient(); |
32 static CompositorMutatorImpl* create(); | 33 static CompositorMutatorImpl* create(); |
33 | 34 |
34 // CompositorMutator implementation. | 35 // CompositorMutator implementation. |
35 bool mutate(double monotonicTimeNow, | 36 bool mutate(double monotonicTimeNow, |
36 CompositorMutableStateProvider*) override; | 37 CompositorMutableStateProvider*) override; |
37 | 38 |
38 void registerCompositorAnimator(CompositorAnimator*); | 39 void registerCompositorAnimator(CompositorAnimator*); |
39 void unregisterCompositorAnimator(CompositorAnimator*); | 40 void unregisterCompositorAnimator(CompositorAnimator*); |
40 | 41 |
| 42 void registerCompositorProxy(const CompositorProxy*); |
| 43 void unregisterCompositorProxy(const CompositorProxy*); |
| 44 |
41 void setNeedsMutate(); | 45 void setNeedsMutate(); |
42 | 46 |
43 void setClient(CompositorMutatorClient* client) { m_client = client; } | 47 void setClient(CompositorMutatorClient* client) { m_client = client; } |
44 CustomCompositorAnimationManager* animationManager() { | 48 CustomCompositorAnimationManager* animationManager() { |
45 return m_animationManager.get(); | 49 return m_animationManager.get(); |
46 } | 50 } |
47 | 51 |
48 private: | 52 private: |
49 CompositorMutatorImpl(); | 53 CompositorMutatorImpl(); |
50 | 54 |
51 using CompositorAnimators = | 55 using CompositorAnimators = |
52 HashSet<CrossThreadPersistent<CompositorAnimator>>; | 56 HashSet<CrossThreadPersistent<CompositorAnimator>>; |
53 CompositorAnimators m_animators; | 57 CompositorAnimators m_animators; |
54 | 58 |
55 std::unique_ptr<CustomCompositorAnimationManager> m_animationManager; | 59 std::unique_ptr<CustomCompositorAnimationManager> m_animationManager; |
56 CompositorMutatorClient* m_client; | 60 CompositorMutatorClient* m_client; |
57 }; | 61 }; |
58 | 62 |
59 } // namespace blink | 63 } // namespace blink |
60 | 64 |
61 #endif // CompositorMutatorImpl_h | 65 #endif // CompositorMutatorImpl_h |
OLD | NEW |