| Index: content/browser/service_worker/service_worker_provider_host.cc
|
| diff --git a/content/browser/service_worker/service_worker_provider_host.cc b/content/browser/service_worker/service_worker_provider_host.cc
|
| index a616574a951dc13897a7a22b5a5657e960e11cde..d00f76f41af04519086089b7ef9428fd571834fb 100644
|
| --- a/content/browser/service_worker/service_worker_provider_host.cc
|
| +++ b/content/browser/service_worker/service_worker_provider_host.cc
|
| @@ -97,11 +97,9 @@
|
| // Generate a new browser-assigned id for the host.
|
| int provider_id = g_next_navigation_provider_id--;
|
| auto host = base::WrapUnique(new ServiceWorkerProviderHost(
|
| - ChildProcessHost::kInvalidUniqueID,
|
| - ServiceWorkerProviderHostInfo(provider_id, MSG_ROUTING_NONE,
|
| - SERVICE_WORKER_PROVIDER_FOR_WINDOW,
|
| - are_ancestors_secure),
|
| - context, nullptr));
|
| + ChildProcessHost::kInvalidUniqueID, MSG_ROUTING_NONE, provider_id,
|
| + SERVICE_WORKER_PROVIDER_FOR_WINDOW, are_ancestors_secure, context,
|
| + nullptr));
|
| host->web_contents_getter_ = web_contents_getter;
|
| return host;
|
| }
|
| @@ -113,7 +111,8 @@
|
| base::WeakPtr<ServiceWorkerContextCore> context,
|
| ServiceWorkerDispatcherHost* dispatcher_host) {
|
| return base::WrapUnique(new ServiceWorkerProviderHost(
|
| - process_id, std::move(info), context, dispatcher_host));
|
| + process_id, info.route_id, info.provider_id, info.type,
|
| + info.is_parent_frame_secure, context, dispatcher_host));
|
| }
|
|
|
| void ServiceWorkerProviderHost::BindWorkerFetchContext(
|
| @@ -143,23 +142,29 @@
|
|
|
| ServiceWorkerProviderHost::ServiceWorkerProviderHost(
|
| int render_process_id,
|
| - ServiceWorkerProviderHostInfo info,
|
| + int route_id,
|
| + int provider_id,
|
| + ServiceWorkerProviderType provider_type,
|
| + bool is_parent_frame_secure,
|
| base::WeakPtr<ServiceWorkerContextCore> context,
|
| ServiceWorkerDispatcherHost* dispatcher_host)
|
| : client_uuid_(base::GenerateGUID()),
|
| render_process_id_(render_process_id),
|
| + route_id_(route_id),
|
| render_thread_id_(kDocumentMainThreadId),
|
| - info_(std::move(info)),
|
| + provider_id_(provider_id),
|
| + provider_type_(provider_type),
|
| + is_parent_frame_secure_(is_parent_frame_secure),
|
| context_(context),
|
| dispatcher_host_(dispatcher_host),
|
| allow_association_(true) {
|
| - DCHECK_NE(SERVICE_WORKER_PROVIDER_UNKNOWN, info_.type);
|
| + DCHECK_NE(SERVICE_WORKER_PROVIDER_UNKNOWN, provider_type_);
|
|
|
| // PlzNavigate
|
| CHECK(render_process_id != ChildProcessHost::kInvalidUniqueID ||
|
| IsBrowserSideNavigationEnabled());
|
|
|
| - if (info_.type == SERVICE_WORKER_PROVIDER_FOR_CONTROLLER) {
|
| + if (provider_type_ == SERVICE_WORKER_PROVIDER_FOR_CONTROLLER) {
|
| // Actual thread id is set when the service worker context gets started.
|
| render_thread_id_ = kInvalidEmbeddedWorkerThreadId;
|
| }
|
| @@ -183,8 +188,8 @@
|
| }
|
|
|
| int ServiceWorkerProviderHost::frame_id() const {
|
| - if (info_.type == SERVICE_WORKER_PROVIDER_FOR_WINDOW)
|
| - return info_.route_id;
|
| + if (provider_type_ == SERVICE_WORKER_PROVIDER_FOR_WINDOW)
|
| + return route_id_;
|
| return MSG_ROUTING_NONE;
|
| }
|
|
|
| @@ -299,7 +304,7 @@
|
| }
|
|
|
| bool ServiceWorkerProviderHost::IsProviderForClient() const {
|
| - switch (info_.type) {
|
| + switch (provider_type_) {
|
| case SERVICE_WORKER_PROVIDER_FOR_WINDOW:
|
| case SERVICE_WORKER_PROVIDER_FOR_WORKER:
|
| case SERVICE_WORKER_PROVIDER_FOR_SHARED_WORKER:
|
| @@ -307,15 +312,15 @@
|
| case SERVICE_WORKER_PROVIDER_FOR_CONTROLLER:
|
| return false;
|
| case SERVICE_WORKER_PROVIDER_UNKNOWN:
|
| - NOTREACHED() << info_.type;
|
| - }
|
| - NOTREACHED() << info_.type;
|
| + NOTREACHED() << provider_type_;
|
| + }
|
| + NOTREACHED() << provider_type_;
|
| return false;
|
| }
|
|
|
| blink::WebServiceWorkerClientType ServiceWorkerProviderHost::client_type()
|
| const {
|
| - switch (info_.type) {
|
| + switch (provider_type_) {
|
| case SERVICE_WORKER_PROVIDER_FOR_WINDOW:
|
| return blink::kWebServiceWorkerClientTypeWindow;
|
| case SERVICE_WORKER_PROVIDER_FOR_WORKER:
|
| @@ -324,9 +329,9 @@
|
| return blink::kWebServiceWorkerClientTypeSharedWorker;
|
| case SERVICE_WORKER_PROVIDER_FOR_CONTROLLER:
|
| case SERVICE_WORKER_PROVIDER_UNKNOWN:
|
| - NOTREACHED() << info_.type;
|
| - }
|
| - NOTREACHED() << info_.type;
|
| + NOTREACHED() << provider_type_;
|
| + }
|
| + NOTREACHED() << provider_type_;
|
| return blink::kWebServiceWorkerClientTypeWindow;
|
| }
|
|
|
| @@ -532,13 +537,14 @@
|
| std::unique_ptr<ServiceWorkerProviderHost>
|
| ServiceWorkerProviderHost::PrepareForCrossSiteTransfer() {
|
| DCHECK_NE(ChildProcessHost::kInvalidUniqueID, render_process_id_);
|
| - DCHECK_NE(MSG_ROUTING_NONE, info_.route_id);
|
| + DCHECK_NE(MSG_ROUTING_NONE, route_id_);
|
| DCHECK_EQ(kDocumentMainThreadId, render_thread_id_);
|
| - DCHECK_NE(SERVICE_WORKER_PROVIDER_UNKNOWN, info_.type);
|
| + DCHECK_NE(SERVICE_WORKER_PROVIDER_UNKNOWN, provider_type_);
|
|
|
| std::unique_ptr<ServiceWorkerProviderHost> provisional_host =
|
| base::WrapUnique(new ServiceWorkerProviderHost(
|
| - process_id(), std::move(info_), context_, dispatcher_host()));
|
| + process_id(), frame_id(), provider_id(), provider_type(),
|
| + is_parent_frame_secure(), context_, dispatcher_host()));
|
|
|
| for (const GURL& pattern : associated_patterns_)
|
| DecreaseProcessReference(pattern);
|
| @@ -554,7 +560,10 @@
|
| }
|
|
|
| render_process_id_ = ChildProcessHost::kInvalidUniqueID;
|
| + route_id_ = MSG_ROUTING_NONE;
|
| render_thread_id_ = kInvalidEmbeddedWorkerThreadId;
|
| + provider_id_ = kInvalidServiceWorkerProviderId;
|
| + provider_type_ = SERVICE_WORKER_PROVIDER_UNKNOWN;
|
| dispatcher_host_ = nullptr;
|
| return provisional_host;
|
| }
|
| @@ -566,8 +575,8 @@
|
| DCHECK_NE(MSG_ROUTING_NONE, provisional_host->frame_id());
|
|
|
| render_thread_id_ = kDocumentMainThreadId;
|
| - info_.provider_id = provisional_host->provider_id();
|
| - info_.type = provisional_host->provider_type();
|
| + provider_id_ = provisional_host->provider_id();
|
| + provider_type_ = provisional_host->provider_type();
|
|
|
| FinalizeInitialization(provisional_host->process_id(),
|
| provisional_host->frame_id(),
|
| @@ -581,7 +590,7 @@
|
| ServiceWorkerDispatcherHost* dispatcher_host) {
|
| CHECK(IsBrowserSideNavigationEnabled());
|
| DCHECK_EQ(ChildProcessHost::kInvalidUniqueID, render_process_id_);
|
| - DCHECK_EQ(SERVICE_WORKER_PROVIDER_FOR_WINDOW, info_.type);
|
| + DCHECK_EQ(SERVICE_WORKER_PROVIDER_FOR_WINDOW, provider_type_);
|
| DCHECK_EQ(kDocumentMainThreadId, render_thread_id_);
|
|
|
| DCHECK_NE(ChildProcessHost::kInvalidUniqueID, process_id);
|
| @@ -759,7 +768,7 @@
|
| int frame_routing_id,
|
| ServiceWorkerDispatcherHost* dispatcher_host) {
|
| render_process_id_ = process_id;
|
| - info_.route_id = frame_routing_id;
|
| + route_id_ = frame_routing_id;
|
| dispatcher_host_ = dispatcher_host;
|
|
|
| for (const GURL& pattern : associated_patterns_)
|
|
|