OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "web/WebSharedWorkerImpl.h" | 31 #include "web/WebSharedWorkerImpl.h" |
32 | 32 |
33 #include <memory> | 33 #include <memory> |
34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
35 #include "core/events/MessageEvent.h" | 35 #include "core/events/MessageEvent.h" |
36 #include "core/inspector/ConsoleMessage.h" | 36 #include "core/inspector/ConsoleMessage.h" |
37 #include "core/loader/FrameLoadRequest.h" | 37 #include "core/loader/FrameLoadRequest.h" |
38 #include "core/loader/FrameLoader.h" | 38 #include "core/loader/FrameLoader.h" |
39 #include "core/loader/ThreadableLoadingContext.h" | 39 #include "core/loader/ThreadableLoadingContext.h" |
| 40 #include "core/loader/WorkerFetchContext.h" |
40 #include "core/probe/CoreProbes.h" | 41 #include "core/probe/CoreProbes.h" |
41 #include "core/workers/ParentFrameTaskRunners.h" | 42 #include "core/workers/ParentFrameTaskRunners.h" |
42 #include "core/workers/SharedWorkerGlobalScope.h" | 43 #include "core/workers/SharedWorkerGlobalScope.h" |
43 #include "core/workers/SharedWorkerThread.h" | 44 #include "core/workers/SharedWorkerThread.h" |
44 #include "core/workers/WorkerClients.h" | 45 #include "core/workers/WorkerClients.h" |
45 #include "core/workers/WorkerGlobalScope.h" | 46 #include "core/workers/WorkerGlobalScope.h" |
46 #include "core/workers/WorkerInspectorProxy.h" | 47 #include "core/workers/WorkerInspectorProxy.h" |
47 #include "core/workers/WorkerLoaderProxy.h" | 48 #include "core/workers/WorkerLoaderProxy.h" |
48 #include "core/workers/WorkerScriptLoader.h" | 49 #include "core/workers/WorkerScriptLoader.h" |
49 #include "core/workers/WorkerThreadStartupData.h" | 50 #include "core/workers/WorkerThreadStartupData.h" |
50 #include "platform/CrossThreadFunctional.h" | 51 #include "platform/CrossThreadFunctional.h" |
| 52 #include "platform/RuntimeEnabledFeatures.h" |
51 #include "platform/heap/Handle.h" | 53 #include "platform/heap/Handle.h" |
52 #include "platform/heap/Persistent.h" | 54 #include "platform/heap/Persistent.h" |
| 55 #include "platform/loader/fetch/ResourceFetcher.h" |
53 #include "platform/loader/fetch/ResourceResponse.h" | 56 #include "platform/loader/fetch/ResourceResponse.h" |
54 #include "platform/network/ContentSecurityPolicyParsers.h" | 57 #include "platform/network/ContentSecurityPolicyParsers.h" |
55 #include "platform/weborigin/KURL.h" | 58 #include "platform/weborigin/KURL.h" |
56 #include "platform/weborigin/SecurityOrigin.h" | 59 #include "platform/weborigin/SecurityOrigin.h" |
57 #include "platform/wtf/Functional.h" | 60 #include "platform/wtf/Functional.h" |
58 #include "platform/wtf/PtrUtil.h" | 61 #include "platform/wtf/PtrUtil.h" |
59 #include "public/platform/Platform.h" | 62 #include "public/platform/Platform.h" |
60 #include "public/platform/WebMessagePortChannel.h" | 63 #include "public/platform/WebMessagePortChannel.h" |
61 #include "public/platform/WebString.h" | 64 #include "public/platform/WebString.h" |
62 #include "public/platform/WebURL.h" | 65 #include "public/platform/WebURL.h" |
63 #include "public/platform/WebURLRequest.h" | 66 #include "public/platform/WebURLRequest.h" |
| 67 #include "public/platform/WebWorkerFetchContext.h" |
64 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.
h" | 68 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.
h" |
65 #include "public/web/WebDevToolsAgent.h" | 69 #include "public/web/WebDevToolsAgent.h" |
66 #include "public/web/WebFrame.h" | 70 #include "public/web/WebFrame.h" |
67 #include "public/web/WebSettings.h" | 71 #include "public/web/WebSettings.h" |
68 #include "public/web/WebView.h" | 72 #include "public/web/WebView.h" |
69 #include "public/web/WebWorkerContentSettingsClientProxy.h" | 73 #include "public/web/WebWorkerContentSettingsClientProxy.h" |
70 #include "web/IndexedDBClientImpl.h" | 74 #include "web/IndexedDBClientImpl.h" |
71 #include "web/LocalFileSystemClient.h" | 75 #include "web/LocalFileSystemClient.h" |
72 #include "web/WebDataSourceImpl.h" | 76 #include "web/WebDataSourceImpl.h" |
73 #include "web/WebLocalFrameImpl.h" | 77 #include "web/WebLocalFrameImpl.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 WorkerClients* worker_clients = WorkerClients::Create(); | 336 WorkerClients* worker_clients = WorkerClients::Create(); |
333 ProvideLocalFileSystemToWorker(worker_clients, | 337 ProvideLocalFileSystemToWorker(worker_clients, |
334 LocalFileSystemClient::Create()); | 338 LocalFileSystemClient::Create()); |
335 WebSecurityOrigin web_security_origin(loading_document_->GetSecurityOrigin()); | 339 WebSecurityOrigin web_security_origin(loading_document_->GetSecurityOrigin()); |
336 ProvideContentSettingsClientToWorker( | 340 ProvideContentSettingsClientToWorker( |
337 worker_clients, | 341 worker_clients, |
338 WTF::WrapUnique(client_->CreateWorkerContentSettingsClientProxy( | 342 WTF::WrapUnique(client_->CreateWorkerContentSettingsClientProxy( |
339 web_security_origin))); | 343 web_security_origin))); |
340 ProvideIndexedDBClientToWorker(worker_clients, | 344 ProvideIndexedDBClientToWorker(worker_clients, |
341 IndexedDBClientImpl::Create(*worker_clients)); | 345 IndexedDBClientImpl::Create(*worker_clients)); |
| 346 |
| 347 if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) { |
| 348 std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context = |
| 349 WTF::WrapUnique(client_->CreateWorkerFetchContext()); |
| 350 DCHECK(web_worker_fetch_context); |
| 351 web_worker_fetch_context->SetAppCacheHostID( |
| 352 document->Fetcher()->Context().ApplicationCacheHostID()); |
| 353 web_worker_fetch_context->SetDataSaverEnabled( |
| 354 document->GetFrame()->GetSettings()->GetDataSaverEnabled()); |
| 355 web_worker_fetch_context->SetStrictMixedContentCheckingEnabled( |
| 356 document->GetFrame()->GetSettings()->GetStrictMixedContentChecking()); |
| 357 ProvideWorkerFetchContextToWorker(worker_clients, |
| 358 std::move(web_worker_fetch_context)); |
| 359 } |
| 360 |
342 ContentSecurityPolicy* content_security_policy = | 361 ContentSecurityPolicy* content_security_policy = |
343 main_script_loader_->ReleaseContentSecurityPolicy(); | 362 main_script_loader_->ReleaseContentSecurityPolicy(); |
344 WorkerThreadStartMode start_mode = | 363 WorkerThreadStartMode start_mode = |
345 worker_inspector_proxy_->WorkerStartMode(document); | 364 worker_inspector_proxy_->WorkerStartMode(document); |
346 std::unique_ptr<WorkerSettings> worker_settings = | 365 std::unique_ptr<WorkerSettings> worker_settings = |
347 WTF::WrapUnique(new WorkerSettings(document->GetSettings())); | 366 WTF::WrapUnique(new WorkerSettings(document->GetSettings())); |
348 std::unique_ptr<WorkerThreadStartupData> startup_data = | 367 std::unique_ptr<WorkerThreadStartupData> startup_data = |
349 WorkerThreadStartupData::Create( | 368 WorkerThreadStartupData::Create( |
350 url_, loading_document_->UserAgent(), | 369 url_, loading_document_->UserAgent(), |
351 main_script_loader_->SourceText(), nullptr, start_mode, | 370 main_script_loader_->SourceText(), nullptr, start_mode, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 const WebString& method, | 435 const WebString& method, |
417 const WebString& message) { | 436 const WebString& message) { |
418 if (asked_to_terminate_) | 437 if (asked_to_terminate_) |
419 return; | 438 return; |
420 WebDevToolsAgent* devtools_agent = main_frame_->DevToolsAgent(); | 439 WebDevToolsAgent* devtools_agent = main_frame_->DevToolsAgent(); |
421 if (devtools_agent) | 440 if (devtools_agent) |
422 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method, | 441 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method, |
423 message); | 442 message); |
424 } | 443 } |
425 | 444 |
| 445 WebServiceWorkerNetworkProvider* |
| 446 WebSharedWorkerImpl::GetServiceWorkerNetworkProvider() { |
| 447 WebLocalFrameImpl* webFrame = |
| 448 WebLocalFrameImpl::FromFrame(main_frame_->GetFrame()); |
| 449 return webFrame->DataSource()->GetServiceWorkerNetworkProvider(); |
| 450 } |
| 451 |
426 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) { | 452 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) { |
427 return new WebSharedWorkerImpl(client); | 453 return new WebSharedWorkerImpl(client); |
428 } | 454 } |
429 | 455 |
430 } // namespace blink | 456 } // namespace blink |
OLD | NEW |