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 #include "web/CompositorProxyClientImpl.h" | 5 #include "web/CompositorProxyClientImpl.h" |
6 | 6 |
7 #include "core/dom/CompositorProxy.h" | 7 #include "core/dom/CompositorProxy.h" |
8 #include "modules/compositorworker/CompositorWorkerGlobalScope.h" | 8 #include "modules/compositorworker/CompositorWorkerGlobalScope.h" |
9 #include "platform/TraceEvent.h" | 9 #include "platform/TraceEvent.h" |
10 #include "web/CompositorMutatorImpl.h" | 10 #include "web/CompositorMutatorImpl.h" |
11 #include "wtf/CurrentTime.h" | 11 #include "wtf/CurrentTime.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 CompositorProxyClientImpl::CompositorProxyClientImpl(CompositorMutatorImpl* muta
tor) | 15 CompositorProxyClientImpl::CompositorProxyClientImpl(CompositorMutatorImpl* muta
tor) |
16 : m_mutator(mutator) | 16 : m_mutator(mutator) |
17 , m_globalScope(nullptr) | 17 , m_globalScope(nullptr) |
18 { | 18 { |
19 } | 19 } |
20 | 20 |
21 DEFINE_TRACE(CompositorProxyClientImpl) | 21 DEFINE_TRACE(CompositorProxyClientImpl) |
22 { | 22 { |
23 CompositorProxyClient::trace(visitor); | 23 CompositorProxyClient::trace(visitor); |
24 visitor->trace(m_mutator); | 24 visitor->trace(m_mutator); |
25 visitor->trace(m_globalScope); | 25 visitor->trace(m_globalScope); |
| 26 visitor->trace(m_proxies); |
26 } | 27 } |
27 | 28 |
28 void CompositorProxyClientImpl::setGlobalScope(WorkerGlobalScope* scope) | 29 void CompositorProxyClientImpl::setGlobalScope(WorkerGlobalScope* scope) |
29 { | 30 { |
30 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::setGlobalScope
"); | 31 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::setGlobalScope
"); |
31 DCHECK(!m_globalScope); | 32 DCHECK(!m_globalScope); |
32 DCHECK(scope); | 33 DCHECK(scope); |
33 m_globalScope = static_cast<CompositorWorkerGlobalScope*>(scope); | 34 m_globalScope = static_cast<CompositorWorkerGlobalScope*>(scope); |
34 m_mutator->registerProxyClient(this); | 35 m_mutator->registerProxyClient(this); |
35 } | 36 } |
(...skipping 21 matching lines...) Expand all Loading... |
57 | 58 |
58 bool CompositorProxyClientImpl::executeAnimationFrameCallbacks(double monotonicT
imeNow) | 59 bool CompositorProxyClientImpl::executeAnimationFrameCallbacks(double monotonicT
imeNow) |
59 { | 60 { |
60 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::executeAnimati
onFrameCallbacks"); | 61 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::executeAnimati
onFrameCallbacks"); |
61 // Convert to zero based document time in milliseconds consistent with reque
stAnimationFrame. | 62 // Convert to zero based document time in milliseconds consistent with reque
stAnimationFrame. |
62 double highResTimeMs = 1000.0 * (monotonicTimeNow - m_globalScope->timeOrigi
n()); | 63 double highResTimeMs = 1000.0 * (monotonicTimeNow - m_globalScope->timeOrigi
n()); |
63 const bool shouldReinvoke = m_globalScope->executeAnimationFrameCallbacks(hi
ghResTimeMs); | 64 const bool shouldReinvoke = m_globalScope->executeAnimationFrameCallbacks(hi
ghResTimeMs); |
64 return shouldReinvoke; | 65 return shouldReinvoke; |
65 } | 66 } |
66 | 67 |
| 68 void CompositorProxyClientImpl::registerCompositorProxy(CompositorProxy* proxy) |
| 69 { |
| 70 m_proxies.add(proxy); |
| 71 } |
| 72 |
| 73 void CompositorProxyClientImpl::unregisterCompositorProxy(CompositorProxy* proxy
) |
| 74 { |
| 75 m_proxies.remove(proxy); |
| 76 } |
| 77 |
67 } // namespace blink | 78 } // namespace blink |
OLD | NEW |