OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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/CompositorMutatorImpl.h" | 5 #include "web/CompositorMutatorImpl.h" |
6 | 6 |
7 #include "core/animation/CustomCompositorAnimationManager.h" | 7 #include "core/animation/CustomCompositorAnimationManager.h" |
8 #include "core/dom/CompositorProxy.h" | 8 #include "core/dom/CompositorProxy.h" |
9 #include "platform/CrossThreadFunctional.h" | 9 #include "platform/CrossThreadFunctional.h" |
10 #include "platform/WaitableEvent.h" | 10 #include "platform/WaitableEvent.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 CompositorMutatorImpl::CompositorMutatorImpl() | 34 CompositorMutatorImpl::CompositorMutatorImpl() |
35 : m_animationManager(WTF::wrapUnique(new CustomCompositorAnimationManager)), | 35 : m_animationManager(WTF::wrapUnique(new CustomCompositorAnimationManager)), |
36 m_client(nullptr) {} | 36 m_client(nullptr) {} |
37 | 37 |
38 std::unique_ptr<CompositorMutatorClient> CompositorMutatorImpl::createClient() { | 38 std::unique_ptr<CompositorMutatorClient> CompositorMutatorImpl::createClient() { |
39 std::unique_ptr<CompositorMutatorClient> mutatorClient; | 39 std::unique_ptr<CompositorMutatorClient> mutatorClient; |
40 WaitableEvent doneEvent; | 40 WaitableEvent doneEvent; |
41 if (WebThread* compositorThread = Platform::current()->compositorThread()) { | 41 if (WebThread* compositorThread = Platform::current()->compositorThread()) { |
42 compositorThread->getWebTaskRunner()->postTask( | 42 compositorThread->getWebTaskRunner()->postTask( |
43 BLINK_FROM_HERE, crossThreadBind(&createCompositorMutatorClient, | 43 BLINK_FROM_HERE, |
44 crossThreadUnretained(&mutatorClient), | 44 crossThreadBind(&createCompositorMutatorClient, |
45 crossThreadUnretained(&doneEvent))); | 45 crossThreadUnretained(&mutatorClient), |
| 46 crossThreadUnretained(&doneEvent))); |
46 } else { | 47 } else { |
47 createCompositorMutatorClient(&mutatorClient, &doneEvent); | 48 createCompositorMutatorClient(&mutatorClient, &doneEvent); |
48 } | 49 } |
49 // TODO(flackr): Instead of waiting for this event, we may be able to just set | 50 // TODO(flackr): Instead of waiting for this event, we may be able to just set |
50 // the mutator on the CompositorWorkerProxyClient directly from the compositor | 51 // the mutator on the CompositorWorkerProxyClient directly from the compositor |
51 // thread before it gets used there. We still need to make sure we only | 52 // thread before it gets used there. We still need to make sure we only |
52 // create one mutator though. | 53 // create one mutator though. |
53 doneEvent.wait(); | 54 doneEvent.wait(); |
54 return mutatorClient; | 55 return mutatorClient; |
55 } | 56 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 DCHECK(m_animators.contains(animator)); | 89 DCHECK(m_animators.contains(animator)); |
89 m_animators.erase(animator); | 90 m_animators.erase(animator); |
90 } | 91 } |
91 | 92 |
92 void CompositorMutatorImpl::setNeedsMutate() { | 93 void CompositorMutatorImpl::setNeedsMutate() { |
93 TRACE_EVENT0("compositor-worker", "CompositorMutatorImpl::setNeedsMutate"); | 94 TRACE_EVENT0("compositor-worker", "CompositorMutatorImpl::setNeedsMutate"); |
94 m_client->setNeedsMutate(); | 95 m_client->setNeedsMutate(); |
95 } | 96 } |
96 | 97 |
97 } // namespace blink | 98 } // namespace blink |
OLD | NEW |