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 CompositorMutatorClient_h | 5 #ifndef CompositorMutatorClient_h |
6 #define CompositorMutatorClient_h | 6 #define CompositorMutatorClient_h |
7 | 7 |
| 8 #include <map> |
| 9 #include <memory> |
| 10 #include <utility> |
| 11 |
8 #include "platform/PlatformExport.h" | 12 #include "platform/PlatformExport.h" |
| 13 #include "platform/graphics/CompositorMutableProperties.h" |
9 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
10 #include "public/platform/WebCompositorMutatorClient.h" | 15 #include "public/platform/WebCompositorMutatorClient.h" |
11 #include <memory> | |
12 | 16 |
13 namespace blink { | 17 namespace blink { |
14 | 18 |
15 class CompositorMutator; | 19 class CompositorMutator; |
16 struct CompositorMutations; | 20 struct CompositorMutations; |
17 class CompositorMutationsTarget; | 21 class CompositorMutationsTarget; |
| 22 class CompositorMutation; |
18 | 23 |
19 class PLATFORM_EXPORT CompositorMutatorClient | 24 class PLATFORM_EXPORT CompositorMutatorClient |
20 : public WebCompositorMutatorClient { | 25 : public WebCompositorMutatorClient { |
21 public: | 26 public: |
22 CompositorMutatorClient(CompositorMutator*, CompositorMutationsTarget*); | 27 CompositorMutatorClient(CompositorMutator*, CompositorMutationsTarget*); |
23 virtual ~CompositorMutatorClient(); | 28 virtual ~CompositorMutatorClient(); |
24 | 29 |
25 void SetNeedsMutate(); | 30 void SetNeedsMutate(); |
| 31 void RegisterCompositorProxy(uint64_t proxy_id, |
| 32 uint64_t element_id, |
| 33 uint32_t mutable_properties); |
| 34 void UnregisterCompositorProxy(uint64_t proxy_id); |
26 | 35 |
27 // cc::LayerTreeMutator | 36 // cc::LayerTreeMutator |
28 bool Mutate(base::TimeTicks monotonic_time, cc::LayerTreeImpl*) override; | 37 bool Mutate(base::TimeTicks monotonic_time, cc::LayerTreeImpl*) override; |
29 void SetClient(cc::LayerTreeMutatorClient*) override; | 38 void SetClient(cc::LayerTreeMutatorClient*) override; |
30 base::Closure TakeMutations() override; | 39 base::Closure TakeMutations() override; |
31 | 40 |
32 CompositorMutator* Mutator() { return mutator_.Get(); } | 41 CompositorMutator* Mutator() { return mutator_.Get(); } |
33 | 42 |
34 void SetMutationsForTesting(std::unique_ptr<CompositorMutations>); | 43 void SetMutationsForTesting(std::unique_ptr<CompositorMutations>); |
35 | 44 |
36 private: | 45 private: |
| 46 void SnapshotLayerTree(const cc::LayerTreeImpl*, |
| 47 ProxyCompositorMutablePropertiesMap*) const; |
| 48 void UpdateLayerTree(cc::LayerTreeImpl*, |
| 49 uint64_t element_id, |
| 50 const CompositorMutation*); |
| 51 void UpdateMutations(uint64_t element_id, |
| 52 std::unique_ptr<CompositorMutation>); |
| 53 |
37 cc::LayerTreeMutatorClient* client_; | 54 cc::LayerTreeMutatorClient* client_; |
38 CompositorMutationsTarget* mutations_target_; | 55 CompositorMutationsTarget* mutations_target_; |
| 56 // Maps from a |CompositorProxy| id to a pair of the element id for that |
| 57 // proxy, and the bitmask of properties the proxy is allowed to mutate. |
| 58 std::map<uint64_t, std::pair<uint64_t, uint32_t>> input_properties_; |
39 // Accessed by main and compositor threads. | 59 // Accessed by main and compositor threads. |
40 CrossThreadPersistent<CompositorMutator> mutator_; | 60 CrossThreadPersistent<CompositorMutator> mutator_; |
41 std::unique_ptr<CompositorMutations> mutations_; | 61 std::unique_ptr<CompositorMutations> mutations_; |
42 }; | 62 }; |
43 | 63 |
44 } // namespace blink | 64 } // namespace blink |
45 | 65 |
46 #endif // CompositorMutatorClient_h | 66 #endif // CompositorMutatorClient_h |
OLD | NEW |