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