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" |
53 #include "platform/loader/fetch/ResourceResponse.h" | 55 #include "platform/loader/fetch/ResourceResponse.h" |
54 #include "platform/network/ContentSecurityPolicyParsers.h" | 56 #include "platform/network/ContentSecurityPolicyParsers.h" |
55 #include "platform/weborigin/KURL.h" | 57 #include "platform/weborigin/KURL.h" |
56 #include "platform/weborigin/SecurityOrigin.h" | 58 #include "platform/weborigin/SecurityOrigin.h" |
57 #include "platform/wtf/Functional.h" | 59 #include "platform/wtf/Functional.h" |
58 #include "platform/wtf/PtrUtil.h" | 60 #include "platform/wtf/PtrUtil.h" |
59 #include "public/platform/Platform.h" | 61 #include "public/platform/Platform.h" |
60 #include "public/platform/WebMessagePortChannel.h" | 62 #include "public/platform/WebMessagePortChannel.h" |
61 #include "public/platform/WebString.h" | 63 #include "public/platform/WebString.h" |
62 #include "public/platform/WebURL.h" | 64 #include "public/platform/WebURL.h" |
63 #include "public/platform/WebURLRequest.h" | 65 #include "public/platform/WebURLRequest.h" |
66 #include "public/platform/WebWorkerFetchContext.h" | |
64 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider. h" | 67 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider. h" |
65 #include "public/web/WebDevToolsAgent.h" | 68 #include "public/web/WebDevToolsAgent.h" |
66 #include "public/web/WebFrame.h" | 69 #include "public/web/WebFrame.h" |
67 #include "public/web/WebSettings.h" | 70 #include "public/web/WebSettings.h" |
68 #include "public/web/WebView.h" | 71 #include "public/web/WebView.h" |
69 #include "public/web/WebWorkerContentSettingsClientProxy.h" | 72 #include "public/web/WebWorkerContentSettingsClientProxy.h" |
70 #include "web/IndexedDBClientImpl.h" | 73 #include "web/IndexedDBClientImpl.h" |
71 #include "web/LocalFileSystemClient.h" | 74 #include "web/LocalFileSystemClient.h" |
72 #include "web/WebDataSourceImpl.h" | 75 #include "web/WebDataSourceImpl.h" |
73 #include "web/WebLocalFrameImpl.h" | 76 #include "web/WebLocalFrameImpl.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 WorkerClients* worker_clients = WorkerClients::Create(); | 335 WorkerClients* worker_clients = WorkerClients::Create(); |
333 ProvideLocalFileSystemToWorker(worker_clients, | 336 ProvideLocalFileSystemToWorker(worker_clients, |
334 LocalFileSystemClient::Create()); | 337 LocalFileSystemClient::Create()); |
335 WebSecurityOrigin web_security_origin(loading_document_->GetSecurityOrigin()); | 338 WebSecurityOrigin web_security_origin(loading_document_->GetSecurityOrigin()); |
336 ProvideContentSettingsClientToWorker( | 339 ProvideContentSettingsClientToWorker( |
337 worker_clients, | 340 worker_clients, |
338 WTF::WrapUnique(client_->CreateWorkerContentSettingsClientProxy( | 341 WTF::WrapUnique(client_->CreateWorkerContentSettingsClientProxy( |
339 web_security_origin))); | 342 web_security_origin))); |
340 ProvideIndexedDBClientToWorker(worker_clients, | 343 ProvideIndexedDBClientToWorker(worker_clients, |
341 IndexedDBClientImpl::Create(*worker_clients)); | 344 IndexedDBClientImpl::Create(*worker_clients)); |
345 | |
346 if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) { | |
347 std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context = | |
348 WTF::WrapUnique(client_->CreateWorkerFetchContext()); | |
349 DCHECK(web_worker_fetch_context); | |
kinuko
2017/04/20 04:08:14
We could get ServiceWorkerNetworkProvider here and
horo
2017/04/20 08:35:43
Done.
| |
350 // TODO(horo): Set more information about the context (ex: DataSaverEnabled) | |
351 // to |web_worker_fetch_context|. | |
352 ProvideWorkerFetchContextToWorker(worker_clients, | |
353 std::move(web_worker_fetch_context)); | |
354 } | |
355 | |
342 ContentSecurityPolicy* content_security_policy = | 356 ContentSecurityPolicy* content_security_policy = |
343 main_script_loader_->ReleaseContentSecurityPolicy(); | 357 main_script_loader_->ReleaseContentSecurityPolicy(); |
344 WorkerThreadStartMode start_mode = | 358 WorkerThreadStartMode start_mode = |
345 worker_inspector_proxy_->WorkerStartMode(document); | 359 worker_inspector_proxy_->WorkerStartMode(document); |
346 std::unique_ptr<WorkerSettings> worker_settings = | 360 std::unique_ptr<WorkerSettings> worker_settings = |
347 WTF::WrapUnique(new WorkerSettings(document->GetSettings())); | 361 WTF::WrapUnique(new WorkerSettings(document->GetSettings())); |
348 std::unique_ptr<WorkerThreadStartupData> startup_data = | 362 std::unique_ptr<WorkerThreadStartupData> startup_data = |
349 WorkerThreadStartupData::Create( | 363 WorkerThreadStartupData::Create( |
350 url_, loading_document_->UserAgent(), | 364 url_, loading_document_->UserAgent(), |
351 main_script_loader_->SourceText(), nullptr, start_mode, | 365 main_script_loader_->SourceText(), nullptr, start_mode, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
416 const WebString& method, | 430 const WebString& method, |
417 const WebString& message) { | 431 const WebString& message) { |
418 if (asked_to_terminate_) | 432 if (asked_to_terminate_) |
419 return; | 433 return; |
420 WebDevToolsAgent* devtools_agent = main_frame_->DevToolsAgent(); | 434 WebDevToolsAgent* devtools_agent = main_frame_->DevToolsAgent(); |
421 if (devtools_agent) | 435 if (devtools_agent) |
422 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method, | 436 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method, |
423 message); | 437 message); |
424 } | 438 } |
425 | 439 |
440 WebServiceWorkerNetworkProvider* | |
441 WebSharedWorkerImpl::GetServiceWorkerNetworkProvider() { | |
442 WebLocalFrameImpl* webFrame = | |
443 WebLocalFrameImpl::FromFrame(main_frame_->GetFrame()); | |
444 return webFrame->DataSource()->GetServiceWorkerNetworkProvider(); | |
445 } | |
446 | |
426 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) { | 447 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) { |
427 return new WebSharedWorkerImpl(client); | 448 return new WebSharedWorkerImpl(client); |
428 } | 449 } |
429 | 450 |
430 } // namespace blink | 451 } // namespace blink |
OLD | NEW |