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

Side by Side Diff: third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h

Issue 2716853002: (WIP) Worker: Merge ParentFrameTaskRunners into TaskRunnerHelper
Patch Set: WIP Created 3 years, 9 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 2016 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 <memory> 5 #include <memory>
6 6
7 #include "bindings/core/v8/SourceLocation.h" 7 #include "bindings/core/v8/SourceLocation.h"
8 #include "bindings/core/v8/V8CacheOptions.h" 8 #include "bindings/core/v8/V8CacheOptions.h"
9 #include "bindings/core/v8/V8GCController.h" 9 #include "bindings/core/v8/V8GCController.h"
10 #include "core/dom/ExecutionContextTask.h" 10 #include "core/dom/ExecutionContextTask.h"
11 #include "core/dom/TaskRunnerHelper.h"
11 #include "core/frame/csp/ContentSecurityPolicy.h" 12 #include "core/frame/csp/ContentSecurityPolicy.h"
12 #include "core/inspector/ConsoleMessage.h" 13 #include "core/inspector/ConsoleMessage.h"
13 #include "core/workers/ParentFrameTaskRunners.h"
14 #include "core/workers/WorkerBackingThread.h" 14 #include "core/workers/WorkerBackingThread.h"
15 #include "core/workers/WorkerClients.h" 15 #include "core/workers/WorkerClients.h"
16 #include "core/workers/WorkerGlobalScope.h" 16 #include "core/workers/WorkerGlobalScope.h"
17 #include "core/workers/WorkerLoaderProxy.h" 17 #include "core/workers/WorkerLoaderProxy.h"
18 #include "core/workers/WorkerReportingProxy.h" 18 #include "core/workers/WorkerReportingProxy.h"
19 #include "core/workers/WorkerThread.h" 19 #include "core/workers/WorkerThread.h"
20 #include "core/workers/WorkerThreadLifecycleObserver.h" 20 #include "core/workers/WorkerThreadLifecycleObserver.h"
21 #include "core/workers/WorkerThreadStartupData.h" 21 #include "core/workers/WorkerThreadStartupData.h"
22 #include "platform/CrossThreadFunctional.h" 22 #include "platform/CrossThreadFunctional.h"
23 #include "platform/WaitableEvent.h" 23 #include "platform/WaitableEvent.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 WorkerBackingThread& workerBackingThread() override { 131 WorkerBackingThread& workerBackingThread() override {
132 return *m_workerBackingThread; 132 return *m_workerBackingThread;
133 } 133 }
134 void clearWorkerBackingThread() override { m_workerBackingThread = nullptr; } 134 void clearWorkerBackingThread() override { m_workerBackingThread = nullptr; }
135 135
136 WorkerOrWorkletGlobalScope* createWorkerGlobalScope( 136 WorkerOrWorkletGlobalScope* createWorkerGlobalScope(
137 std::unique_ptr<WorkerThreadStartupData>) override; 137 std::unique_ptr<WorkerThreadStartupData>) override;
138 138
139 void startWithSourceCode(SecurityOrigin* securityOrigin, 139 void startWithSourceCode(SecurityOrigin* securityOrigin,
140 const String& source, 140 const String& source,
141 ParentFrameTaskRunners* parentFrameTaskRunners) { 141 FrameTaskRunnersHolder* frameTaskRunners) {
142 std::unique_ptr<Vector<CSPHeaderAndType>> headers = 142 std::unique_ptr<Vector<CSPHeaderAndType>> headers =
143 WTF::makeUnique<Vector<CSPHeaderAndType>>(); 143 WTF::makeUnique<Vector<CSPHeaderAndType>>();
144 CSPHeaderAndType headerAndType("contentSecurityPolicy", 144 CSPHeaderAndType headerAndType("contentSecurityPolicy",
145 ContentSecurityPolicyHeaderTypeReport); 145 ContentSecurityPolicyHeaderTypeReport);
146 headers->push_back(headerAndType); 146 headers->push_back(headerAndType);
147 147
148 WorkerClients* clients = nullptr; 148 WorkerClients* clients = nullptr;
149 149
150 start(WorkerThreadStartupData::create( 150 start(WorkerThreadStartupData::create(
151 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", 151 KURL(ParsedURLString, "http://fake.url/"), "fake user agent",
152 source, nullptr, DontPauseWorkerGlobalScopeOnStart, headers.get(), 152 source, nullptr, DontPauseWorkerGlobalScopeOnStart, headers.get(),
153 "", securityOrigin, clients, WebAddressSpaceLocal, nullptr, 153 "", securityOrigin, clients, WebAddressSpaceLocal, nullptr,
154 nullptr, WorkerV8Settings::Default()), 154 nullptr, WorkerV8Settings::Default()),
155 parentFrameTaskRunners); 155 frameTaskRunners);
156 } 156 }
157 157
158 void waitForInit() { 158 void waitForInit() {
159 std::unique_ptr<WaitableEvent> completionEvent = 159 std::unique_ptr<WaitableEvent> completionEvent =
160 WTF::makeUnique<WaitableEvent>(); 160 WTF::makeUnique<WaitableEvent>();
161 workerBackingThread().backingThread().postTask( 161 workerBackingThread().backingThread().postTask(
162 BLINK_FROM_HERE, 162 BLINK_FROM_HERE,
163 crossThreadBind(&WaitableEvent::signal, 163 crossThreadBind(&WaitableEvent::signal,
164 crossThreadUnretained(completionEvent.get()))); 164 crossThreadUnretained(completionEvent.get())));
165 completionEvent->wait(); 165 completionEvent->wait();
(...skipping 30 matching lines...) Expand all
196 196
197 inline WorkerOrWorkletGlobalScope* WorkerThreadForTest::createWorkerGlobalScope( 197 inline WorkerOrWorkletGlobalScope* WorkerThreadForTest::createWorkerGlobalScope(
198 std::unique_ptr<WorkerThreadStartupData> startupData) { 198 std::unique_ptr<WorkerThreadStartupData> startupData) {
199 return new FakeWorkerGlobalScope( 199 return new FakeWorkerGlobalScope(
200 startupData->m_scriptURL, startupData->m_userAgent, this, 200 startupData->m_scriptURL, startupData->m_userAgent, this,
201 std::move(startupData->m_starterOriginPrivilegeData), 201 std::move(startupData->m_starterOriginPrivilegeData),
202 std::move(startupData->m_workerClients)); 202 std::move(startupData->m_workerClients));
203 } 203 }
204 204
205 } // namespace blink 205 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698