| 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/TraceEvent.h" | 10 #include "platform/TraceEvent.h" | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
| 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, crossThreadBind(&createCompositorMutatorClient, | 
| 44                                          crossThreadUnretained(&mutatorClient), | 44                                          crossThreadUnretained(&mutatorClient), | 
| 45                                          crossThreadUnretained(&doneEvent))); | 45                                          crossThreadUnretained(&doneEvent))); | 
| 46   } else { | 46   } else { | 
| 47     createCompositorMutatorClient(&mutatorClient, &doneEvent); | 47     createCompositorMutatorClient(&mutatorClient, &doneEvent); | 
| 48   } | 48   } | 
| 49   // TODO(flackr): Instead of waiting for this event, we may be able to just set
     the | 49   // TODO(flackr): Instead of waiting for this event, we may be able to just set | 
| 50   // mutator on the CompositorProxyClient directly from the compositor thread be
    fore | 50   // the mutator on the CompositorProxyClient directly from the compositor | 
| 51   // it gets used there. We still need to make sure we only create one mutator t
    hough. | 51   // thread before it gets used there. We still need to make sure we only | 
|  | 52   // create one mutator though. | 
| 52   doneEvent.wait(); | 53   doneEvent.wait(); | 
| 53   return mutatorClient; | 54   return mutatorClient; | 
| 54 } | 55 } | 
| 55 | 56 | 
| 56 CompositorMutatorImpl* CompositorMutatorImpl::create() { | 57 CompositorMutatorImpl* CompositorMutatorImpl::create() { | 
| 57   return new CompositorMutatorImpl(); | 58   return new CompositorMutatorImpl(); | 
| 58 } | 59 } | 
| 59 | 60 | 
| 60 bool CompositorMutatorImpl::mutate( | 61 bool CompositorMutatorImpl::mutate( | 
| 61     double monotonicTimeNow, | 62     double monotonicTimeNow, | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
| 86   DCHECK(m_proxyClients.contains(client)); | 87   DCHECK(m_proxyClients.contains(client)); | 
| 87   m_proxyClients.remove(client); | 88   m_proxyClients.remove(client); | 
| 88 } | 89 } | 
| 89 | 90 | 
| 90 void CompositorMutatorImpl::setNeedsMutate() { | 91 void CompositorMutatorImpl::setNeedsMutate() { | 
| 91   TRACE_EVENT0("compositor-worker", "CompositorMutatorImpl::setNeedsMutate"); | 92   TRACE_EVENT0("compositor-worker", "CompositorMutatorImpl::setNeedsMutate"); | 
| 92   m_client->setNeedsMutate(); | 93   m_client->setNeedsMutate(); | 
| 93 } | 94 } | 
| 94 | 95 | 
| 95 }  // namespace blink | 96 }  // namespace blink | 
| OLD | NEW | 
|---|