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 20 matching lines...) Expand all Loading... |
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/frame/csp/ContentSecurityPolicy.h" | 37 #include "core/frame/csp/ContentSecurityPolicy.h" |
38 #include "core/inspector/ConsoleMessage.h" | 38 #include "core/inspector/ConsoleMessage.h" |
39 #include "core/loader/FrameLoadRequest.h" | 39 #include "core/loader/FrameLoadRequest.h" |
40 #include "core/loader/ThreadableLoadingContext.h" | 40 #include "core/loader/ThreadableLoadingContext.h" |
| 41 #include "core/loader/WorkerFetchContext.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" |
47 #include "core/workers/WorkerScriptLoader.h" | 48 #include "core/workers/WorkerScriptLoader.h" |
48 #include "core/workers/WorkerThreadStartupData.h" | 49 #include "core/workers/WorkerThreadStartupData.h" |
49 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" | 50 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" |
50 #include "modules/serviceworkers/ServiceWorkerThread.h" | 51 #include "modules/serviceworkers/ServiceWorkerThread.h" |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 std::move(content_settings_client_)); | 427 std::move(content_settings_client_)); |
427 ProvideIndexedDBClientToWorker(worker_clients, | 428 ProvideIndexedDBClientToWorker(worker_clients, |
428 IndexedDBClientImpl::Create(*worker_clients)); | 429 IndexedDBClientImpl::Create(*worker_clients)); |
429 ProvideServiceWorkerGlobalScopeClientToWorker( | 430 ProvideServiceWorkerGlobalScopeClientToWorker( |
430 worker_clients, | 431 worker_clients, |
431 ServiceWorkerGlobalScopeClientImpl::Create(*worker_context_client_)); | 432 ServiceWorkerGlobalScopeClientImpl::Create(*worker_context_client_)); |
432 ProvideServiceWorkerContainerClientToWorker( | 433 ProvideServiceWorkerContainerClientToWorker( |
433 worker_clients, | 434 worker_clients, |
434 WTF::WrapUnique(worker_context_client_->CreateServiceWorkerProvider())); | 435 WTF::WrapUnique(worker_context_client_->CreateServiceWorkerProvider())); |
435 | 436 |
| 437 std::unique_ptr<WebWorkerFetchContextInfo> web_worker_fetch_context_info = |
| 438 WTF::WrapUnique( |
| 439 worker_context_client_->CreateServiceWorkerFetchContextInfo()); |
| 440 // |web_worker_fetch_context_info| is null if off-main-thread-fetch is |
| 441 // disabled. |
| 442 if (web_worker_fetch_context_info) { |
| 443 // TODO(horo): Set more information about the context (ex: DataSaverEnabled) |
| 444 // to |web_worker_fetch_context_info|. |
| 445 ProvideWorkerFetchContextInfoToWorker( |
| 446 worker_clients, std::move(web_worker_fetch_context_info)); |
| 447 } |
| 448 |
436 // We need to set the CSP to both the shadow page's document and the | 449 // We need to set the CSP to both the shadow page's document and the |
437 // ServiceWorkerGlobalScope. | 450 // ServiceWorkerGlobalScope. |
438 document->InitContentSecurityPolicy( | 451 document->InitContentSecurityPolicy( |
439 main_script_loader_->ReleaseContentSecurityPolicy()); | 452 main_script_loader_->ReleaseContentSecurityPolicy()); |
440 if (!main_script_loader_->GetReferrerPolicy().IsNull()) { | 453 if (!main_script_loader_->GetReferrerPolicy().IsNull()) { |
441 document->ParseAndSetReferrerPolicy( | 454 document->ParseAndSetReferrerPolicy( |
442 main_script_loader_->GetReferrerPolicy()); | 455 main_script_loader_->GetReferrerPolicy()); |
443 } | 456 } |
444 | 457 |
445 KURL script_url = main_script_loader_->Url(); | 458 KURL script_url = main_script_loader_->Url(); |
(...skipping 30 matching lines...) Expand all Loading... |
476 loader_proxy_ = WorkerLoaderProxy::Create(this); | 489 loader_proxy_ = WorkerLoaderProxy::Create(this); |
477 worker_thread_ = | 490 worker_thread_ = |
478 ServiceWorkerThread::Create(loader_proxy_, *worker_global_scope_proxy_); | 491 ServiceWorkerThread::Create(loader_proxy_, *worker_global_scope_proxy_); |
479 worker_thread_->Start(std::move(startup_data), | 492 worker_thread_->Start(std::move(startup_data), |
480 main_thread_task_runners_.Get()); | 493 main_thread_task_runners_.Get()); |
481 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), | 494 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), |
482 script_url); | 495 script_url); |
483 } | 496 } |
484 | 497 |
485 } // namespace blink | 498 } // namespace blink |
OLD | NEW |