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