Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp

Issue 2804843005: Implement the infrastructure of creating WorkerFetchContext in worker global scope. (Closed)
Patch Set: incorporated yhirano's comment Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 std::move(content_settings_client_)); 431 std::move(content_settings_client_));
429 ProvideIndexedDBClientToWorker(worker_clients, 432 ProvideIndexedDBClientToWorker(worker_clients,
430 IndexedDBClientImpl::Create(*worker_clients)); 433 IndexedDBClientImpl::Create(*worker_clients));
431 ProvideServiceWorkerGlobalScopeClientToWorker( 434 ProvideServiceWorkerGlobalScopeClientToWorker(
432 worker_clients, 435 worker_clients,
433 ServiceWorkerGlobalScopeClientImpl::Create(*worker_context_client_)); 436 ServiceWorkerGlobalScopeClientImpl::Create(*worker_context_client_));
434 ProvideServiceWorkerContainerClientToWorker( 437 ProvideServiceWorkerContainerClientToWorker(
435 worker_clients, 438 worker_clients,
436 WTF::WrapUnique(worker_context_client_->CreateServiceWorkerProvider())); 439 WTF::WrapUnique(worker_context_client_->CreateServiceWorkerProvider()));
437 440
441 if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) {
442 std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context =
443
444 worker_context_client_->CreateServiceWorkerFetchContext();
445 DCHECK(web_worker_fetch_context);
446 // TODO(horo): Set more information about the context (ex: DataSaverEnabled)
447 // to |web_worker_fetch_context|.
448 ProvideWorkerFetchContextToWorker(worker_clients,
449 std::move(web_worker_fetch_context));
450 }
451
438 // We need to set the CSP to both the shadow page's document and the 452 // We need to set the CSP to both the shadow page's document and the
439 // ServiceWorkerGlobalScope. 453 // ServiceWorkerGlobalScope.
440 document->InitContentSecurityPolicy( 454 document->InitContentSecurityPolicy(
441 main_script_loader_->ReleaseContentSecurityPolicy()); 455 main_script_loader_->ReleaseContentSecurityPolicy());
442 if (!main_script_loader_->GetReferrerPolicy().IsNull()) { 456 if (!main_script_loader_->GetReferrerPolicy().IsNull()) {
443 document->ParseAndSetReferrerPolicy( 457 document->ParseAndSetReferrerPolicy(
444 main_script_loader_->GetReferrerPolicy()); 458 main_script_loader_->GetReferrerPolicy());
445 } 459 }
446 460
447 KURL script_url = main_script_loader_->Url(); 461 KURL script_url = main_script_loader_->Url();
(...skipping 30 matching lines...) Expand all
478 loader_proxy_ = WorkerLoaderProxy::Create(this); 492 loader_proxy_ = WorkerLoaderProxy::Create(this);
479 worker_thread_ = 493 worker_thread_ =
480 ServiceWorkerThread::Create(loader_proxy_, *worker_global_scope_proxy_); 494 ServiceWorkerThread::Create(loader_proxy_, *worker_global_scope_proxy_);
481 worker_thread_->Start(std::move(startup_data), 495 worker_thread_->Start(std::move(startup_data),
482 main_thread_task_runners_.Get()); 496 main_thread_task_runners_.Get());
483 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), 497 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(),
484 script_url); 498 script_url);
485 } 499 }
486 500
487 } // namespace blink 501 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698