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

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: Remove unnecessary PLATFORM_EXPORT Created 3 years, 10 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 "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/dom/CompositorWorkerProxyClient.h"
8 #include "core/workers/InProcessWorkerObjectProxy.h" 9 #include "core/workers/InProcessWorkerObjectProxy.h"
9 #include "core/workers/WorkerThreadStartupData.h" 10 #include "core/workers/WorkerThreadStartupData.h"
10 #include "modules/EventTargetModules.h" 11 #include "modules/EventTargetModules.h"
11 #include "modules/compositorworker/CompositorWorkerThread.h" 12 #include "modules/compositorworker/CompositorWorkerThread.h"
12 #include "wtf/AutoReset.h" 13 #include "wtf/AutoReset.h"
13 #include <memory> 14 #include <memory>
14 15
15 namespace blink { 16 namespace blink {
16 17
17 CompositorWorkerGlobalScope* CompositorWorkerGlobalScope::create( 18 CompositorWorkerGlobalScope* CompositorWorkerGlobalScope::create(
(...skipping 22 matching lines...) Expand all
40 std::unique_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, 41 std::unique_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData,
41 WorkerClients* workerClients) 42 WorkerClients* workerClients)
42 : WorkerGlobalScope(url, 43 : WorkerGlobalScope(url,
43 userAgent, 44 userAgent,
44 thread, 45 thread,
45 timeOrigin, 46 timeOrigin,
46 std::move(starterOriginPrivilegeData), 47 std::move(starterOriginPrivilegeData),
47 workerClients), 48 workerClients),
48 m_executingAnimationFrameCallbacks(false), 49 m_executingAnimationFrameCallbacks(false),
49 m_callbackCollection(this) { 50 m_callbackCollection(this) {
50 CompositorProxyClient::from(clients())->setGlobalScope(this); 51 CompositorWorkerProxyClient::from(clients())->setGlobalScope(this);
51 } 52 }
52 53
53 CompositorWorkerGlobalScope::~CompositorWorkerGlobalScope() {} 54 CompositorWorkerGlobalScope::~CompositorWorkerGlobalScope() {}
54 55
55 void CompositorWorkerGlobalScope::dispose() { 56 void CompositorWorkerGlobalScope::dispose() {
56 WorkerGlobalScope::dispose(); 57 WorkerGlobalScope::dispose();
57 CompositorProxyClient::from(clients())->dispose(); 58 CompositorWorkerProxyClient::from(clients())->dispose();
58 } 59 }
59 60
60 DEFINE_TRACE(CompositorWorkerGlobalScope) { 61 DEFINE_TRACE(CompositorWorkerGlobalScope) {
61 visitor->trace(m_callbackCollection); 62 visitor->trace(m_callbackCollection);
62 WorkerGlobalScope::trace(visitor); 63 WorkerGlobalScope::trace(visitor);
63 } 64 }
64 65
65 const AtomicString& CompositorWorkerGlobalScope::interfaceName() const { 66 const AtomicString& CompositorWorkerGlobalScope::interfaceName() const {
66 return EventTargetNames::CompositorWorkerGlobalScope; 67 return EventTargetNames::CompositorWorkerGlobalScope;
67 } 68 }
(...skipping 10 matching lines...) Expand all
78 return; 79 return;
79 workerObjectProxy().postMessageToWorkerObject(std::move(message), 80 workerObjectProxy().postMessageToWorkerObject(std::move(message),
80 std::move(channels)); 81 std::move(channels));
81 } 82 }
82 83
83 int CompositorWorkerGlobalScope::requestAnimationFrame( 84 int CompositorWorkerGlobalScope::requestAnimationFrame(
84 FrameRequestCallback* callback) { 85 FrameRequestCallback* callback) {
85 const bool shouldSignal = 86 const bool shouldSignal =
86 !m_executingAnimationFrameCallbacks && m_callbackCollection.isEmpty(); 87 !m_executingAnimationFrameCallbacks && m_callbackCollection.isEmpty();
87 if (shouldSignal) 88 if (shouldSignal)
88 CompositorProxyClient::from(clients())->requestAnimationFrame(); 89 CompositorWorkerProxyClient::from(clients())->requestAnimationFrame();
89 return m_callbackCollection.registerCallback(callback); 90 return m_callbackCollection.registerCallback(callback);
90 } 91 }
91 92
92 void CompositorWorkerGlobalScope::cancelAnimationFrame(int id) { 93 void CompositorWorkerGlobalScope::cancelAnimationFrame(int id) {
93 m_callbackCollection.cancelCallback(id); 94 m_callbackCollection.cancelCallback(id);
94 } 95 }
95 96
96 bool CompositorWorkerGlobalScope::executeAnimationFrameCallbacks( 97 bool CompositorWorkerGlobalScope::executeAnimationFrameCallbacks(
97 double highResTimeMs) { 98 double highResTimeMs) {
98 AutoReset<bool> temporaryChange(&m_executingAnimationFrameCallbacks, true); 99 AutoReset<bool> temporaryChange(&m_executingAnimationFrameCallbacks, true);
99 m_callbackCollection.executeCallbacks(highResTimeMs, highResTimeMs); 100 m_callbackCollection.executeCallbacks(highResTimeMs, highResTimeMs);
100 return !m_callbackCollection.isEmpty(); 101 return !m_callbackCollection.isEmpty();
101 } 102 }
102 103
103 InProcessWorkerObjectProxy& CompositorWorkerGlobalScope::workerObjectProxy() 104 InProcessWorkerObjectProxy& CompositorWorkerGlobalScope::workerObjectProxy()
104 const { 105 const {
105 return static_cast<CompositorWorkerThread*>(thread())->workerObjectProxy(); 106 return static_cast<CompositorWorkerThread*>(thread())->workerObjectProxy();
106 } 107 }
107 108
108 } // namespace blink 109 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698