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

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

Issue 1895873006: compositor-worker: Initialize CW machinery plumbing to compositor and fire CW rAF callbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bring up oilpan support during compositor worker creation and oilpan the compositor mutator and pro… Created 4 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "web/CompositorProxyClientImpl.h"
6
7 #include "core/dom/CompositorProxy.h"
8 #include "modules/compositorworker/CompositorWorkerGlobalScope.h"
9 #include "platform/TraceEvent.h"
10 #include "web/CompositorMutatorImpl.h"
11
12 namespace blink {
13
14 CompositorProxyClientImpl::CompositorProxyClientImpl(CompositorMutatorImpl* muta tor, double referenceMonotonicTime)
15 : m_mutator(mutator)
16 , m_globalScope(nullptr)
17 , m_referenceMonotonicTime(referenceMonotonicTime)
18 {
19 }
20
21 DEFINE_TRACE(CompositorProxyClientImpl)
22 {
23 CompositorProxyClient::trace(visitor);
24 visitor->trace(m_globalScope);
25 }
26
27 void CompositorProxyClientImpl::setGlobalScope(WorkerGlobalScope* scope)
28 {
29 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::setGlobalScope ");
30 m_globalScope = static_cast<CompositorWorkerGlobalScope*>(scope);
31 if (m_globalScope)
32 m_mutator->registerProxyClient(this);
33 }
34
35 void CompositorProxyClientImpl::requestAnimationFrame()
36 {
37 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::requestAnimati onFrame");
38 m_requestedAnimationFrameCallbacks = true;
39 m_mutator->setNeedsMutate();
40 }
41
42 bool CompositorProxyClientImpl::mutate(double monotonicTimeNow)
43 {
44 if (!m_globalScope)
45 return false;
46
47 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::mutate");
48 if (!m_requestedAnimationFrameCallbacks)
49 return false;
50
51 m_requestedAnimationFrameCallbacks = executeAnimationFrameCallbacks(monotoni cTimeNow);
52
53 return m_requestedAnimationFrameCallbacks;
54 }
55
56 bool CompositorProxyClientImpl::executeAnimationFrameCallbacks(double monotonicT imeNow)
57 {
58 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::executeAnimati onFrameCallbacks");
59 // Convert to zero based document time in milliseconds consistent with reque stAnimationFrame.
60 double highResTimeMs = 1000.0 * (monotonicTimeNow - m_referenceMonotonicTime );
61 const bool shouldReinvoke = m_globalScope->executeAnimationFrameCallbacks(hi ghResTimeMs);
62 return shouldReinvoke;
63 }
64
65 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698