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

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: address comments. 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"
15 #include "platform/WaitableEvent.h" 9 #include "platform/WaitableEvent.h"
16 #include "platform/WebThreadSupportingGC.h" 10 #include "platform/WebThreadSupportingGC.h"
17 #include "public/platform/Platform.h" 11 #include "public/platform/Platform.h"
18 #include "wtf/Assertions.h" 12 #include "wtf/Assertions.h"
19 #include "wtf/PtrUtil.h" 13 #include "wtf/PtrUtil.h"
20 #include <memory> 14 #include <memory>
21 15
22 namespace blink { 16 namespace blink {
23 17
24 namespace { 18 namespace {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 std::unique_ptr<WorkerBackingThread> m_thread; 94 std::unique_ptr<WorkerBackingThread> m_thread;
101 bool m_initialized = false; 95 bool m_initialized = false;
102 96
103 static BackingThreadHolder* s_instance; 97 static BackingThreadHolder* s_instance;
104 }; 98 };
105 99
106 BackingThreadHolder* BackingThreadHolder::s_instance = nullptr; 100 BackingThreadHolder* BackingThreadHolder::s_instance = nullptr;
107 101
108 } // namespace 102 } // namespace
109 103
110 std::unique_ptr<CompositorWorkerThread> CompositorWorkerThread::create(PassRefPt r<WorkerLoaderProxy> workerLoaderProxy, InProcessWorkerObjectProxy& workerObject Proxy, double timeOrigin) 104 AbstractCompositorWorkerThread::AbstractCompositorWorkerThread(PassRefPtr<Worker LoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy)
111 { 105 : 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 { 106 {
122 } 107 }
123 108
124 CompositorWorkerThread::~CompositorWorkerThread() 109 AbstractCompositorWorkerThread::~AbstractCompositorWorkerThread()
125 { 110 {
126 } 111 }
127 112
128 WorkerBackingThread& CompositorWorkerThread::workerBackingThread() 113 WorkerBackingThread& AbstractCompositorWorkerThread::workerBackingThread()
129 { 114 {
130 return *BackingThreadHolder::instance().thread(); 115 return *BackingThreadHolder::instance().thread();
131 } 116 }
132 117
133 WorkerOrWorkletGlobalScope* CompositorWorkerThread::createWorkerGlobalScope(std: :unique_ptr<WorkerThreadStartupData> startupData) 118 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 { 119 {
146 DCHECK(isMainThread()); 120 DCHECK(isMainThread());
147 BackingThreadHolder::ensureInstance(); 121 BackingThreadHolder::ensureInstance();
148 } 122 }
149 123
150 void CompositorWorkerThread::clearSharedBackingThread() 124 void AbstractCompositorWorkerThread::clearSharedBackingThread()
151 { 125 {
152 DCHECK(isMainThread()); 126 DCHECK(isMainThread());
153 BackingThreadHolder::clear(); 127 BackingThreadHolder::clear();
154 } 128 }
155 129
156 void CompositorWorkerThread::createSharedBackingThreadForTest() 130 void AbstractCompositorWorkerThread::createSharedBackingThreadForTest()
157 { 131 {
158 BackingThreadHolder::createForTest(); 132 BackingThreadHolder::createForTest();
159 } 133 }
160 134
161 } // namespace blink 135 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698