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

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: rebase 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 20 matching lines...) Expand all
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
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<WebWorkerFetchContext> web_worker_fetch_context =
nhiroki 2017/04/18 07:56:41 ditto.
horo 2017/04/18 12:53:34 Done.
438 WTF::WrapUnique(
439 worker_context_client_->CreateServiceWorkerFetchContext());
440 // |web_worker_fetch_context| is null if off-main-thread-fetch is disabled.
441 if (web_worker_fetch_context) {
442 // TODO(horo): Set more information about the context (ex: DataSaverEnabled)
443 // to |web_worker_fetch_context|.
444 ProvideWorkerFetchContextToWorker(worker_clients,
445 std::move(web_worker_fetch_context));
446 }
447
436 // We need to set the CSP to both the shadow page's document and the 448 // We need to set the CSP to both the shadow page's document and the
437 // ServiceWorkerGlobalScope. 449 // ServiceWorkerGlobalScope.
438 document->InitContentSecurityPolicy( 450 document->InitContentSecurityPolicy(
439 main_script_loader_->ReleaseContentSecurityPolicy()); 451 main_script_loader_->ReleaseContentSecurityPolicy());
440 if (!main_script_loader_->GetReferrerPolicy().IsNull()) { 452 if (!main_script_loader_->GetReferrerPolicy().IsNull()) {
441 document->ParseAndSetReferrerPolicy( 453 document->ParseAndSetReferrerPolicy(
442 main_script_loader_->GetReferrerPolicy()); 454 main_script_loader_->GetReferrerPolicy());
443 } 455 }
444 456
445 KURL script_url = main_script_loader_->Url(); 457 KURL script_url = main_script_loader_->Url();
(...skipping 30 matching lines...) Expand all
476 loader_proxy_ = WorkerLoaderProxy::Create(this); 488 loader_proxy_ = WorkerLoaderProxy::Create(this);
477 worker_thread_ = 489 worker_thread_ =
478 ServiceWorkerThread::Create(loader_proxy_, *worker_global_scope_proxy_); 490 ServiceWorkerThread::Create(loader_proxy_, *worker_global_scope_proxy_);
479 worker_thread_->Start(std::move(startup_data), 491 worker_thread_->Start(std::move(startup_data),
480 main_thread_task_runners_.Get()); 492 main_thread_task_runners_.Get());
481 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), 493 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(),
482 script_url); 494 script_url);
483 } 495 }
484 496
485 } // namespace blink 497 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698