OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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/CompositorMutatorImpl.h" |
| 6 |
| 7 #include "core/animation/CustomCompositorAnimationManager.h" |
| 8 #include "core/dom/CompositorProxy.h" |
| 9 #include "platform/TraceEvent.h" |
| 10 #include "platform/graphics/CompositorMutationsTarget.h" |
| 11 #include "platform/graphics/CompositorMutatorClient.h" |
| 12 #include "platform/heap/Handle.h" |
| 13 #include "web/CompositorProxyClientImpl.h" |
| 14 |
| 15 namespace blink { |
| 16 |
| 17 CompositorMutatorImpl::CompositorMutatorImpl() |
| 18 : m_animationManager(adoptPtr(new CustomCompositorAnimationManager)) |
| 19 , m_client(nullptr) |
| 20 { |
| 21 } |
| 22 |
| 23 CompositorMutatorImpl* CompositorMutatorImpl::create() |
| 24 { |
| 25 return new CompositorMutatorImpl(); |
| 26 } |
| 27 |
| 28 bool CompositorMutatorImpl::mutate(double monotonicTimeNow) |
| 29 { |
| 30 TRACE_EVENT0("compositor-worker", "CompositorMutatorImpl::mutate"); |
| 31 bool needToReinvoke = false; |
| 32 // TODO(vollick): we should avoid executing the animation frame |
| 33 // callbacks if none of the proxies in the global scope are affected by |
| 34 // m_mutations. |
| 35 for (CompositorProxyClientImpl* client : m_proxyClients) { |
| 36 if (client->mutate(monotonicTimeNow)) |
| 37 needToReinvoke = true; |
| 38 } |
| 39 |
| 40 return needToReinvoke; |
| 41 } |
| 42 |
| 43 void CompositorMutatorImpl::registerProxyClient(CompositorProxyClientImpl* clien
t) |
| 44 { |
| 45 TRACE_EVENT0("compositor-worker", "CompositorMutatorImpl::registerClient"); |
| 46 m_proxyClients.add(client); |
| 47 setNeedsMutate(); |
| 48 } |
| 49 |
| 50 void CompositorMutatorImpl::setNeedsMutate() |
| 51 { |
| 52 TRACE_EVENT0("compositor-worker", "CompositorMutatorImpl::setNeedsMutate"); |
| 53 m_client->setNeedsMutate(); |
| 54 } |
| 55 |
| 56 } // namespace blink |
OLD | NEW |