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 CompositorMutableStateProvider; |
15 class CompositorMutatorImpl; | 15 class CompositorMutatorImpl; |
16 class CompositorWorkerGlobalScope; | 16 class CompositorWorkerGlobalScope; |
17 class WorkerGlobalScope; | 17 class WorkerGlobalScope; |
18 | 18 |
19 // Mediates between one CompositorWorkerGlobalScope and the associated Composito
rMutatorImpl. | 19 // Mediates between one CompositorWorkerGlobalScope and the associated Composito
rMutatorImpl. |
20 // 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 |
21 // mutator, e.g. if a single document creates multiple CompositorWorker objects. | 21 // mutator, e.g. if a single document creates multiple CompositorWorker objects. |
22 // | 22 // |
23 // Should be accessed only on the compositor thread. | 23 // Should be accessed only on the compositor thread. |
24 class CompositorProxyClientImpl final : public GarbageCollected<CompositorProxyC
lientImpl>, public CompositorProxyClient { | 24 class CompositorProxyClientImpl final : public GarbageCollected<CompositorProxyC
lientImpl>, public CompositorProxyClient { |
25 USING_GARBAGE_COLLECTED_MIXIN(CompositorProxyClientImpl); | 25 USING_GARBAGE_COLLECTED_MIXIN(CompositorProxyClientImpl); |
26 WTF_MAKE_NONCOPYABLE(CompositorProxyClientImpl); | 26 WTF_MAKE_NONCOPYABLE(CompositorProxyClientImpl); |
27 public: | 27 public: |
28 CompositorProxyClientImpl(CompositorMutatorImpl*); | 28 CompositorProxyClientImpl(CompositorMutatorImpl*, WorkerClients&); |
29 DECLARE_VIRTUAL_TRACE(); | 29 DECLARE_VIRTUAL_TRACE(); |
30 | 30 |
31 // 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. |
32 // 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). |
33 bool mutate(double monotonicTimeNow, CompositorMutableStateProvider*); | 33 bool mutate(double monotonicTimeNow, CompositorMutableStateProvider*); |
34 | 34 |
35 // CompositorProxyClient: | 35 // CompositorProxyClient: |
36 void setGlobalScope(WorkerGlobalScope*) override; | 36 void setGlobalScope(WorkerGlobalScope*) override; |
37 void requestAnimationFrame() override; | 37 void requestAnimationFrame() override; |
38 void registerCompositorProxy(CompositorProxy*) override; | 38 void registerCompositorProxy(CompositorProxy*) override; |
39 void unregisterCompositorProxy(CompositorProxy*) override; | 39 void unregisterCompositorProxy(CompositorProxy*) override; |
40 | 40 |
41 private: | 41 private: |
42 bool executeAnimationFrameCallbacks(double monotonicTimeNow); | 42 bool executeAnimationFrameCallbacks(double monotonicTimeNow); |
43 | 43 |
44 Member<CompositorMutatorImpl> m_mutator; | 44 Member<CompositorMutatorImpl> m_mutator; |
45 | 45 |
46 Member<CompositorWorkerGlobalScope> m_globalScope; | 46 Member<CompositorWorkerGlobalScope> m_globalScope; |
47 bool m_requestedAnimationFrameCallbacks; | 47 bool m_requestedAnimationFrameCallbacks; |
48 | 48 |
49 HeapHashSet<WeakMember<CompositorProxy>> m_proxies; | 49 HeapHashSet<WeakMember<CompositorProxy>> m_proxies; |
50 }; | 50 }; |
51 | 51 |
52 } // namespace blink | 52 } // namespace blink |
53 | 53 |
54 #endif // CompositorProxyClientImpl_h | 54 #endif // CompositorProxyClientImpl_h |
OLD | NEW |