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

Unified Diff: content/renderer/service_worker/embedded_worker_context_client.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/renderer/service_worker/embedded_worker_context_client.cc
diff --git a/content/renderer/service_worker/embedded_worker_context_client.cc b/content/renderer/service_worker/embedded_worker_context_client.cc
index ccf3dcce48defaba3f0f1d775b14fde0721beb91..6233e800f35a037db7c0ed1a8f23d497127af938 100644
--- a/content/renderer/service_worker/embedded_worker_context_client.cc
+++ b/content/renderer/service_worker/embedded_worker_context_client.cc
@@ -180,11 +180,11 @@ void EmbeddedWorkerContextClient::workerContextStarted(
g_worker_client_tls.Pointer()->Set(this);
script_context_.reset(new ServiceWorkerScriptContext(this, proxy));
- // This can be nullptr on EmbeddedWorkerBrowserTests.
- // TODO(nhiroki): Remove this workaround. |registration()| should always be
- // valid other than the test because the registration association message
- // arrives before starting the worker context.
- if (provider_context_->registration())
+ // This can be false on EmbeddedWorkerBrowserTests.
+ // TODO(nhiroki): Remove this workaround. |IsAssociatedWithRegistration()|
+ // should always return true other than the test because the registration
+ // association message arrives before starting the worker context.
+ if (provider_context_->IsAssociatedWithRegistration())
SetRegistrationInServiceWorkerGlobalScope();
Send(new EmbeddedWorkerHostMsg_WorkerScriptLoaded(
@@ -423,15 +423,14 @@ void EmbeddedWorkerContextClient::SetRegistrationInServiceWorkerGlobalScope() {
ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance(
thread_safe_sender());
- // Register a registration with the dispatcher living on the worker thread.
- DCHECK(provider_context_->registration());
- scoped_ptr<WebServiceWorkerRegistrationImpl> registration(
- dispatcher->CreateServiceWorkerRegistration(
- provider_context_->registration()->info(), false));
+ ServiceWorkerRegistrationObjectInfo info;
+ ServiceWorkerVersionAttributes attrs;
+ provider_context_->GetRegistrationInfoAndVersionAttributes(&info, &attrs);
- // Register workers with the dispatcher living on the worker thread.
- ServiceWorkerVersionAttributes attrs =
- provider_context_->GetVersionAttributes();
+ // Register a registrationi and its version attributes with the dispatcher
nhiroki 2015/01/28 05:54:58 registrationi -> registration I'll fix this later
nhiroki 2015/01/28 07:42:27 Done.
+ // living on the worker thread.
+ scoped_ptr<WebServiceWorkerRegistrationImpl> registration(
+ dispatcher->CreateServiceWorkerRegistration(info, false));
registration->SetInstalling(
dispatcher->GetServiceWorker(attrs.installing, false));
registration->SetWaiting(

Powered by Google App Engine
This is Rietveld 408576698