| 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 |
| 20 // There is one CompositorProxyClientImpl per worker but there may be multiple f
or a given | 20 // CompositorMutatorImpl. There is one CompositorProxyClientImpl per worker |
| 21 // mutator, e.g. if a single document creates multiple CompositorWorker objects. | 21 // but there may be multiple for a given mutator, e.g. if a single document |
| 22 // creates multiple CompositorWorker objects. |
| 22 // | 23 // |
| 23 // Should be accessed only on the compositor thread. | 24 // Should be accessed only on the compositor thread. |
| 24 class CompositorProxyClientImpl final | 25 class CompositorProxyClientImpl final |
| 25 : public GarbageCollectedFinalized<CompositorProxyClientImpl>, | 26 : public GarbageCollectedFinalized<CompositorProxyClientImpl>, |
| 26 public CompositorProxyClient { | 27 public CompositorProxyClient { |
| 27 USING_GARBAGE_COLLECTED_MIXIN(CompositorProxyClientImpl); | 28 USING_GARBAGE_COLLECTED_MIXIN(CompositorProxyClientImpl); |
| 28 WTF_MAKE_NONCOPYABLE(CompositorProxyClientImpl); | 29 WTF_MAKE_NONCOPYABLE(CompositorProxyClientImpl); |
| 29 | 30 |
| 30 public: | 31 public: |
| 31 CompositorProxyClientImpl(CompositorMutatorImpl*); | 32 CompositorProxyClientImpl(CompositorMutatorImpl*); |
| 32 DECLARE_VIRTUAL_TRACE(); | 33 DECLARE_VIRTUAL_TRACE(); |
| 33 | 34 |
| 34 // Runs the animation frame callback for the frame starting at the given time. | 35 // Runs the animation frame callback for the frame starting at the given time. |
| 35 // Returns true if another animation frame was requested (i.e. should be reinv
oked next frame). | 36 // Returns true if another animation frame was requested (i.e. should be |
| 37 // reinvoked next frame). |
| 36 bool mutate(double monotonicTimeNow, CompositorMutableStateProvider*); | 38 bool mutate(double monotonicTimeNow, CompositorMutableStateProvider*); |
| 37 | 39 |
| 38 // CompositorProxyClient: | 40 // CompositorProxyClient: |
| 39 void dispose() override; | 41 void dispose() override; |
| 40 void setGlobalScope(WorkerGlobalScope*) override; | 42 void setGlobalScope(WorkerGlobalScope*) override; |
| 41 void requestAnimationFrame() override; | 43 void requestAnimationFrame() override; |
| 42 void registerCompositorProxy(CompositorProxy*) override; | 44 void registerCompositorProxy(CompositorProxy*) override; |
| 43 void unregisterCompositorProxy(CompositorProxy*) override; | 45 void unregisterCompositorProxy(CompositorProxy*) override; |
| 44 | 46 |
| 45 private: | 47 private: |
| 46 bool executeAnimationFrameCallbacks(double monotonicTimeNow); | 48 bool executeAnimationFrameCallbacks(double monotonicTimeNow); |
| 47 | 49 |
| 48 CrossThreadPersistent<CompositorMutatorImpl> m_mutator; | 50 CrossThreadPersistent<CompositorMutatorImpl> m_mutator; |
| 49 | 51 |
| 50 CrossThreadPersistent<CompositorWorkerGlobalScope> m_globalScope; | 52 CrossThreadPersistent<CompositorWorkerGlobalScope> m_globalScope; |
| 51 bool m_requestedAnimationFrameCallbacks; | 53 bool m_requestedAnimationFrameCallbacks; |
| 52 | 54 |
| 53 HeapHashSet<WeakMember<CompositorProxy>> m_proxies; | 55 HeapHashSet<WeakMember<CompositorProxy>> m_proxies; |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 } // namespace blink | 58 } // namespace blink |
| 57 | 59 |
| 58 #endif // CompositorProxyClientImpl_h | 60 #endif // CompositorProxyClientImpl_h |
| OLD | NEW |