| 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 e16454558e0ec9cc46862b3110a811dcf3bfca6f..2559dacd58b23916fa14f7f71301e01e48bf2482 100644
|
| --- a/content/browser/service_worker/service_worker_provider_host.cc
|
| +++ b/content/browser/service_worker/service_worker_provider_host.cc
|
| @@ -17,6 +17,7 @@
|
| #include "content/common/resource_request_body.h"
|
| #include "content/common/service_worker/service_worker_messages.h"
|
| #include "content/common/service_worker/service_worker_types.h"
|
| +#include "content/public/common/child_process_host.h"
|
|
|
| namespace content {
|
|
|
| @@ -31,6 +32,7 @@ ServiceWorkerProviderHost::ServiceWorkerProviderHost(
|
| context_(context),
|
| dispatcher_host_(dispatcher_host),
|
| allow_association_(true) {
|
| + DCHECK_NE(ChildProcessHost::kInvalidUniqueID, process_id_);
|
| }
|
|
|
| ServiceWorkerProviderHost::~ServiceWorkerProviderHost() {
|
| @@ -214,6 +216,49 @@ void ServiceWorkerProviderHost::AddScopedProcessReferenceToPattern(
|
| IncreaseProcessReference(pattern);
|
| }
|
|
|
| +void ServiceWorkerProviderHost::PrepareForCrossSiteTransfer() {
|
| + DCHECK_NE(ChildProcessHost::kInvalidUniqueID, process_id_);
|
| +
|
| + for (std::vector<GURL>::iterator it = associated_patterns_.begin();
|
| + it != associated_patterns_.end(); ++it) {
|
| + DecreaseProcessReference(*it);
|
| + }
|
| +
|
| + if (associated_registration_.get()) {
|
| + scoped_refptr<ServiceWorkerRegistration> registration =
|
| + associated_registration_;
|
| + DisassociateRegistration();
|
| + associated_registration_ = registration;
|
| + }
|
| +
|
| + process_id_ = ChildProcessHost::kInvalidUniqueID;
|
| + provider_id_ = kInvalidServiceWorkerProviderId;
|
| + dispatcher_host_ = nullptr;
|
| +}
|
| +
|
| +void ServiceWorkerProviderHost::CompleteCrossSiteTransfer(
|
| + int new_process_id,
|
| + int new_provider_id,
|
| + ServiceWorkerDispatcherHost* new_dispatcher_host) {
|
| + DCHECK_EQ(ChildProcessHost::kInvalidUniqueID, process_id_);
|
| + DCHECK_NE(ChildProcessHost::kInvalidUniqueID, new_process_id);
|
| +
|
| + process_id_ = new_process_id;
|
| + provider_id_ = new_provider_id;
|
| + dispatcher_host_ = new_dispatcher_host;
|
| +
|
| + for (std::vector<GURL>::iterator it = associated_patterns_.begin();
|
| + it != associated_patterns_.end(); ++it) {
|
| + IncreaseProcessReference(*it);
|
| + }
|
| +
|
| + if (associated_registration_.get()) {
|
| + scoped_refptr<ServiceWorkerRegistration> registration;
|
| + registration.swap(associated_registration_);
|
| + AssociateRegistration(registration);
|
| + }
|
| +}
|
| +
|
| ServiceWorkerObjectInfo ServiceWorkerProviderHost::CreateHandleAndPass(
|
| ServiceWorkerVersion* version) {
|
| ServiceWorkerObjectInfo info;
|
|
|