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

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: 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..4c19349c47f48aa005521a6943714b4666408b33 100644
--- a/content/child/service_worker/service_worker_provider_context.cc
+++ b/content/child/service_worker/service_worker_provider_context.cc
@@ -43,25 +43,24 @@ ServiceWorkerHandleReference* ServiceWorkerProviderContext::controller() {
return controller_.get();
}
-ServiceWorkerRegistrationHandleReference*
-ServiceWorkerProviderContext::registration() {
+bool ServiceWorkerProviderContext::IsAssociatedWithRegistration() {
base::AutoLock lock(lock_);
- return registration_.get();
+ return registration_ != nullptr;
}
-ServiceWorkerVersionAttributes
-ServiceWorkerProviderContext::GetVersionAttributes() {
+void ServiceWorkerProviderContext::GetRegistrationInfoAndVersionAttributes(
+ ServiceWorkerRegistrationObjectInfo* info,
+ ServiceWorkerVersionAttributes* attrs) {
base::AutoLock lock(lock_);
DCHECK(registration_);
- 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();
}
void ServiceWorkerProviderContext::SetVersionAttributes(

Powered by Google App Engine
This is Rietveld 408576698