Commit c00da2be authored by Hiroki Nakagawa's avatar Hiroki Nakagawa Committed by Commit Bot

PlzWorker: Teach a precreated AppCacheHost's ID to SharedWorkerWebApplicationCacheHostImpl

On PlzWorker, AppCacheHost is created before starting worker script loading from
a renderer process. This CL teaches the precreated AppCacheHost's ID from the
browser process to the renderer process in order to associate worker script
loading with the host.

This fixes DCHECK failures on appcache-worker.https.html caused by host
mismatch, the test still times out though.

DesignDoc:
https://docs.google.com/document/d/1Jtn33bvqkqWxq6K7HIA4uU6HLWPTmOD7vFviacfTmhM/edit?usp=sharing

Bug: 715632
Cq-Include-Trybots: luci.chromium.try:linux_mojo
Change-Id: I16c17447bbb0f4b154c5a7e9393afdea2d0e29d6
Reviewed-on: https://chromium-review.googlesource.com/1150941
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578547}
parent ca53c434
...@@ -102,6 +102,7 @@ void MockSharedWorkerFactory::CreateSharedWorker( ...@@ -102,6 +102,7 @@ void MockSharedWorkerFactory::CreateSharedWorker(
blink::mojom::WorkerContentSettingsProxyPtr content_settings, blink::mojom::WorkerContentSettingsProxyPtr content_settings,
mojom::ServiceWorkerProviderInfoForSharedWorkerPtr mojom::ServiceWorkerProviderInfoForSharedWorkerPtr
service_worker_provider_info, service_worker_provider_info,
int appcache_host_id,
network::mojom::URLLoaderFactoryAssociatedPtrInfo network::mojom::URLLoaderFactoryAssociatedPtrInfo
script_loader_factory_ptr_info, script_loader_factory_ptr_info,
std::unique_ptr<URLLoaderFactoryBundleInfo> subresource_loaders, std::unique_ptr<URLLoaderFactoryBundleInfo> subresource_loaders,
......
...@@ -71,6 +71,7 @@ class MockSharedWorkerFactory : public mojom::SharedWorkerFactory { ...@@ -71,6 +71,7 @@ class MockSharedWorkerFactory : public mojom::SharedWorkerFactory {
blink::mojom::WorkerContentSettingsProxyPtr content_settings, blink::mojom::WorkerContentSettingsProxyPtr content_settings,
mojom::ServiceWorkerProviderInfoForSharedWorkerPtr mojom::ServiceWorkerProviderInfoForSharedWorkerPtr
service_worker_provider_info, service_worker_provider_info,
int appcache_host_id,
network::mojom::URLLoaderFactoryAssociatedPtrInfo network::mojom::URLLoaderFactoryAssociatedPtrInfo
script_loader_factory_ptr_info, script_loader_factory_ptr_info,
std::unique_ptr<URLLoaderFactoryBundleInfo> subresource_loaders, std::unique_ptr<URLLoaderFactoryBundleInfo> subresource_loaders,
......
...@@ -190,8 +190,11 @@ void SharedWorkerHost::Start( ...@@ -190,8 +190,11 @@ void SharedWorkerHost::Start(
factory_->CreateSharedWorker( factory_->CreateSharedWorker(
std::move(info), pause_on_start, devtools_worker_token, std::move(info), pause_on_start, devtools_worker_token,
renderer_preferences, std::move(content_settings), renderer_preferences, std::move(content_settings),
std::move(service_worker_provider_info), std::move(script_loader_factory), std::move(service_worker_provider_info),
std::move(factory_bundle), std::move(host), std::move(worker_request_), appcache_handle_ ? appcache_handle_->appcache_host_id()
: kAppCacheNoHostId,
std::move(script_loader_factory), std::move(factory_bundle),
std::move(host), std::move(worker_request_),
std::move(interface_provider)); std::move(interface_provider));
// Monitor the lifetime of the worker. // Monitor the lifetime of the worker.
......
...@@ -36,11 +36,17 @@ interface SharedWorkerFactory { ...@@ -36,11 +36,17 @@ interface SharedWorkerFactory {
blink.mojom.WorkerContentSettingsProxy content_settings, blink.mojom.WorkerContentSettingsProxy content_settings,
// S13nServiceWorker: // S13nServiceWorker:
// The info about the host in the browser process that provides support // The info about the service worker host in the browser process that
// for this shared worker to be a service worker client. Null when // provides support for this shared worker to be a service worker client.
// S13nServiceWorker is disabled. // Null when S13nServiceWorker is disabled.
ServiceWorkerProviderInfoForSharedWorker? service_worker_provider_info, ServiceWorkerProviderInfoForSharedWorker? service_worker_provider_info,
// NetworkService:
// The ID of the AppCacheHost in the browser process that serves resources
// for this shared worker. This is kAppCacheNoHostId when NetworkService
// is disabled or AppCache doesn't serve resources for this shared worker.
int32 appcache_host_id,
// S13nServiceWorker: // S13nServiceWorker:
// The URLLoaderFactory to use to request the shared worker's script // The URLLoaderFactory to use to request the shared worker's script
// (just the main script resource; importScripts() should go through the // (just the main script resource; importScripts() should go through the
......
...@@ -53,11 +53,12 @@ class SharedWorkerWebApplicationCacheHostImpl ...@@ -53,11 +53,12 @@ class SharedWorkerWebApplicationCacheHostImpl
: public WebApplicationCacheHostImpl { : public WebApplicationCacheHostImpl {
public: public:
SharedWorkerWebApplicationCacheHostImpl( SharedWorkerWebApplicationCacheHostImpl(
blink::WebApplicationCacheHostClient* client) blink::WebApplicationCacheHostClient* client,
int appcache_host_id)
: WebApplicationCacheHostImpl( : WebApplicationCacheHostImpl(
client, client,
RenderThreadImpl::current()->appcache_dispatcher()->backend_proxy(), RenderThreadImpl::current()->appcache_dispatcher()->backend_proxy(),
kAppCacheNoHostId) {} appcache_host_id) {}
// Main resource loading is different for workers. The main resource is // Main resource loading is different for workers. The main resource is
// loaded by the worker using WorkerClassicScriptLoader. // loaded by the worker using WorkerClassicScriptLoader.
...@@ -199,6 +200,7 @@ EmbeddedSharedWorkerStub::EmbeddedSharedWorkerStub( ...@@ -199,6 +200,7 @@ EmbeddedSharedWorkerStub::EmbeddedSharedWorkerStub(
blink::mojom::WorkerContentSettingsProxyPtr content_settings, blink::mojom::WorkerContentSettingsProxyPtr content_settings,
mojom::ServiceWorkerProviderInfoForSharedWorkerPtr mojom::ServiceWorkerProviderInfoForSharedWorkerPtr
service_worker_provider_info, service_worker_provider_info,
int appcache_host_id,
network::mojom::URLLoaderFactoryAssociatedPtrInfo network::mojom::URLLoaderFactoryAssociatedPtrInfo
script_loader_factory_info, script_loader_factory_info,
std::unique_ptr<URLLoaderFactoryBundleInfo> subresource_loaders, std::unique_ptr<URLLoaderFactoryBundleInfo> subresource_loaders,
...@@ -209,7 +211,13 @@ EmbeddedSharedWorkerStub::EmbeddedSharedWorkerStub( ...@@ -209,7 +211,13 @@ EmbeddedSharedWorkerStub::EmbeddedSharedWorkerStub(
host_(std::move(host)), host_(std::move(host)),
name_(info->name), name_(info->name),
url_(info->url), url_(info->url),
renderer_preferences_(renderer_preferences) { renderer_preferences_(renderer_preferences),
appcache_host_id_(appcache_host_id) {
// The ID of the precreated AppCacheHost can be valid only when the
// NetworkService is enabled.
DCHECK(base::FeatureList::IsEnabled(network::features::kNetworkService) ||
appcache_host_id == kAppCacheNoHostId);
impl_ = blink::WebSharedWorker::Create(this); impl_ = blink::WebSharedWorker::Create(this);
if (pause_on_start) { if (pause_on_start) {
// Pause worker context when it starts and wait until either DevTools client // Pause worker context when it starts and wait until either DevTools client
...@@ -314,7 +322,8 @@ std::unique_ptr<blink::WebApplicationCacheHost> ...@@ -314,7 +322,8 @@ std::unique_ptr<blink::WebApplicationCacheHost>
EmbeddedSharedWorkerStub::CreateApplicationCacheHost( EmbeddedSharedWorkerStub::CreateApplicationCacheHost(
blink::WebApplicationCacheHostClient* client) { blink::WebApplicationCacheHostClient* client) {
std::unique_ptr<WebApplicationCacheHostImpl> host = std::unique_ptr<WebApplicationCacheHostImpl> host =
std::make_unique<SharedWorkerWebApplicationCacheHostImpl>(client); std::make_unique<SharedWorkerWebApplicationCacheHostImpl>(
client, appcache_host_id_);
app_cache_host_ = host.get(); app_cache_host_ = host.get();
return std::move(host); return std::move(host);
} }
......
...@@ -64,6 +64,7 @@ class EmbeddedSharedWorkerStub : public blink::WebSharedWorkerClient, ...@@ -64,6 +64,7 @@ class EmbeddedSharedWorkerStub : public blink::WebSharedWorkerClient,
blink::mojom::WorkerContentSettingsProxyPtr content_settings, blink::mojom::WorkerContentSettingsProxyPtr content_settings,
mojom::ServiceWorkerProviderInfoForSharedWorkerPtr mojom::ServiceWorkerProviderInfoForSharedWorkerPtr
service_worker_provider_info, service_worker_provider_info,
int appcache_host_id,
network::mojom::URLLoaderFactoryAssociatedPtrInfo network::mojom::URLLoaderFactoryAssociatedPtrInfo
script_loader_factory_info, script_loader_factory_info,
std::unique_ptr<URLLoaderFactoryBundleInfo> subresource_loaders, std::unique_ptr<URLLoaderFactoryBundleInfo> subresource_loaders,
...@@ -116,6 +117,7 @@ class EmbeddedSharedWorkerStub : public blink::WebSharedWorkerClient, ...@@ -116,6 +117,7 @@ class EmbeddedSharedWorkerStub : public blink::WebSharedWorkerClient,
std::vector<PendingChannel> pending_channels_; std::vector<PendingChannel> pending_channels_;
ScopedChildProcessReference process_ref_; ScopedChildProcessReference process_ref_;
const int appcache_host_id_;
WebApplicationCacheHostImpl* app_cache_host_ = nullptr; // Not owned. WebApplicationCacheHostImpl* app_cache_host_ = nullptr; // Not owned.
// S13nServiceWorker: The info needed to connect to the // S13nServiceWorker: The info needed to connect to the
......
...@@ -28,6 +28,7 @@ void SharedWorkerFactoryImpl::CreateSharedWorker( ...@@ -28,6 +28,7 @@ void SharedWorkerFactoryImpl::CreateSharedWorker(
blink::mojom::WorkerContentSettingsProxyPtr content_settings, blink::mojom::WorkerContentSettingsProxyPtr content_settings,
mojom::ServiceWorkerProviderInfoForSharedWorkerPtr mojom::ServiceWorkerProviderInfoForSharedWorkerPtr
service_worker_provider_info, service_worker_provider_info,
int appcache_host_id,
network::mojom::URLLoaderFactoryAssociatedPtrInfo network::mojom::URLLoaderFactoryAssociatedPtrInfo
script_loader_factory_ptr_info, script_loader_factory_ptr_info,
std::unique_ptr<URLLoaderFactoryBundleInfo> subresource_loaders, std::unique_ptr<URLLoaderFactoryBundleInfo> subresource_loaders,
...@@ -38,7 +39,7 @@ void SharedWorkerFactoryImpl::CreateSharedWorker( ...@@ -38,7 +39,7 @@ void SharedWorkerFactoryImpl::CreateSharedWorker(
new EmbeddedSharedWorkerStub( new EmbeddedSharedWorkerStub(
std::move(info), pause_on_start, devtools_worker_token, std::move(info), pause_on_start, devtools_worker_token,
renderer_preferences, std::move(content_settings), renderer_preferences, std::move(content_settings),
std::move(service_worker_provider_info), std::move(service_worker_provider_info), appcache_host_id,
std::move(script_loader_factory_ptr_info), std::move(subresource_loaders), std::move(script_loader_factory_ptr_info), std::move(subresource_loaders),
std::move(host), std::move(request), std::move(interface_provider)); std::move(host), std::move(request), std::move(interface_provider));
} }
......
...@@ -29,6 +29,7 @@ class SharedWorkerFactoryImpl : public mojom::SharedWorkerFactory { ...@@ -29,6 +29,7 @@ class SharedWorkerFactoryImpl : public mojom::SharedWorkerFactory {
blink::mojom::WorkerContentSettingsProxyPtr content_settings, blink::mojom::WorkerContentSettingsProxyPtr content_settings,
mojom::ServiceWorkerProviderInfoForSharedWorkerPtr mojom::ServiceWorkerProviderInfoForSharedWorkerPtr
service_worker_provider_info, service_worker_provider_info,
int appcache_host_id,
network::mojom::URLLoaderFactoryAssociatedPtrInfo network::mojom::URLLoaderFactoryAssociatedPtrInfo
script_loader_factory_ptr_info, script_loader_factory_ptr_info,
std::unique_ptr<URLLoaderFactoryBundleInfo> subresource_loaders, std::unique_ptr<URLLoaderFactoryBundleInfo> subresource_loaders,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
Bug(none) external/wpt/clear-site-data/storage.https.html [ Failure ] Bug(none) external/wpt/clear-site-data/storage.https.html [ Failure ]
Bug(none) external/wpt/clear-site-data/navigation.https.html [ Timeout ] Bug(none) external/wpt/clear-site-data/navigation.https.html [ Timeout ]
Bug(none) external/wpt/html/browsers/offline/appcache/workers/appcache-worker.html [ Timeout ] Bug(none) external/wpt/html/browsers/offline/appcache/workers/appcache-worker.html [ Timeout ]
crbug.com/829417 external/wpt/html/browsers/offline/appcache/workers/appcache-worker.https.html [ Crash Timeout ] crbug.com/829417 external/wpt/html/browsers/offline/appcache/workers/appcache-worker.https.html [ Timeout ]
crbug.com/771118 external/wpt/service-workers/service-worker/mime-sniffing.https.html [ Failure ] crbug.com/771118 external/wpt/service-workers/service-worker/mime-sniffing.https.html [ Failure ]
Bug(none) http/tests/misc/redirect-to-about-blank.html [ Timeout ] Bug(none) http/tests/misc/redirect-to-about-blank.html [ Timeout ]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment