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 <memory> | 8 #include <memory> |
9 #include "core/animation/CustomCompositorAnimationManager.h" | 9 #include "core/animation/CustomCompositorAnimationManager.h" |
10 #include "platform/graphics/CompositorMutator.h" | 10 #include "platform/graphics/CompositorMutator.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 #include "platform/heap/HeapAllocator.h" | 12 #include "platform/heap/HeapAllocator.h" |
13 #include "platform/wtf/Noncopyable.h" | 13 #include "platform/wtf/Noncopyable.h" |
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 // Owned by the control thread (unless threaded compositing is disabled). | 27 // Owned by the control thread (unless threaded compositing is disabled). |
27 // Should be accessed only on the compositor thread. | 28 // Should be accessed only on the compositor thread. |
28 class CompositorMutatorImpl final : public CompositorMutator { | 29 class CompositorMutatorImpl final : public CompositorMutator { |
29 WTF_MAKE_NONCOPYABLE(CompositorMutatorImpl); | 30 WTF_MAKE_NONCOPYABLE(CompositorMutatorImpl); |
30 | 31 |
31 public: | 32 public: |
32 static std::unique_ptr<CompositorMutatorClient> CreateClient(); | 33 static std::unique_ptr<CompositorMutatorClient> CreateClient(); |
33 static CompositorMutatorImpl* Create(); | 34 static CompositorMutatorImpl* Create(); |
34 | 35 |
35 // CompositorMutator implementation. | 36 // CompositorMutator implementation. |
36 bool Mutate(double monotonic_time_now, | 37 bool Mutate(double monotonic_time_now, |
37 CompositorMutableStateProvider*) override; | 38 CompositorMutableStateProvider*) override; |
38 | 39 |
39 void RegisterCompositorAnimator(CompositorAnimator*); | 40 void RegisterCompositorAnimator(CompositorAnimator*); |
40 void UnregisterCompositorAnimator(CompositorAnimator*); | 41 void UnregisterCompositorAnimator(CompositorAnimator*); |
41 | 42 |
| 43 void RegisterCompositorProxy(const CompositorProxy*); |
| 44 void UnregisterCompositorProxy(const CompositorProxy*); |
| 45 |
42 void SetNeedsMutate(); | 46 void SetNeedsMutate(); |
43 | 47 |
44 void SetClient(CompositorMutatorClient* client) { client_ = client; } | 48 void SetClient(CompositorMutatorClient* client) { client_ = client; } |
45 CustomCompositorAnimationManager* AnimationManager() { | 49 CustomCompositorAnimationManager* AnimationManager() { |
46 return animation_manager_.get(); | 50 return animation_manager_.get(); |
47 } | 51 } |
48 | 52 |
49 private: | 53 private: |
50 CompositorMutatorImpl(); | 54 CompositorMutatorImpl(); |
51 | 55 |
52 using CompositorAnimators = | 56 using CompositorAnimators = |
53 HashSet<CrossThreadPersistent<CompositorAnimator>>; | 57 HashSet<CrossThreadPersistent<CompositorAnimator>>; |
54 CompositorAnimators animators_; | 58 CompositorAnimators animators_; |
55 | 59 |
56 std::unique_ptr<CustomCompositorAnimationManager> animation_manager_; | 60 std::unique_ptr<CustomCompositorAnimationManager> animation_manager_; |
57 CompositorMutatorClient* client_; | 61 CompositorMutatorClient* client_; |
58 }; | 62 }; |
59 | 63 |
60 } // namespace blink | 64 } // namespace blink |
61 | 65 |
62 #endif // CompositorMutatorImpl_h | 66 #endif // CompositorMutatorImpl_h |
OLD | NEW |