| 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" | |
| 38 #include "core/frame/csp/ContentSecurityPolicy.h" | 37 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 39 #include "core/inspector/ConsoleMessage.h" | 38 #include "core/inspector/ConsoleMessage.h" |
| 40 #include "core/loader/FrameLoadRequest.h" | 39 #include "core/loader/FrameLoadRequest.h" |
| 41 #include "core/loader/ThreadableLoadingContext.h" | 40 #include "core/loader/ThreadableLoadingContext.h" |
| 42 #include "core/probe/CoreProbes.h" | 41 #include "core/probe/CoreProbes.h" |
| 43 #include "core/workers/ParentFrameTaskRunners.h" | 42 #include "core/workers/ParentFrameTaskRunners.h" |
| 44 #include "core/workers/WorkerClients.h" | 43 #include "core/workers/WorkerClients.h" |
| 45 #include "core/workers/WorkerGlobalScope.h" | 44 #include "core/workers/WorkerGlobalScope.h" |
| 46 #include "core/workers/WorkerInspectorProxy.h" | 45 #include "core/workers/WorkerInspectorProxy.h" |
| 47 #include "core/workers/WorkerLoaderProxy.h" | 46 #include "core/workers/WorkerLoaderProxy.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 std::unique_ptr<WTF::CrossThreadClosure> task) { | 267 std::unique_ptr<WTF::CrossThreadClosure> task) { |
| 269 main_thread_task_runners_->Get(TaskType::kNetworking) | 268 main_thread_task_runners_->Get(TaskType::kNetworking) |
| 270 ->PostTask(BLINK_FROM_HERE, std::move(task)); | 269 ->PostTask(BLINK_FROM_HERE, std::move(task)); |
| 271 } | 270 } |
| 272 | 271 |
| 273 void WebEmbeddedWorkerImpl::PostTaskToWorkerGlobalScope( | 272 void WebEmbeddedWorkerImpl::PostTaskToWorkerGlobalScope( |
| 274 const WebTraceLocation& location, | 273 const WebTraceLocation& location, |
| 275 std::unique_ptr<WTF::CrossThreadClosure> task) { | 274 std::unique_ptr<WTF::CrossThreadClosure> task) { |
| 276 if (asked_to_terminate_ || !worker_thread_) | 275 if (asked_to_terminate_ || !worker_thread_) |
| 277 return; | 276 return; |
| 278 TaskRunnerHelper::Get(TaskType::kNetworking, worker_thread_.get()) | 277 worker_thread_->PostTask(location, std::move(task)); |
| 279 ->PostTask(location, std::move(task)); | |
| 280 } | 278 } |
| 281 | 279 |
| 282 ThreadableLoadingContext* WebEmbeddedWorkerImpl::GetThreadableLoadingContext() { | 280 ThreadableLoadingContext* WebEmbeddedWorkerImpl::GetThreadableLoadingContext() { |
| 283 if (!loading_context_) { | 281 if (!loading_context_) { |
| 284 loading_context_ = ThreadableLoadingContext::Create( | 282 loading_context_ = ThreadableLoadingContext::Create( |
| 285 *main_frame_->GetFrame()->GetDocument()); | 283 *main_frame_->GetFrame()->GetDocument()); |
| 286 } | 284 } |
| 287 return loading_context_; | 285 return loading_context_; |
| 288 } | 286 } |
| 289 | 287 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 loader_proxy_ = WorkerLoaderProxy::Create(this); | 476 loader_proxy_ = WorkerLoaderProxy::Create(this); |
| 479 worker_thread_ = | 477 worker_thread_ = |
| 480 ServiceWorkerThread::Create(loader_proxy_, *worker_global_scope_proxy_); | 478 ServiceWorkerThread::Create(loader_proxy_, *worker_global_scope_proxy_); |
| 481 worker_thread_->Start(std::move(startup_data), | 479 worker_thread_->Start(std::move(startup_data), |
| 482 main_thread_task_runners_.Get()); | 480 main_thread_task_runners_.Get()); |
| 483 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), | 481 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), |
| 484 script_url); | 482 script_url); |
| 485 } | 483 } |
| 486 | 484 |
| 487 } // namespace blink | 485 } // namespace blink |
| OLD | NEW |