Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: third_party/WebKit/Source/web/CompositorProxyClientImpl.cpp

Issue 2041193005: [compositorworker] compositor proxy mutation updates underlying layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compositor-worker-upstream-registration
Patch Set: Fix inlcudes Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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/CompositorProxyClientImpl.h" 5 #include "web/CompositorProxyClientImpl.h"
6 6
7 #include "core/dom/CompositorProxy.h" 7 #include "core/dom/CompositorProxy.h"
8 #include "modules/compositorworker/CompositorWorkerGlobalScope.h" 8 #include "modules/compositorworker/CompositorWorkerGlobalScope.h"
9 #include "platform/TraceEvent.h" 9 #include "platform/TraceEvent.h"
10 #include "platform/graphics/CompositorMutableStateProvider.h"
10 #include "web/CompositorMutatorImpl.h" 11 #include "web/CompositorMutatorImpl.h"
11 #include "wtf/CurrentTime.h" 12 #include "wtf/CurrentTime.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 CompositorProxyClientImpl::CompositorProxyClientImpl(CompositorMutatorImpl* muta tor) 16 CompositorProxyClientImpl::CompositorProxyClientImpl(CompositorMutatorImpl* muta tor)
16 : m_mutator(mutator) 17 : m_mutator(mutator)
17 , m_globalScope(nullptr) 18 , m_globalScope(nullptr)
18 { 19 {
19 } 20 }
(...skipping 15 matching lines...) Expand all
35 m_mutator->registerProxyClient(this); 36 m_mutator->registerProxyClient(this);
36 } 37 }
37 38
38 void CompositorProxyClientImpl::requestAnimationFrame() 39 void CompositorProxyClientImpl::requestAnimationFrame()
39 { 40 {
40 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::requestAnimati onFrame"); 41 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::requestAnimati onFrame");
41 m_requestedAnimationFrameCallbacks = true; 42 m_requestedAnimationFrameCallbacks = true;
42 m_mutator->setNeedsMutate(); 43 m_mutator->setNeedsMutate();
43 } 44 }
44 45
45 bool CompositorProxyClientImpl::mutate(double monotonicTimeNow) 46 bool CompositorProxyClientImpl::mutate(double monotonicTimeNow, CompositorMutabl eStateProvider* stateProvider)
46 { 47 {
47 if (!m_globalScope) 48 if (!m_globalScope)
48 return false; 49 return false;
49 50
50 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::mutate"); 51 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::mutate");
51 if (!m_requestedAnimationFrameCallbacks) 52 if (!m_requestedAnimationFrameCallbacks)
52 return false; 53 return false;
53 54
55 updateMutableStateForCompositorProxies(stateProvider);
jbroman 2016/06/13 19:45:17 Mind clarifying what's going on here? I think I ge
majidvp 2016/06/13 21:52:51 Yes. Proxies may only mutate the tree during rAF.
54 m_requestedAnimationFrameCallbacks = executeAnimationFrameCallbacks(monotoni cTimeNow); 56 m_requestedAnimationFrameCallbacks = executeAnimationFrameCallbacks(monotoni cTimeNow);
57 updateMutableStateForCompositorProxies(nullptr);
55 58
56 return m_requestedAnimationFrameCallbacks; 59 return m_requestedAnimationFrameCallbacks;
57 } 60 }
58 61
59 bool CompositorProxyClientImpl::executeAnimationFrameCallbacks(double monotonicT imeNow) 62 bool CompositorProxyClientImpl::executeAnimationFrameCallbacks(double monotonicT imeNow)
60 { 63 {
61 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::executeAnimati onFrameCallbacks"); 64 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::executeAnimati onFrameCallbacks");
65
62 // Convert to zero based document time in milliseconds consistent with reque stAnimationFrame. 66 // Convert to zero based document time in milliseconds consistent with reque stAnimationFrame.
63 double highResTimeMs = 1000.0 * (monotonicTimeNow - m_globalScope->timeOrigi n()); 67 double highResTimeMs = 1000.0 * (monotonicTimeNow - m_globalScope->timeOrigi n());
64 const bool shouldReinvoke = m_globalScope->executeAnimationFrameCallbacks(hi ghResTimeMs); 68 return m_globalScope->executeAnimationFrameCallbacks(highResTimeMs);
65 return shouldReinvoke; 69 }
70
71 void CompositorProxyClientImpl::updateMutableStateForCompositorProxies(Composito rMutableStateProvider* stateProvider)
72 {
73 for (CompositorProxy* proxy : m_proxies)
74 proxy->takeCompositorMutableState(stateProvider ? stateProvider->getMuta bleStateFor(proxy->elementId()) : nullptr);
66 } 75 }
67 76
68 void CompositorProxyClientImpl::registerCompositorProxy(CompositorProxy* proxy) 77 void CompositorProxyClientImpl::registerCompositorProxy(CompositorProxy* proxy)
69 { 78 {
70 m_proxies.add(proxy); 79 m_proxies.add(proxy);
71 } 80 }
72 81
73 void CompositorProxyClientImpl::unregisterCompositorProxy(CompositorProxy* proxy ) 82 void CompositorProxyClientImpl::unregisterCompositorProxy(CompositorProxy* proxy )
74 { 83 {
75 m_proxies.remove(proxy); 84 m_proxies.remove(proxy);
76 } 85 }
77 86
78 } // namespace blink 87 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698