Chromium Code Reviews| 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 #include "web/CompositorProxyClientImpl.h" | |
| 6 | |
| 7 #include "core/dom/CompositorProxy.h" | |
| 8 #include "modules/compositorworker/CompositorWorkerGlobalScope.h" | |
| 9 #include "platform/TraceEvent.h" | |
| 10 #include "web/CompositorMutatorImpl.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 CompositorProxyClientImpl::CompositorProxyClientImpl(CompositorMutatorImpl* muta tor) | |
| 15 : m_mutator(mutator) | |
| 16 , m_globalScope(nullptr) | |
| 17 , m_executingAnimationFrameCallbacks(false) | |
| 18 { | |
| 19 } | |
| 20 | |
| 21 CompositorProxyClientImpl::~CompositorProxyClientImpl() | |
| 22 { | |
| 23 } | |
| 24 | |
| 25 DEFINE_TRACE(CompositorProxyClientImpl) | |
| 26 { | |
| 27 visitor->trace(m_globalScope); | |
| 28 CompositorProxyClient::trace(visitor); | |
| 29 } | |
| 30 | |
| 31 void CompositorProxyClientImpl::setGlobalScope(WorkerGlobalScope* scope) | |
| 32 { | |
| 33 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::setGlobalScope "); | |
| 34 m_globalScope = static_cast<CompositorWorkerGlobalScope*>(scope); | |
| 35 if (m_globalScope) | |
| 36 m_mutator->registerClient(this); | |
| 37 else | |
| 38 m_mutator->unregisterClient(this); | |
| 39 } | |
| 40 | |
| 41 void CompositorProxyClientImpl::requestMutation() | |
| 42 { | |
| 43 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::requestMutatio n"); | |
| 44 m_requestedAnimationFrameCallbacks = true; | |
| 45 m_mutator->setNeedsMutate(); | |
| 46 } | |
| 47 | |
| 48 bool CompositorProxyClientImpl::mutate(double timeNow) | |
| 49 { | |
| 50 if (!m_globalScope) | |
| 51 return false; | |
| 52 | |
| 53 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::mutate"); | |
| 54 if (!m_requestedAnimationFrameCallbacks) | |
| 55 return false; | |
| 56 | |
| 57 m_requestedAnimationFrameCallbacks = false; | |
| 58 { | |
| 59 TemporaryChange<bool> temporary(m_executingAnimationFrameCallbacks, true ); | |
|
jbroman
2016/04/20 21:06:42
What's the point of changing this? It's never read
flackr
2016/04/25 14:06:28
I believe it does care in a subsequent patch but I
| |
| 60 m_requestedAnimationFrameCallbacks = executeAnimationFrameCallbacks(time Now); | |
| 61 } | |
| 62 | |
| 63 return m_requestedAnimationFrameCallbacks; | |
| 64 } | |
| 65 | |
| 66 bool CompositorProxyClientImpl::executeAnimationFrameCallbacks(double time) | |
| 67 { | |
| 68 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::executeAnimati onFrameCallbacks"); | |
| 69 const bool shouldReinvoke = m_globalScope->executeAnimationFrameCallbacks(ti me); | |
| 70 return shouldReinvoke; | |
| 71 } | |
| 72 | |
| 73 } // namespace blink | |
| OLD | NEW |