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

Unified Diff: content/child/service_worker/web_service_worker_provider_impl.cc

Issue 885443006: ServiceWorker: Get registration info and its version attributes in one lock operation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/child/service_worker/web_service_worker_provider_impl.cc
diff --git a/content/child/service_worker/web_service_worker_provider_impl.cc b/content/child/service_worker/web_service_worker_provider_impl.cc
index 851fad940c40bb33d054787505206cf363bc66f7..11b44b5cf089a8230334226db651dd6c386abeb4 100644
--- a/content/child/service_worker/web_service_worker_provider_impl.cc
+++ b/content/child/service_worker/web_service_worker_provider_impl.cc
@@ -49,20 +49,20 @@ void WebServiceWorkerProviderImpl::setClient(
// for more context)
GetDispatcher()->AddProviderClient(provider_id_, client);
- if (!context_->registration()) {
- // This provider is not associated with any registration.
+ if (!context_->IsAssociatedWithRegistration())
Kunihiko Sakamoto 2015/01/28 06:38:55 I wonder if this and GetRegistrationInfoAndVersion
nhiroki 2015/01/28 07:42:27 Good point. Done.
return;
- }
// Set .ready if the associated registration has the active service worker.
if (context_->active_handle_id() != kInvalidServiceWorkerHandleId) {
+ ServiceWorkerRegistrationObjectInfo info;
+ ServiceWorkerVersionAttributes attrs;
+ context_->GetRegistrationInfoAndVersionAttributes(&info, &attrs);
+
WebServiceWorkerRegistrationImpl* registration =
- GetDispatcher()->FindServiceWorkerRegistration(
- context_->registration()->info(), false);
+ GetDispatcher()->FindServiceWorkerRegistration(info, false);
if (!registration) {
- registration = GetDispatcher()->CreateServiceWorkerRegistration(
- context_->registration()->info(), false);
- ServiceWorkerVersionAttributes attrs = context_->GetVersionAttributes();
+ registration =
+ GetDispatcher()->CreateServiceWorkerRegistration(info, false);
registration->SetInstalling(
GetDispatcher()->GetServiceWorker(attrs.installing, false));
registration->SetWaiting(

Powered by Google App Engine
This is Rietveld 408576698