| 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 21 matching lines...) Expand all Loading... |
| 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/dom/TaskRunnerHelper.h" |
| 38 #include "core/frame/csp/ContentSecurityPolicy.h" | 38 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 39 #include "core/inspector/ConsoleMessage.h" | 39 #include "core/inspector/ConsoleMessage.h" |
| 40 #include "core/loader/FrameLoadRequest.h" | 40 #include "core/loader/FrameLoadRequest.h" |
| 41 #include "core/loader/ThreadableLoadingContext.h" | 41 #include "core/loader/ThreadableLoadingContext.h" |
| 42 #include "core/loader/WorkerFetchContext.h" |
| 42 #include "core/probe/CoreProbes.h" | 43 #include "core/probe/CoreProbes.h" |
| 43 #include "core/workers/ParentFrameTaskRunners.h" | 44 #include "core/workers/ParentFrameTaskRunners.h" |
| 44 #include "core/workers/WorkerClients.h" | 45 #include "core/workers/WorkerClients.h" |
| 45 #include "core/workers/WorkerContentSettingsClient.h" | 46 #include "core/workers/WorkerContentSettingsClient.h" |
| 46 #include "core/workers/WorkerGlobalScope.h" | 47 #include "core/workers/WorkerGlobalScope.h" |
| 47 #include "core/workers/WorkerInspectorProxy.h" | 48 #include "core/workers/WorkerInspectorProxy.h" |
| 48 #include "core/workers/WorkerLoaderProxy.h" | 49 #include "core/workers/WorkerLoaderProxy.h" |
| 49 #include "core/workers/WorkerScriptLoader.h" | 50 #include "core/workers/WorkerScriptLoader.h" |
| 50 #include "core/workers/WorkerThreadStartupData.h" | 51 #include "core/workers/WorkerThreadStartupData.h" |
| 51 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" | 52 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" |
| 52 #include "modules/serviceworkers/ServiceWorkerThread.h" | 53 #include "modules/serviceworkers/ServiceWorkerThread.h" |
| 53 #include "platform/Histogram.h" | 54 #include "platform/Histogram.h" |
| 55 #include "platform/RuntimeEnabledFeatures.h" |
| 54 #include "platform/SharedBuffer.h" | 56 #include "platform/SharedBuffer.h" |
| 55 #include "platform/heap/Handle.h" | 57 #include "platform/heap/Handle.h" |
| 56 #include "platform/loader/fetch/SubstituteData.h" | 58 #include "platform/loader/fetch/SubstituteData.h" |
| 57 #include "platform/network/ContentSecurityPolicyParsers.h" | 59 #include "platform/network/ContentSecurityPolicyParsers.h" |
| 58 #include "platform/network/ContentSecurityPolicyResponseHeaders.h" | 60 #include "platform/network/ContentSecurityPolicyResponseHeaders.h" |
| 59 #include "platform/network/NetworkUtils.h" | 61 #include "platform/network/NetworkUtils.h" |
| 60 #include "platform/weborigin/SecurityOrigin.h" | 62 #include "platform/weborigin/SecurityOrigin.h" |
| 61 #include "platform/wtf/Functional.h" | 63 #include "platform/wtf/Functional.h" |
| 62 #include "platform/wtf/PtrUtil.h" | 64 #include "platform/wtf/PtrUtil.h" |
| 63 #include "public/platform/Platform.h" | 65 #include "public/platform/Platform.h" |
| 64 #include "public/platform/WebURLRequest.h" | 66 #include "public/platform/WebURLRequest.h" |
| 67 #include "public/platform/WebWorkerFetchContext.h" |
| 65 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.
h" | 68 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.
h" |
| 66 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" | 69 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" |
| 67 #include "public/web/WebConsoleMessage.h" | 70 #include "public/web/WebConsoleMessage.h" |
| 68 #include "public/web/WebDevToolsAgent.h" | 71 #include "public/web/WebDevToolsAgent.h" |
| 69 #include "public/web/WebSettings.h" | 72 #include "public/web/WebSettings.h" |
| 70 #include "public/web/WebView.h" | 73 #include "public/web/WebView.h" |
| 71 #include "public/web/WebWorkerContentSettingsClientProxy.h" | 74 #include "public/web/WebWorkerContentSettingsClientProxy.h" |
| 72 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" | 75 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" |
| 73 #include "web/IndexedDBClientImpl.h" | 76 #include "web/IndexedDBClientImpl.h" |
| 74 #include "web/ServiceWorkerGlobalScopeClientImpl.h" | 77 #include "web/ServiceWorkerGlobalScopeClientImpl.h" |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 std::move(content_settings_client_)); | 415 std::move(content_settings_client_)); |
| 413 ProvideIndexedDBClientToWorker(worker_clients, | 416 ProvideIndexedDBClientToWorker(worker_clients, |
| 414 IndexedDBClientImpl::Create(*worker_clients)); | 417 IndexedDBClientImpl::Create(*worker_clients)); |
| 415 ProvideServiceWorkerGlobalScopeClientToWorker( | 418 ProvideServiceWorkerGlobalScopeClientToWorker( |
| 416 worker_clients, | 419 worker_clients, |
| 417 ServiceWorkerGlobalScopeClientImpl::Create(*worker_context_client_)); | 420 ServiceWorkerGlobalScopeClientImpl::Create(*worker_context_client_)); |
| 418 ProvideServiceWorkerContainerClientToWorker( | 421 ProvideServiceWorkerContainerClientToWorker( |
| 419 worker_clients, | 422 worker_clients, |
| 420 WTF::WrapUnique(worker_context_client_->CreateServiceWorkerProvider())); | 423 WTF::WrapUnique(worker_context_client_->CreateServiceWorkerProvider())); |
| 421 | 424 |
| 425 if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) { |
| 426 std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context = |
| 427 |
| 428 worker_context_client_->CreateServiceWorkerFetchContext(); |
| 429 DCHECK(web_worker_fetch_context); |
| 430 // TODO(horo): Set more information about the context (ex: DataSaverEnabled) |
| 431 // to |web_worker_fetch_context|. |
| 432 ProvideWorkerFetchContextToWorker(worker_clients, |
| 433 std::move(web_worker_fetch_context)); |
| 434 } |
| 435 |
| 422 // We need to set the CSP to both the shadow page's document and the | 436 // We need to set the CSP to both the shadow page's document and the |
| 423 // ServiceWorkerGlobalScope. | 437 // ServiceWorkerGlobalScope. |
| 424 document->InitContentSecurityPolicy( | 438 document->InitContentSecurityPolicy( |
| 425 main_script_loader_->ReleaseContentSecurityPolicy()); | 439 main_script_loader_->ReleaseContentSecurityPolicy()); |
| 426 if (!main_script_loader_->GetReferrerPolicy().IsNull()) { | 440 if (!main_script_loader_->GetReferrerPolicy().IsNull()) { |
| 427 document->ParseAndSetReferrerPolicy( | 441 document->ParseAndSetReferrerPolicy( |
| 428 main_script_loader_->GetReferrerPolicy()); | 442 main_script_loader_->GetReferrerPolicy()); |
| 429 } | 443 } |
| 430 | 444 |
| 431 KURL script_url = main_script_loader_->Url(); | 445 KURL script_url = main_script_loader_->Url(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 462 // populate the task runners with null document not to confuse the frame | 476 // populate the task runners with null document not to confuse the frame |
| 463 // scheduler (which will end up using the thread's default task runner). | 477 // scheduler (which will end up using the thread's default task runner). |
| 464 worker_thread_->Start(std::move(startup_data), | 478 worker_thread_->Start(std::move(startup_data), |
| 465 ParentFrameTaskRunners::Create(nullptr)); | 479 ParentFrameTaskRunners::Create(nullptr)); |
| 466 | 480 |
| 467 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), | 481 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), |
| 468 script_url); | 482 script_url); |
| 469 } | 483 } |
| 470 | 484 |
| 471 } // namespace blink | 485 } // namespace blink |
| OLD | NEW |