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

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: Add big fat TODOs in scheduler code to implement proper idle task scheduling and ensure GC is runni… 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)
15 : m_mutator(mutator)
16 , m_globalScope(nullptr)
17 {
18 }
19
20 DEFINE_TRACE(CompositorProxyClientImpl)
21 {
22 CompositorProxyClient::trace(visitor);
23 visitor->trace(m_mutator);
24 visitor->trace(m_globalScope);
25 }
26
27 void CompositorProxyClientImpl::setGlobalScope(WorkerGlobalScope* scope)
28 {
29 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::setGlobalScope ");
30 ASSERT(!m_globalScope);
31 ASSERT(scope);
32 m_globalScope = static_cast<CompositorWorkerGlobalScope*>(scope);
33 m_mutator->registerProxyClient(this);
34 }
35
36 void CompositorProxyClientImpl::requestAnimationFrame()
37 {
38 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::requestAnimati onFrame");
39 m_requestedAnimationFrameCallbacks = true;
40 m_mutator->setNeedsMutate();
41 }
42
43 bool CompositorProxyClientImpl::mutate(double monotonicTimeNow)
44 {
45 if (!m_globalScope)
46 return false;
47
48 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::mutate");
49 if (!m_requestedAnimationFrameCallbacks)
50 return false;
51
52 m_requestedAnimationFrameCallbacks = executeAnimationFrameCallbacks(monotoni cTimeNow);
53
54 return m_requestedAnimationFrameCallbacks;
55 }
56
57 bool CompositorProxyClientImpl::executeAnimationFrameCallbacks(double monotonicT imeNow)
58 {
59 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::executeAnimati onFrameCallbacks");
60 // Convert to zero based document time in milliseconds consistent with reque stAnimationFrame.
61 double highResTimeMs = 1000.0 * (monotonicTimeNow - m_globalScope->timeOrigi n());
62 const bool shouldReinvoke = m_globalScope->executeAnimationFrameCallbacks(hi ghResTimeMs);
63 return shouldReinvoke;
64 }
65
66 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698