| 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/ThreadSafeFunctional.h" | 9 #include "platform/CrossThreadFunctional.h" |
| 10 #include "platform/TraceEvent.h" | 10 #include "platform/TraceEvent.h" |
| 11 #include "platform/WaitableEvent.h" | 11 #include "platform/WaitableEvent.h" |
| 12 #include "platform/graphics/CompositorMutationsTarget.h" | 12 #include "platform/graphics/CompositorMutationsTarget.h" |
| 13 #include "platform/graphics/CompositorMutatorClient.h" | 13 #include "platform/graphics/CompositorMutatorClient.h" |
| 14 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
| 15 #include "public/platform/Platform.h" | 15 #include "public/platform/Platform.h" |
| 16 #include "web/CompositorProxyClientImpl.h" | 16 #include "web/CompositorProxyClientImpl.h" |
| 17 #include "wtf/PtrUtil.h" | 17 #include "wtf/PtrUtil.h" |
| 18 | 18 |
| 19 namespace blink { | 19 namespace blink { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 34 : m_animationManager(wrapUnique(new CustomCompositorAnimationManager)) | 34 : m_animationManager(wrapUnique(new CustomCompositorAnimationManager)) |
| 35 , m_client(nullptr) | 35 , m_client(nullptr) |
| 36 { | 36 { |
| 37 } | 37 } |
| 38 | 38 |
| 39 std::unique_ptr<CompositorMutatorClient> CompositorMutatorImpl::createClient() | 39 std::unique_ptr<CompositorMutatorClient> CompositorMutatorImpl::createClient() |
| 40 { | 40 { |
| 41 std::unique_ptr<CompositorMutatorClient> mutatorClient; | 41 std::unique_ptr<CompositorMutatorClient> mutatorClient; |
| 42 WaitableEvent doneEvent; | 42 WaitableEvent doneEvent; |
| 43 if (WebThread* compositorThread = Platform::current()->compositorThread()) { | 43 if (WebThread* compositorThread = Platform::current()->compositorThread()) { |
| 44 compositorThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSa
feBind(&createCompositorMutatorClient, crossThreadUnretained(&mutatorClient), cr
ossThreadUnretained(&doneEvent))); | 44 compositorThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, crossThr
eadBind(&createCompositorMutatorClient, crossThreadUnretained(&mutatorClient), c
rossThreadUnretained(&doneEvent))); |
| 45 } else { | 45 } else { |
| 46 createCompositorMutatorClient(&mutatorClient, &doneEvent); | 46 createCompositorMutatorClient(&mutatorClient, &doneEvent); |
| 47 } | 47 } |
| 48 // TODO(flackr): Instead of waiting for this event, we may be able to just s
et the | 48 // TODO(flackr): Instead of waiting for this event, we may be able to just s
et the |
| 49 // mutator on the CompositorProxyClient directly from the compositor thread
before | 49 // mutator on the CompositorProxyClient directly from the compositor thread
before |
| 50 // it gets used there. We still need to make sure we only create one mutator
though. | 50 // it gets used there. We still need to make sure we only create one mutator
though. |
| 51 doneEvent.wait(); | 51 doneEvent.wait(); |
| 52 return mutatorClient; | 52 return mutatorClient; |
| 53 } | 53 } |
| 54 | 54 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 79 setNeedsMutate(); | 79 setNeedsMutate(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void CompositorMutatorImpl::setNeedsMutate() | 82 void CompositorMutatorImpl::setNeedsMutate() |
| 83 { | 83 { |
| 84 TRACE_EVENT0("compositor-worker", "CompositorMutatorImpl::setNeedsMutate"); | 84 TRACE_EVENT0("compositor-worker", "CompositorMutatorImpl::setNeedsMutate"); |
| 85 m_client->setNeedsMutate(); | 85 m_client->setNeedsMutate(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace blink | 88 } // namespace blink |
| OLD | NEW |