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

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

Issue 477593007: ServiceWorker: Make '.ready' return a promise to be resolved with ServiceWorkerRegistration (2/3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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 ca4cfc7ba37eb461362657261e8ee6872ef7753a..4f8d005677ae7cea7c054948b7db017d22011667 100644
--- a/content/child/service_worker/web_service_worker_provider_impl.cc
+++ b/content/child/service_worker/web_service_worker_provider_impl.cc
@@ -10,7 +10,9 @@
#include "content/child/service_worker/service_worker_dispatcher.h"
#include "content/child/service_worker/service_worker_handle_reference.h"
#include "content/child/service_worker/service_worker_provider_context.h"
+#include "content/child/service_worker/service_worker_registration_handle_reference.h"
#include "content/child/service_worker/web_service_worker_impl.h"
+#include "content/child/service_worker/web_service_worker_registration_impl.h"
#include "content/child/thread_safe_sender.h"
#include "content/common/service_worker/service_worker_messages.h"
#include "third_party/WebKit/public/platform/WebServiceWorkerProviderClient.h"
@@ -47,19 +49,24 @@ void WebServiceWorkerProviderImpl::setClient(
// for more context)
GetDispatcher()->AddScriptClient(provider_id_, client);
- if (context_->installing_handle_id() != kInvalidServiceWorkerHandleId) {
- client->setInstalling(GetDispatcher()->GetServiceWorker(
- context_->installing()->info(), false));
- }
-
- if (context_->waiting_handle_id() != kInvalidServiceWorkerHandleId) {
- client->setWaiting(GetDispatcher()->GetServiceWorker(
- context_->waiting()->info(), false));
- }
-
if (context_->active_handle_id() != kInvalidServiceWorkerHandleId) {
- client->setActive(GetDispatcher()->GetServiceWorker(
+ WebServiceWorkerRegistrationImpl* registration =
+ GetDispatcher()->GetServiceWorkerRegistration(
+ context_->registration()->info(), false);
michaeln 2014/09/04 00:27:23 I know this is because things are in an intermedia
nhiroki 2014/09/08 15:55:52 Straightened the logic in the latest patchset. How
+
+ if (context_->installing_handle_id() != kInvalidServiceWorkerHandleId) {
+ registration->SetInstalling(GetDispatcher()->GetServiceWorker(
michaeln 2014/09/04 00:27:23 Registration may be a preexising object accoding t
nhiroki 2014/09/08 15:55:52 Updated. The latest patchset just reuses the exist
+ context_->installing()->info(), false));
+ }
+ if (context_->waiting_handle_id() != kInvalidServiceWorkerHandleId) {
+ registration->SetWaiting(GetDispatcher()->GetServiceWorker(
+ context_->waiting()->info(), false));
+ }
+ registration->SetActive(GetDispatcher()->GetServiceWorker(
context_->active()->info(), false));
+
+ client->setReady(GetDispatcher()->GetServiceWorkerRegistration(
+ context_->registration()->info(), false));
michaeln 2014/09/04 00:27:23 Is there a reason to call GetServiceWorkerRegistra
nhiroki 2014/09/08 15:55:52 Oops... that's just my mistake. The local variable
}
if (context_->controller_handle_id() != kInvalidServiceWorkerHandleId) {

Powered by Google App Engine
This is Rietveld 408576698