Chromium Code Reviews| Index: content/child/service_worker/service_worker_network_provider.cc |
| diff --git a/content/child/service_worker/service_worker_network_provider.cc b/content/child/service_worker/service_worker_network_provider.cc |
| index a21c08f87fb70dec994c1583609cb0da1da7c04c..ce15ac614d868ddca1a129aee2b59c52b4344968 100644 |
| --- a/content/child/service_worker/service_worker_network_provider.cc |
| +++ b/content/child/service_worker/service_worker_network_provider.cc |
| @@ -5,9 +5,12 @@ |
| #include "content/child/service_worker/service_worker_network_provider.h" |
| #include "base/atomic_sequence_num.h" |
| +#include "base/command_line.h" |
| #include "content/child/child_thread_impl.h" |
| #include "content/child/service_worker/service_worker_provider_context.h" |
| #include "content/common/service_worker/service_worker_messages.h" |
| +#include "content/common/service_worker/service_worker_utils.h" |
| +#include "content/public/common/content_switches.h" |
| namespace content { |
| @@ -46,17 +49,40 @@ ServiceWorkerNetworkProvider* ServiceWorkerNetworkProvider::FromDocumentState( |
| ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider( |
| int route_id, |
| - ServiceWorkerProviderType provider_type) |
| - : provider_id_(GenerateProviderIdForType(provider_type)) { |
| + ServiceWorkerProviderType provider_type, |
| + int browser_provider_id) { |
| + provider_id_ = kInvalidServiceWorkerProviderId; |
| + if (ServiceWorkerUtils::IsBrowserAssignedProviderId(browser_provider_id)) { |
| + // PlzNavigate |
| + CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
|
michaeln
2015/10/01 23:11:12
plz vett ipc params higher up in the stack
Fabrice (no longer in Chrome)
2015/10/02 16:37:34
Done.
|
| + switches::kEnableBrowserSideNavigation)); |
| + DCHECK_NE(SERVICE_WORKER_PROVIDER_FOR_SANDBOXED_FRAME, provider_type); |
| + // This is a navigation. The ServiceWorkerProviderHost has already been |
| + // initialized, copy the provider_id value. |
| + provider_id_ = browser_provider_id; |
| + } else { |
| + // Initialize a new provider ID in all other cases. |
| + DCHECK_EQ(kInvalidServiceWorkerProviderId, browser_provider_id); |
| + provider_id_ = GenerateProviderIdForType(provider_type); |
| + } |
| if (provider_id_ == kInvalidServiceWorkerProviderId) |
| return; |
| + |
| context_ = new ServiceWorkerProviderContext(provider_id_); |
| if (!ChildThreadImpl::current()) |
| return; // May be null in some tests. |
| + |
| ChildThreadImpl::current()->Send(new ServiceWorkerHostMsg_ProviderCreated( |
| provider_id_, route_id, provider_type)); |
| } |
| +ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider( |
| + int route_id, |
| + ServiceWorkerProviderType provider_type) |
| + : ServiceWorkerNetworkProvider(route_id, |
| + provider_type, |
| + kInvalidServiceWorkerProviderId) {} |
| + |
| ServiceWorkerNetworkProvider::~ServiceWorkerNetworkProvider() { |
| if (provider_id_ == kInvalidServiceWorkerProviderId) |
| return; |