OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 16 matching lines...) Expand all Loading... |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "web/WebEmbeddedWorkerImpl.h" | 31 #include "web/WebEmbeddedWorkerImpl.h" |
32 | 32 |
33 #include <memory> | 33 #include <memory> |
34 #include "bindings/core/v8/SourceLocation.h" | 34 #include "bindings/core/v8/SourceLocation.h" |
35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
36 #include "core/dom/SecurityContext.h" | 36 #include "core/dom/SecurityContext.h" |
| 37 #include "core/dom/TaskRunnerHelper.h" |
37 #include "core/frame/csp/ContentSecurityPolicy.h" | 38 #include "core/frame/csp/ContentSecurityPolicy.h" |
38 #include "core/inspector/ConsoleMessage.h" | 39 #include "core/inspector/ConsoleMessage.h" |
39 #include "core/loader/FrameLoadRequest.h" | 40 #include "core/loader/FrameLoadRequest.h" |
40 #include "core/loader/ThreadableLoadingContext.h" | 41 #include "core/loader/ThreadableLoadingContext.h" |
41 #include "core/probe/CoreProbes.h" | 42 #include "core/probe/CoreProbes.h" |
42 #include "core/workers/ParentFrameTaskRunners.h" | 43 #include "core/workers/ParentFrameTaskRunners.h" |
43 #include "core/workers/WorkerClients.h" | 44 #include "core/workers/WorkerClients.h" |
44 #include "core/workers/WorkerGlobalScope.h" | 45 #include "core/workers/WorkerGlobalScope.h" |
45 #include "core/workers/WorkerInspectorProxy.h" | 46 #include "core/workers/WorkerInspectorProxy.h" |
46 #include "core/workers/WorkerLoaderProxy.h" | 47 #include "core/workers/WorkerLoaderProxy.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 std::unique_ptr<WTF::CrossThreadClosure> task) { | 266 std::unique_ptr<WTF::CrossThreadClosure> task) { |
266 m_mainThreadTaskRunners->get(TaskType::Networking) | 267 m_mainThreadTaskRunners->get(TaskType::Networking) |
267 ->postTask(BLINK_FROM_HERE, std::move(task)); | 268 ->postTask(BLINK_FROM_HERE, std::move(task)); |
268 } | 269 } |
269 | 270 |
270 void WebEmbeddedWorkerImpl::postTaskToWorkerGlobalScope( | 271 void WebEmbeddedWorkerImpl::postTaskToWorkerGlobalScope( |
271 const WebTraceLocation& location, | 272 const WebTraceLocation& location, |
272 std::unique_ptr<WTF::CrossThreadClosure> task) { | 273 std::unique_ptr<WTF::CrossThreadClosure> task) { |
273 if (m_askedToTerminate || !m_workerThread) | 274 if (m_askedToTerminate || !m_workerThread) |
274 return; | 275 return; |
275 m_workerThread->postTask(location, std::move(task)); | 276 TaskRunnerHelper::get(TaskType::Networking, m_workerThread.get()) |
| 277 ->postTask(location, std::move(task)); |
276 } | 278 } |
277 | 279 |
278 ThreadableLoadingContext* WebEmbeddedWorkerImpl::getThreadableLoadingContext() { | 280 ThreadableLoadingContext* WebEmbeddedWorkerImpl::getThreadableLoadingContext() { |
279 if (!m_loadingContext) { | 281 if (!m_loadingContext) { |
280 m_loadingContext = | 282 m_loadingContext = |
281 ThreadableLoadingContext::create(*m_mainFrame->frame()->document()); | 283 ThreadableLoadingContext::create(*m_mainFrame->frame()->document()); |
282 } | 284 } |
283 return m_loadingContext; | 285 return m_loadingContext; |
284 } | 286 } |
285 | 287 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 *this, *document, *m_workerContextClient); | 473 *this, *document, *m_workerContextClient); |
472 m_loaderProxy = WorkerLoaderProxy::create(this); | 474 m_loaderProxy = WorkerLoaderProxy::create(this); |
473 m_workerThread = | 475 m_workerThread = |
474 ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalScopeProxy); | 476 ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalScopeProxy); |
475 m_workerThread->start(std::move(startupData), m_mainThreadTaskRunners.get()); | 477 m_workerThread->start(std::move(startupData), m_mainThreadTaskRunners.get()); |
476 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), | 478 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), |
477 scriptURL); | 479 scriptURL); |
478 } | 480 } |
479 | 481 |
480 } // namespace blink | 482 } // namespace blink |
OLD | NEW |