| 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 CompositorWorkerProxyClientImpl_h | 5 #ifndef CompositorWorkerProxyClientImpl_h |
| 6 #define CompositorWorkerProxyClientImpl_h | 6 #define CompositorWorkerProxyClientImpl_h |
| 7 | 7 |
| 8 #include "core/dom/CompositorWorkerProxyClient.h" | 8 #include "core/dom/CompositorWorkerProxyClient.h" |
| 9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
| 10 #include "web/CompositorAnimator.h" | 10 #include "web/CompositorAnimator.h" |
| 11 #include "web/CompositorProxyClientImpl.h" |
| 11 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 class CompositorMutableStateProvider; | 16 class CompositorMutableStateProvider; |
| 16 class CompositorMutatorImpl; | 17 class CompositorMutatorImpl; |
| 17 class CompositorWorkerGlobalScope; | 18 class CompositorWorkerGlobalScope; |
| 18 class WorkerGlobalScope; | 19 class WorkerGlobalScope; |
| 19 | 20 |
| 20 // Mediates between one CompositorWorkerGlobalScope and the associated | 21 // Mediates between one CompositorWorkerGlobalScope and the associated |
| 21 // CompositorMutatorImpl. There is one CompositorWorkerProxyClientImpl per | 22 // CompositorMutatorImpl. There is one CompositorWorkerProxyClientImpl per |
| 22 // worker but there may be multiple for a given mutator, e.g. if a single | 23 // worker but there may be multiple for a given mutator, e.g. if a single |
| 23 // document creates multiple CompositorWorker objects. | 24 // document creates multiple CompositorWorker objects. |
| 24 // | 25 // |
| 25 // Should be accessed only on the compositor thread. | 26 // Should be accessed only on the compositor thread. |
| 26 class CompositorWorkerProxyClientImpl final | 27 class CompositorWorkerProxyClientImpl final |
| 27 : public CompositorWorkerProxyClient, | 28 : public GarbageCollectedFinalized<CompositorWorkerProxyClientImpl>, |
| 29 public CompositorWorkerProxyClient, |
| 28 public CompositorAnimator { | 30 public CompositorAnimator { |
| 29 WTF_MAKE_NONCOPYABLE(CompositorWorkerProxyClientImpl); | 31 WTF_MAKE_NONCOPYABLE(CompositorWorkerProxyClientImpl); |
| 30 USING_GARBAGE_COLLECTED_MIXIN(CompositorWorkerProxyClientImpl); | 32 USING_GARBAGE_COLLECTED_MIXIN(CompositorWorkerProxyClientImpl); |
| 31 | 33 |
| 32 public: | 34 public: |
| 33 explicit CompositorWorkerProxyClientImpl(CompositorMutatorImpl*); | 35 explicit CompositorWorkerProxyClientImpl(CompositorMutatorImpl*); |
| 34 DECLARE_TRACE(); | 36 DECLARE_TRACE(); |
| 35 | 37 |
| 36 // CompositorAnimator: | 38 // CompositorAnimator: |
| 37 bool mutate(double monotonicTimeNow, | 39 bool mutate(double monotonicTimeNow, |
| 38 CompositorMutableStateProvider*) override; | 40 CompositorMutableStateProvider*) override; |
| 39 | 41 |
| 40 // CompositorWorkerProxyClient: | 42 // CompositorWorkerProxyClient: |
| 41 void dispose() override; | 43 void dispose() override; |
| 42 void setGlobalScope(WorkerGlobalScope*) override; | 44 void setGlobalScope(WorkerGlobalScope*) override; |
| 43 void requestAnimationFrame() override; | 45 void requestAnimationFrame() override; |
| 44 void registerCompositorProxy(CompositorProxy*) override; | 46 CompositorProxyClient* compositorProxyClient() override { |
| 45 void unregisterCompositorProxy(CompositorProxy*) override; | 47 return m_compositorProxyClient.get(); |
| 48 }; |
| 46 | 49 |
| 47 private: | 50 private: |
| 48 bool executeAnimationFrameCallbacks(double monotonicTimeNow); | 51 bool executeAnimationFrameCallbacks(double monotonicTimeNow); |
| 49 | 52 |
| 50 CrossThreadPersistent<CompositorMutatorImpl> m_mutator; | 53 CrossThreadPersistent<CompositorMutatorImpl> m_mutator; |
| 51 | 54 |
| 52 CrossThreadPersistent<CompositorWorkerGlobalScope> m_globalScope; | 55 CrossThreadPersistent<CompositorWorkerGlobalScope> m_globalScope; |
| 53 bool m_requestedAnimationFrameCallbacks; | 56 bool m_requestedAnimationFrameCallbacks; |
| 54 | 57 |
| 55 // TODO(majidvp): move this out to a separate class that can be composed in. | 58 CrossThreadPersistent<CompositorProxyClientImpl> m_compositorProxyClient; |
| 56 HeapHashSet<WeakMember<CompositorProxy>> m_proxies; | |
| 57 }; | 59 }; |
| 58 | 60 |
| 59 } // namespace blink | 61 } // namespace blink |
| 60 | 62 |
| 61 #endif // CompositorWorkerProxyClientImpl_h | 63 #endif // CompositorWorkerProxyClientImpl_h |
| OLD | NEW |