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

Unified Diff: content/child/service_worker/service_worker_provider_context.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: address review comments 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/service_worker_provider_context.cc
diff --git a/content/child/service_worker/service_worker_provider_context.cc b/content/child/service_worker/service_worker_provider_context.cc
index f37cc65c6854dc7e49310bedbc18f8f51d79bf9f..129d5578f10f50bd091828d2f2b54bcbb34ae7bd 100644
--- a/content/child/service_worker/service_worker_provider_context.cc
+++ b/content/child/service_worker/service_worker_provider_context.cc
@@ -43,25 +43,21 @@ ServiceWorkerHandleReference* ServiceWorkerProviderContext::controller() {
return controller_.get();
}
-ServiceWorkerRegistrationHandleReference*
-ServiceWorkerProviderContext::registration() {
+bool ServiceWorkerProviderContext::GetRegistrationInfoAndVersionAttributes(
+ ServiceWorkerRegistrationObjectInfo* info,
+ ServiceWorkerVersionAttributes* attrs) {
base::AutoLock lock(lock_);
- return registration_.get();
-}
-
-ServiceWorkerVersionAttributes
-ServiceWorkerProviderContext::GetVersionAttributes() {
- base::AutoLock lock(lock_);
- DCHECK(registration_);
+ if (!registration_)
+ return false;
- ServiceWorkerVersionAttributes attrs;
+ *info = registration_->info();
if (installing_)
- attrs.installing = installing_->info();
+ attrs->installing = installing_->info();
if (waiting_)
- attrs.waiting = waiting_->info();
+ attrs->waiting = waiting_->info();
if (active_)
- attrs.active = active_->info();
- return attrs;
+ attrs->active = active_->info();
+ return true;
}
void ServiceWorkerProviderContext::SetVersionAttributes(

Powered by Google App Engine
This is Rietveld 408576698