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 CompositorProxyClientImpl_h | 5 #ifndef CompositorProxyClientImpl_h |
6 #define CompositorProxyClientImpl_h | 6 #define CompositorProxyClientImpl_h |
7 | 7 |
8 #include "core/dom/CompositorProxyClient.h" | 8 #include "core/dom/CompositorProxyClient.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 #include "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
| 14 class CompositorMutableStateProvider; |
14 class CompositorMutatorImpl; | 15 class CompositorMutatorImpl; |
15 class CompositorWorkerGlobalScope; | 16 class CompositorWorkerGlobalScope; |
16 class WorkerGlobalScope; | 17 class WorkerGlobalScope; |
17 | 18 |
18 // Mediates between one CompositorWorkerGlobalScope and the associated Composito
rMutatorImpl. | 19 // Mediates between one CompositorWorkerGlobalScope and the associated Composito
rMutatorImpl. |
19 // There is one CompositorProxyClientImpl per worker but there may be multiple f
or a given | 20 // There is one CompositorProxyClientImpl per worker but there may be multiple f
or a given |
20 // mutator, e.g. if a single document creates multiple CompositorWorker objects. | 21 // mutator, e.g. if a single document creates multiple CompositorWorker objects. |
21 // | 22 // |
22 // Should be accessed only on the compositor thread. | 23 // Should be accessed only on the compositor thread. |
23 class CompositorProxyClientImpl final : public GarbageCollected<CompositorProxyC
lientImpl>, public CompositorProxyClient { | 24 class CompositorProxyClientImpl final : public GarbageCollected<CompositorProxyC
lientImpl>, public CompositorProxyClient { |
24 USING_GARBAGE_COLLECTED_MIXIN(CompositorProxyClientImpl); | 25 USING_GARBAGE_COLLECTED_MIXIN(CompositorProxyClientImpl); |
25 WTF_MAKE_NONCOPYABLE(CompositorProxyClientImpl); | 26 WTF_MAKE_NONCOPYABLE(CompositorProxyClientImpl); |
26 public: | 27 public: |
27 CompositorProxyClientImpl(CompositorMutatorImpl*); | 28 CompositorProxyClientImpl(CompositorMutatorImpl*); |
28 DECLARE_VIRTUAL_TRACE(); | 29 DECLARE_VIRTUAL_TRACE(); |
29 | 30 |
30 // Runs the animation frame callback for the frame starting at the given tim
e. | 31 // Runs the animation frame callback for the frame starting at the given tim
e. |
31 // Returns true if another animation frame was requested (i.e. should be rei
nvoked next frame). | 32 // Returns true if another animation frame was requested (i.e. should be rei
nvoked next frame). |
32 bool mutate(double monotonicTimeNow); | 33 bool mutate(double monotonicTimeNow, CompositorMutableStateProvider*); |
33 | 34 |
34 // CompositorProxyClient: | 35 // CompositorProxyClient: |
35 void setGlobalScope(WorkerGlobalScope*) override; | 36 void setGlobalScope(WorkerGlobalScope*) override; |
36 void requestAnimationFrame() override; | 37 void requestAnimationFrame() override; |
37 void registerCompositorProxy(CompositorProxy*) override; | 38 void registerCompositorProxy(CompositorProxy*) override; |
38 void unregisterCompositorProxy(CompositorProxy*) override; | 39 void unregisterCompositorProxy(CompositorProxy*) override; |
39 | 40 |
40 private: | 41 private: |
41 bool executeAnimationFrameCallbacks(double monotonicTimeNow); | 42 bool executeAnimationFrameCallbacks(double monotonicTimeNow); |
| 43 void updateMutableStateForCompositorProxies(CompositorMutableStateProvider*)
; |
42 | 44 |
43 Member<CompositorMutatorImpl> m_mutator; | 45 Member<CompositorMutatorImpl> m_mutator; |
44 | 46 |
45 Member<CompositorWorkerGlobalScope> m_globalScope; | 47 Member<CompositorWorkerGlobalScope> m_globalScope; |
46 bool m_requestedAnimationFrameCallbacks; | 48 bool m_requestedAnimationFrameCallbacks; |
47 | 49 |
48 HeapHashSet<WeakMember<CompositorProxy>> m_proxies; | 50 HeapHashSet<WeakMember<CompositorProxy>> m_proxies; |
49 }; | 51 }; |
50 | 52 |
51 } // namespace blink | 53 } // namespace blink |
52 | 54 |
53 #endif // CompositorProxyClientImpl_h | 55 #endif // CompositorProxyClientImpl_h |
OLD | NEW |