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

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

Issue 1956893003: compositor-worker: Add CompositorProxyClient worker client of CompositorWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use local root frame and remove unneeded includes. 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
(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 "wtf/CurrentTime.h"
11
12 namespace blink {
13
14 CompositorProxyClientImpl::CompositorProxyClientImpl()
15 : m_globalScope(nullptr)
16 {
17 }
18
19 DEFINE_TRACE(CompositorProxyClientImpl)
20 {
21 CompositorProxyClient::trace(visitor);
22 visitor->trace(m_globalScope);
23 }
24
25 void CompositorProxyClientImpl::setGlobalScope(WorkerGlobalScope* scope)
26 {
27 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::setGlobalScope ");
28 DCHECK(!m_globalScope);
29 DCHECK(scope);
30 m_globalScope = static_cast<CompositorWorkerGlobalScope*>(scope);
31 }
32
33 void CompositorProxyClientImpl::runAnimationFrameCallbacks()
34 {
35 m_requestedAnimationFrameCallbacks = true;
36 mutate(monotonicallyIncreasingTime());
37 }
38
39 bool CompositorProxyClientImpl::mutate(double monotonicTimeNow)
40 {
41 if (!m_globalScope)
42 return false;
43
44 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::mutate");
45 if (!m_requestedAnimationFrameCallbacks)
46 return false;
47
48 m_requestedAnimationFrameCallbacks = executeAnimationFrameCallbacks(monotoni cTimeNow);
49
50 return m_requestedAnimationFrameCallbacks;
51 }
52
53 bool CompositorProxyClientImpl::executeAnimationFrameCallbacks(double monotonicT imeNow)
54 {
55 TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::executeAnimati onFrameCallbacks");
56 // Convert to zero based document time in milliseconds consistent with reque stAnimationFrame.
57 double highResTimeMs = 1000.0 * (monotonicTimeNow - m_globalScope->timeOrigi n());
58 const bool shouldReinvoke = m_globalScope->executeAnimationFrameCallbacks(hi ghResTimeMs);
59 return shouldReinvoke;
60 }
61
62 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/CompositorProxyClientImpl.h ('k') | third_party/WebKit/Source/web/WebFrameWidgetImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698