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 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 "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
| 10 | 11 |
| 11 namespace blink { | 12 namespace blink { |
| 12 | 13 |
| 13 class CompositorMutatorImpl; | 14 class CompositorMutatorImpl; |
| 14 class CompositorWorkerGlobalScope; | 15 class CompositorWorkerGlobalScope; |
| 15 class WorkerGlobalScope; | 16 class WorkerGlobalScope; |
| 16 | 17 |
| 17 // Mediates between one CompositorWorkerGlobalScope and the associated Composito rMutatorImpl. | 18 // Mediates between one CompositorWorkerGlobalScope and the associated Composito rMutatorImpl. |
| 18 // There is one CompositorProxyClientImpl per worker but there may be multiple f or a given | 19 // There is one CompositorProxyClientImpl per worker but there may be multiple f or a given |
| 19 // mutator, e.g. if a single document creates multiple CompositorWorker objects. | 20 // mutator, e.g. if a single document creates multiple CompositorWorker objects. |
| 20 // | 21 // |
| 21 // Should be accessed only on the compositor thread. | 22 // Should be accessed only on the compositor thread. |
| 22 class CompositorProxyClientImpl final : public GarbageCollected<CompositorProxyC lientImpl>, public CompositorProxyClient { | 23 class CompositorProxyClientImpl final : public GarbageCollected<CompositorProxyC lientImpl>, public CompositorProxyClient { |
| 23 USING_GARBAGE_COLLECTED_MIXIN(CompositorProxyClientImpl); | 24 USING_GARBAGE_COLLECTED_MIXIN(CompositorProxyClientImpl); |
| 24 WTF_MAKE_NONCOPYABLE(CompositorProxyClientImpl); | 25 WTF_MAKE_NONCOPYABLE(CompositorProxyClientImpl); |
| 25 public: | 26 public: |
| 26 CompositorProxyClientImpl(CompositorMutatorImpl*); | 27 CompositorProxyClientImpl(CompositorMutatorImpl*); |
| 27 DECLARE_VIRTUAL_TRACE(); | 28 DECLARE_VIRTUAL_TRACE(); |
| 28 | 29 |
| 29 // Runs the animation frame callback for the frame starting at the given tim e. | 30 // Runs the animation frame callback for the frame starting at the given tim e. |
| 30 // Returns true if another animation frame was requested (i.e. should be rei nvoked next frame). | 31 // Returns true if another animation frame was requested (i.e. should be rei nvoked next frame). |
| 31 bool mutate(double monotonicTimeNow); | 32 bool mutate(double monotonicTimeNow); |
| 32 | 33 |
| 33 // CompositorProxyClient: | 34 // CompositorProxyClient: |
| 34 void setGlobalScope(WorkerGlobalScope*) override; | 35 void setGlobalScope(WorkerGlobalScope*) override; |
| 35 void requestAnimationFrame() override; | 36 void requestAnimationFrame() override; |
| 37 void registerCompositorProxy(CompositorProxy*) override; | |
| 38 void unregisterCompositorProxy(CompositorProxy*) override; | |
| 36 | 39 |
| 37 private: | 40 private: |
| 38 bool executeAnimationFrameCallbacks(double monotonicTimeNow); | 41 bool executeAnimationFrameCallbacks(double monotonicTimeNow); |
| 39 | 42 |
| 40 Member<CompositorMutatorImpl> m_mutator; | 43 Member<CompositorMutatorImpl> m_mutator; |
| 41 | 44 |
| 42 Member<CompositorWorkerGlobalScope> m_globalScope; | 45 Member<CompositorWorkerGlobalScope> m_globalScope; |
| 43 bool m_requestedAnimationFrameCallbacks; | 46 bool m_requestedAnimationFrameCallbacks; |
| 47 | |
| 48 typedef HeapHashSet<WeakMember<CompositorProxy>> ProxySet; | |
| 49 typedef HeapHashMap<uint64_t, Member<ProxySet>> ProxyMap; | |
|
jbroman
2016/06/10 19:29:34
One thing to watch out for here: if the last objec
| |
| 50 ProxyMap m_proxyMap; | |
| 44 }; | 51 }; |
| 45 | 52 |
| 46 } // namespace blink | 53 } // namespace blink |
| 47 | 54 |
| 48 #endif // CompositorProxyClientImpl_h | 55 #endif // CompositorProxyClientImpl_h |
| OLD | NEW |