| 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 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 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/dom/TaskRunnerHelper.h" | 35 #include "core/dom/TaskRunnerHelper.h" |
| 36 #include "core/events/MessageEvent.h" | 36 #include "core/events/MessageEvent.h" |
| 37 #include "core/exported/WebDataSourceImpl.h" | 37 #include "core/exported/WebDataSourceImpl.h" |
| 38 #include "core/frame/WebLocalFrameBase.h" |
| 38 #include "core/inspector/ConsoleMessage.h" | 39 #include "core/inspector/ConsoleMessage.h" |
| 39 #include "core/loader/FrameLoadRequest.h" | 40 #include "core/loader/FrameLoadRequest.h" |
| 40 #include "core/loader/FrameLoader.h" | 41 #include "core/loader/FrameLoader.h" |
| 41 #include "core/loader/ThreadableLoadingContext.h" | 42 #include "core/loader/ThreadableLoadingContext.h" |
| 42 #include "core/loader/WorkerFetchContext.h" | 43 #include "core/loader/WorkerFetchContext.h" |
| 43 #include "core/probe/CoreProbes.h" | 44 #include "core/probe/CoreProbes.h" |
| 44 #include "core/workers/ParentFrameTaskRunners.h" | 45 #include "core/workers/ParentFrameTaskRunners.h" |
| 45 #include "core/workers/SharedWorkerGlobalScope.h" | 46 #include "core/workers/SharedWorkerGlobalScope.h" |
| 46 #include "core/workers/SharedWorkerThread.h" | 47 #include "core/workers/SharedWorkerThread.h" |
| 47 #include "core/workers/WorkerClients.h" | 48 #include "core/workers/WorkerClients.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 68 #include "public/platform/WebURLRequest.h" | 69 #include "public/platform/WebURLRequest.h" |
| 69 #include "public/platform/WebWorkerFetchContext.h" | 70 #include "public/platform/WebWorkerFetchContext.h" |
| 70 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.
h" | 71 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.
h" |
| 71 #include "public/web/WebDevToolsAgent.h" | 72 #include "public/web/WebDevToolsAgent.h" |
| 72 #include "public/web/WebFrame.h" | 73 #include "public/web/WebFrame.h" |
| 73 #include "public/web/WebSettings.h" | 74 #include "public/web/WebSettings.h" |
| 74 #include "public/web/WebView.h" | 75 #include "public/web/WebView.h" |
| 75 #include "public/web/WebWorkerContentSettingsClientProxy.h" | 76 #include "public/web/WebWorkerContentSettingsClientProxy.h" |
| 76 #include "web/IndexedDBClientImpl.h" | 77 #include "web/IndexedDBClientImpl.h" |
| 77 #include "web/LocalFileSystemClient.h" | 78 #include "web/LocalFileSystemClient.h" |
| 78 #include "web/WebLocalFrameImpl.h" | |
| 79 | 79 |
| 80 namespace blink { | 80 namespace blink { |
| 81 | 81 |
| 82 // TODO(toyoshim): Share implementation with WebEmbeddedWorkerImpl as much as | 82 // TODO(toyoshim): Share implementation with WebEmbeddedWorkerImpl as much as |
| 83 // possible. | 83 // possible. |
| 84 | 84 |
| 85 WebSharedWorkerImpl::WebSharedWorkerImpl(WebSharedWorkerClient* client) | 85 WebSharedWorkerImpl::WebSharedWorkerImpl(WebSharedWorkerClient* client) |
| 86 : web_view_(nullptr), | 86 : web_view_(nullptr), |
| 87 main_frame_(nullptr), | 87 main_frame_(nullptr), |
| 88 asked_to_terminate_(false), | 88 asked_to_terminate_(false), |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // loading requests from the worker context to the rest of WebKit and Chromium | 130 // loading requests from the worker context to the rest of WebKit and Chromium |
| 131 // infrastructure. | 131 // infrastructure. |
| 132 DCHECK(!web_view_); | 132 DCHECK(!web_view_); |
| 133 web_view_ = WebView::Create(nullptr, kWebPageVisibilityStateVisible); | 133 web_view_ = WebView::Create(nullptr, kWebPageVisibilityStateVisible); |
| 134 // FIXME: http://crbug.com/363843. This needs to find a better way to | 134 // FIXME: http://crbug.com/363843. This needs to find a better way to |
| 135 // not create graphics layers. | 135 // not create graphics layers. |
| 136 web_view_->GetSettings()->SetAcceleratedCompositingEnabled(false); | 136 web_view_->GetSettings()->SetAcceleratedCompositingEnabled(false); |
| 137 // FIXME: Settings information should be passed to the Worker process from | 137 // FIXME: Settings information should be passed to the Worker process from |
| 138 // Browser process when the worker is created (similar to | 138 // Browser process when the worker is created (similar to |
| 139 // RenderThread::OnCreateNewView). | 139 // RenderThread::OnCreateNewView). |
| 140 main_frame_ = ToWebLocalFrameImpl(WebLocalFrame::Create( | 140 main_frame_ = ToWebLocalFrameBase(WebLocalFrame::Create( |
| 141 WebTreeScopeType::kDocument, this, | 141 WebTreeScopeType::kDocument, this, |
| 142 Platform::Current()->GetInterfaceProvider(), nullptr)); | 142 Platform::Current()->GetInterfaceProvider(), nullptr)); |
| 143 web_view_->SetMainFrame(main_frame_.Get()); | 143 web_view_->SetMainFrame(main_frame_.Get()); |
| 144 main_frame_->SetDevToolsAgentClient(this); | 144 main_frame_->SetDevToolsAgentClient(this); |
| 145 | 145 |
| 146 // If we were asked to pause worker context on start and wait for debugger | 146 // If we were asked to pause worker context on start and wait for debugger |
| 147 // then it is the good time to do that. | 147 // then it is the good time to do that. |
| 148 client_->WorkerReadyForInspection(); | 148 client_->WorkerReadyForInspection(); |
| 149 if (pause_worker_context_on_start_) { | 149 if (pause_worker_context_on_start_) { |
| 150 is_paused_on_start_ = true; | 150 is_paused_on_start_ = true; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 ProvideContentSettingsClientToWorker( | 327 ProvideContentSettingsClientToWorker( |
| 328 worker_clients, | 328 worker_clients, |
| 329 WTF::WrapUnique(client_->CreateWorkerContentSettingsClientProxy( | 329 WTF::WrapUnique(client_->CreateWorkerContentSettingsClientProxy( |
| 330 web_security_origin))); | 330 web_security_origin))); |
| 331 ProvideIndexedDBClientToWorker(worker_clients, | 331 ProvideIndexedDBClientToWorker(worker_clients, |
| 332 IndexedDBClientImpl::Create(*worker_clients)); | 332 IndexedDBClientImpl::Create(*worker_clients)); |
| 333 | 333 |
| 334 if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) { | 334 if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) { |
| 335 std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context = | 335 std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context = |
| 336 client_->CreateWorkerFetchContext( | 336 client_->CreateWorkerFetchContext( |
| 337 WebLocalFrameImpl::FromFrame(main_frame_->GetFrame()) | 337 WebLocalFrameBase::FromFrame(main_frame_->GetFrame()) |
| 338 ->DataSource() | 338 ->DataSource() |
| 339 ->GetServiceWorkerNetworkProvider()); | 339 ->GetServiceWorkerNetworkProvider()); |
| 340 DCHECK(web_worker_fetch_context); | 340 DCHECK(web_worker_fetch_context); |
| 341 // TODO(horo): Set more information about the context (ex: DataSaverEnabled) | 341 // TODO(horo): Set more information about the context (ex: DataSaverEnabled) |
| 342 // to |web_worker_fetch_context|. | 342 // to |web_worker_fetch_context|. |
| 343 ProvideWorkerFetchContextToWorker(worker_clients, | 343 ProvideWorkerFetchContextToWorker(worker_clients, |
| 344 std::move(web_worker_fetch_context)); | 344 std::move(web_worker_fetch_context)); |
| 345 } | 345 } |
| 346 | 346 |
| 347 ContentSecurityPolicy* content_security_policy = | 347 ContentSecurityPolicy* content_security_policy = |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 if (devtools_agent) | 428 if (devtools_agent) |
| 429 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method, | 429 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method, |
| 430 message); | 430 message); |
| 431 } | 431 } |
| 432 | 432 |
| 433 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) { | 433 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) { |
| 434 return new WebSharedWorkerImpl(client); | 434 return new WebSharedWorkerImpl(client); |
| 435 } | 435 } |
| 436 | 436 |
| 437 } // namespace blink | 437 } // namespace blink |
| OLD | NEW |