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

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

Issue 2214263007: [worklets] Split apart CompositorWorkerThread for sharing with AnimationWorkletThread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix spelling. Created 4 years, 4 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 2016 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/CompositorWorkerThread.h" 5 #include "modules/compositorworker/AbstractCompositorWorkerThread.h"
6 6
7 #include "bindings/core/v8/V8GCController.h"
8 #include "bindings/core/v8/V8Initializer.h"
9 #include "core/workers/InProcessWorkerObjectProxy.h"
10 #include "core/workers/WorkerBackingThread.h" 7 #include "core/workers/WorkerBackingThread.h"
11 #include "core/workers/WorkerThreadStartupData.h"
12 #include "modules/compositorworker/CompositorWorkerGlobalScope.h"
13 #include "platform/CrossThreadFunctional.h" 8 #include "platform/CrossThreadFunctional.h"
14 #include "platform/TraceEvent.h" 9 #include "platform/TraceEvent.h"
15 #include "platform/WaitableEvent.h" 10 #include "platform/WaitableEvent.h"
majidvp 2016/08/08 12:46:48 CrossThreadFunctional, TraceEvent and WaitanleEven
ikilpatrick 2016/08/08 13:54:58 Removed TraceEvent, CrossThreadFunctional used for
majidvp 2016/08/08 14:43:06 Acknowledged.
16 #include "platform/WebThreadSupportingGC.h" 11 #include "platform/WebThreadSupportingGC.h"
17 #include "public/platform/Platform.h" 12 #include "public/platform/Platform.h"
18 #include "wtf/Assertions.h" 13 #include "wtf/Assertions.h"
19 #include "wtf/PtrUtil.h" 14 #include "wtf/PtrUtil.h"
20 #include <memory> 15 #include <memory>
21 16
22 namespace blink { 17 namespace blink {
23 18
24 namespace { 19 namespace {
25 20
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 88
94 void shutdownOnThread(WaitableEvent* doneEvent) 89 void shutdownOnThread(WaitableEvent* doneEvent)
95 { 90 {
96 m_thread->shutdown(); 91 m_thread->shutdown();
97 doneEvent->signal(); 92 doneEvent->signal();
98 } 93 }
99 94
100 std::unique_ptr<WorkerBackingThread> m_thread; 95 std::unique_ptr<WorkerBackingThread> m_thread;
101 bool m_initialized = false; 96 bool m_initialized = false;
102 97
103 static BackingThreadHolder* s_instance; 98 static BackingThreadHolder* s_instance;
majidvp 2016/08/08 12:46:48 Is |BackingThreadHolder| accessible here? You have
ikilpatrick 2016/08/08 13:54:57 Redefined just above?
majidvp 2016/08/08 14:43:06 Acknowledged. Sorry I missed it!
104 }; 99 };
105 100
106 BackingThreadHolder* BackingThreadHolder::s_instance = nullptr; 101 BackingThreadHolder* BackingThreadHolder::s_instance = nullptr;
107 102
108 } // namespace 103 } // namespace
109 104
110 std::unique_ptr<CompositorWorkerThread> CompositorWorkerThread::create(PassRefPt r<WorkerLoaderProxy> workerLoaderProxy, InProcessWorkerObjectProxy& workerObject Proxy, double timeOrigin) 105 AbstractCompositorWorkerThread::AbstractCompositorWorkerThread(PassRefPtr<Worker LoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy)
111 { 106 : WorkerThread(workerLoaderProxy, workerReportingProxy)
112 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositorWork erThread::create");
113 ASSERT(isMainThread());
114 return wrapUnique(new CompositorWorkerThread(workerLoaderProxy, workerObject Proxy, timeOrigin));
115 }
116
117 CompositorWorkerThread::CompositorWorkerThread(PassRefPtr<WorkerLoaderProxy> wor kerLoaderProxy, InProcessWorkerObjectProxy& workerObjectProxy, double timeOrigin )
118 : WorkerThread(workerLoaderProxy, workerObjectProxy)
119 , m_workerObjectProxy(workerObjectProxy)
120 , m_timeOrigin(timeOrigin)
121 { 107 {
122 } 108 }
123 109
124 CompositorWorkerThread::~CompositorWorkerThread() 110 AbstractCompositorWorkerThread::~AbstractCompositorWorkerThread()
125 { 111 {
126 } 112 }
127 113
128 WorkerBackingThread& CompositorWorkerThread::workerBackingThread() 114 WorkerBackingThread& AbstractCompositorWorkerThread::workerBackingThread()
129 { 115 {
130 return *BackingThreadHolder::instance().thread(); 116 return *BackingThreadHolder::instance().thread();
131 } 117 }
132 118
133 WorkerOrWorkletGlobalScope* CompositorWorkerThread::createWorkerGlobalScope(std: :unique_ptr<WorkerThreadStartupData> startupData) 119 void AbstractCompositorWorkerThread::ensureSharedBackingThread()
134 {
135 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositorWork erThread::createWorkerGlobalScope");
136 return CompositorWorkerGlobalScope::create(this, std::move(startupData), m_t imeOrigin);
137 }
138
139 ConsoleMessageStorage* CompositorWorkerThread::consoleMessageStorage()
140 {
141 return toWorkerGlobalScope(globalScope())->consoleMessageStorage();
142 }
143
144 void CompositorWorkerThread::ensureSharedBackingThread()
145 { 120 {
146 DCHECK(isMainThread()); 121 DCHECK(isMainThread());
147 BackingThreadHolder::ensureInstance(); 122 BackingThreadHolder::ensureInstance();
148 } 123 }
149 124
150 void CompositorWorkerThread::clearSharedBackingThread() 125 void AbstractCompositorWorkerThread::clearSharedBackingThread()
151 { 126 {
152 DCHECK(isMainThread()); 127 DCHECK(isMainThread());
153 BackingThreadHolder::clear(); 128 BackingThreadHolder::clear();
154 } 129 }
155 130
156 void CompositorWorkerThread::createSharedBackingThreadForTest() 131 void AbstractCompositorWorkerThread::createSharedBackingThreadForTest()
157 { 132 {
158 BackingThreadHolder::createForTest(); 133 BackingThreadHolder::createForTest();
159 } 134 }
160 135
161 } // namespace blink 136 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698