Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Unified Diff: content/browser/service_worker/service_worker_register_job.cc

Issue 894973003: ServiceWorker: Make "ready" fetches registration from browser process(2/3). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_register_job.cc
diff --git a/content/browser/service_worker/service_worker_register_job.cc b/content/browser/service_worker/service_worker_register_job.cc
index cec77ae059db1c41b6184fd40a26988953bc5801..d765c3c51354059b066b9583c13ce3912c2dfa1f 100644
--- a/content/browser/service_worker/service_worker_register_job.cc
+++ b/content/browser/service_worker/service_worker_register_job.cc
@@ -260,7 +260,7 @@ void ServiceWorkerRegisterJob::RegisterAndContinue() {
set_registration(new ServiceWorkerRegistration(
pattern_, context_->storage()->NewRegistrationId(), context_));
- AssociateProviderHostsToRegistration(registration());
+ AddRegistrationToMatchingProviderHosts(registration());
UpdateAndContinue();
}
@@ -548,18 +548,19 @@ void ServiceWorkerRegisterJob::OnCompareScriptResourcesComplete(
new_version()->embedded_worker()->RemoveListener(this);
}
-void ServiceWorkerRegisterJob::AssociateProviderHostsToRegistration(
+void ServiceWorkerRegisterJob::AddRegistrationToMatchingProviderHosts(
ServiceWorkerRegistration* registration) {
DCHECK(registration);
for (scoped_ptr<ServiceWorkerContextCore::ProviderHostIterator> it =
context_->GetProviderHostIterator();
!it->IsAtEnd(); it->Advance()) {
ServiceWorkerProviderHost* host = it->GetProviderHost();
- if (ServiceWorkerUtils::ScopeMatches(registration->pattern(),
- host->document_url())) {
- if (host->CanAssociateRegistration(registration))
- host->AssociateRegistration(registration);
- }
+ if (host->IsHostToRunningServiceWorker())
+ continue;
+ if (!ServiceWorkerUtils::ScopeMatches(registration->pattern(),
+ host->document_url()))
+ continue;
+ host->AddMatchingRegistration(registration);
}
}

Powered by Google App Engine
This is Rietveld 408576698