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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 std::unique_ptr<WTF::CrossThreadClosure> task) { | 268 std::unique_ptr<WTF::CrossThreadClosure> task) { |
268 main_thread_task_runners_->Get(TaskType::kNetworking) | 269 main_thread_task_runners_->Get(TaskType::kNetworking) |
269 ->PostTask(BLINK_FROM_HERE, std::move(task)); | 270 ->PostTask(BLINK_FROM_HERE, std::move(task)); |
270 } | 271 } |
271 | 272 |
272 void WebEmbeddedWorkerImpl::PostTaskToWorkerGlobalScope( | 273 void WebEmbeddedWorkerImpl::PostTaskToWorkerGlobalScope( |
273 const WebTraceLocation& location, | 274 const WebTraceLocation& location, |
274 std::unique_ptr<WTF::CrossThreadClosure> task) { | 275 std::unique_ptr<WTF::CrossThreadClosure> task) { |
275 if (asked_to_terminate_ || !worker_thread_) | 276 if (asked_to_terminate_ || !worker_thread_) |
276 return; | 277 return; |
277 worker_thread_->PostTask(location, std::move(task)); | 278 TaskRunnerHelper::Get(TaskType::kNetworking, worker_thread_.get()) |
| 279 ->PostTask(location, std::move(task)); |
278 } | 280 } |
279 | 281 |
280 ThreadableLoadingContext* WebEmbeddedWorkerImpl::GetThreadableLoadingContext() { | 282 ThreadableLoadingContext* WebEmbeddedWorkerImpl::GetThreadableLoadingContext() { |
281 if (!loading_context_) { | 283 if (!loading_context_) { |
282 loading_context_ = ThreadableLoadingContext::Create( | 284 loading_context_ = ThreadableLoadingContext::Create( |
283 *main_frame_->GetFrame()->GetDocument()); | 285 *main_frame_->GetFrame()->GetDocument()); |
284 } | 286 } |
285 return loading_context_; | 287 return loading_context_; |
286 } | 288 } |
287 | 289 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 loader_proxy_ = WorkerLoaderProxy::Create(this); | 478 loader_proxy_ = WorkerLoaderProxy::Create(this); |
477 worker_thread_ = | 479 worker_thread_ = |
478 ServiceWorkerThread::Create(loader_proxy_, *worker_global_scope_proxy_); | 480 ServiceWorkerThread::Create(loader_proxy_, *worker_global_scope_proxy_); |
479 worker_thread_->Start(std::move(startup_data), | 481 worker_thread_->Start(std::move(startup_data), |
480 main_thread_task_runners_.Get()); | 482 main_thread_task_runners_.Get()); |
481 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), | 483 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), |
482 script_url); | 484 script_url); |
483 } | 485 } |
484 | 486 |
485 } // namespace blink | 487 } // namespace blink |
OLD | NEW |