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

Side by Side Diff: third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp

Issue 2515363002: Introduce AnimationWorkletProxyClient and necessary plumbing to get it in worklet messaging proxy. (Closed)
Patch Set: Fix build file Created 4 years 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 "modules/compositorworker/CompositorWorkerGlobalScope.h" 5 #include "modules/compositorworker/CompositorWorkerGlobalScope.h"
6 6
7 #include "bindings/core/v8/SerializedScriptValue.h" 7 #include "bindings/core/v8/SerializedScriptValue.h"
8 #include "core/workers/InProcessWorkerObjectProxy.h" 8 #include "core/workers/InProcessWorkerObjectProxy.h"
9 #include "core/workers/WorkerThreadStartupData.h" 9 #include "core/workers/WorkerThreadStartupData.h"
10 #include "modules/EventTargetModules.h" 10 #include "modules/EventTargetModules.h"
(...skipping 29 matching lines...) Expand all
40 std::unique_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, 40 std::unique_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData,
41 WorkerClients* workerClients) 41 WorkerClients* workerClients)
42 : WorkerGlobalScope(url, 42 : WorkerGlobalScope(url,
43 userAgent, 43 userAgent,
44 thread, 44 thread,
45 timeOrigin, 45 timeOrigin,
46 std::move(starterOriginPrivilegeData), 46 std::move(starterOriginPrivilegeData),
47 workerClients), 47 workerClients),
48 m_executingAnimationFrameCallbacks(false), 48 m_executingAnimationFrameCallbacks(false),
49 m_callbackCollection(this) { 49 m_callbackCollection(this) {
50 CompositorProxyClient::from(clients())->setGlobalScope(this); 50 CompositorWorkerProxyClient::from(clients())->setGlobalScope(this);
51 } 51 }
52 52
53 CompositorWorkerGlobalScope::~CompositorWorkerGlobalScope() {} 53 CompositorWorkerGlobalScope::~CompositorWorkerGlobalScope() {}
54 54
55 void CompositorWorkerGlobalScope::dispose() { 55 void CompositorWorkerGlobalScope::dispose() {
56 WorkerGlobalScope::dispose(); 56 WorkerGlobalScope::dispose();
57 CompositorProxyClient::from(clients())->dispose(); 57 CompositorWorkerProxyClient::from(clients())->dispose();
58 } 58 }
59 59
60 DEFINE_TRACE(CompositorWorkerGlobalScope) { 60 DEFINE_TRACE(CompositorWorkerGlobalScope) {
61 visitor->trace(m_callbackCollection); 61 visitor->trace(m_callbackCollection);
62 WorkerGlobalScope::trace(visitor); 62 WorkerGlobalScope::trace(visitor);
63 } 63 }
64 64
65 const AtomicString& CompositorWorkerGlobalScope::interfaceName() const { 65 const AtomicString& CompositorWorkerGlobalScope::interfaceName() const {
66 return EventTargetNames::CompositorWorkerGlobalScope; 66 return EventTargetNames::CompositorWorkerGlobalScope;
67 } 67 }
(...skipping 10 matching lines...) Expand all
78 return; 78 return;
79 workerObjectProxy().postMessageToWorkerObject(std::move(message), 79 workerObjectProxy().postMessageToWorkerObject(std::move(message),
80 std::move(channels)); 80 std::move(channels));
81 } 81 }
82 82
83 int CompositorWorkerGlobalScope::requestAnimationFrame( 83 int CompositorWorkerGlobalScope::requestAnimationFrame(
84 FrameRequestCallback* callback) { 84 FrameRequestCallback* callback) {
85 const bool shouldSignal = 85 const bool shouldSignal =
86 !m_executingAnimationFrameCallbacks && m_callbackCollection.isEmpty(); 86 !m_executingAnimationFrameCallbacks && m_callbackCollection.isEmpty();
87 if (shouldSignal) 87 if (shouldSignal)
88 CompositorProxyClient::from(clients())->requestAnimationFrame(); 88 CompositorWorkerProxyClient::from(clients())->requestAnimationFrame();
89 return m_callbackCollection.registerCallback(callback); 89 return m_callbackCollection.registerCallback(callback);
90 } 90 }
91 91
92 void CompositorWorkerGlobalScope::cancelAnimationFrame(int id) { 92 void CompositorWorkerGlobalScope::cancelAnimationFrame(int id) {
93 m_callbackCollection.cancelCallback(id); 93 m_callbackCollection.cancelCallback(id);
94 } 94 }
95 95
96 bool CompositorWorkerGlobalScope::executeAnimationFrameCallbacks( 96 bool CompositorWorkerGlobalScope::executeAnimationFrameCallbacks(
97 double highResTimeMs) { 97 double highResTimeMs) {
98 AutoReset<bool> temporaryChange(&m_executingAnimationFrameCallbacks, true); 98 AutoReset<bool> temporaryChange(&m_executingAnimationFrameCallbacks, true);
99 m_callbackCollection.executeCallbacks(highResTimeMs, highResTimeMs); 99 m_callbackCollection.executeCallbacks(highResTimeMs, highResTimeMs);
100 return !m_callbackCollection.isEmpty(); 100 return !m_callbackCollection.isEmpty();
101 } 101 }
102 102
103 InProcessWorkerObjectProxy& CompositorWorkerGlobalScope::workerObjectProxy() 103 InProcessWorkerObjectProxy& CompositorWorkerGlobalScope::workerObjectProxy()
104 const { 104 const {
105 return static_cast<CompositorWorkerThread*>(thread())->workerObjectProxy(); 105 return static_cast<CompositorWorkerThread*>(thread())->workerObjectProxy();
106 } 106 }
107 107
108 } // namespace blink 108 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698